+1.3.93.jcn2
+===========
+
+* Added backend framework for arpeggios.
+
+1.3.93.uu1
+==========
+
+* Bugfix: don't crash if there is volta bracket to end.
+
+* Move offset callbacks into Scheme.
+
1.3.93.jcn1
===========
* Moved Pedal_engraver to Staff context.
-* Found some bugs.
-1.3.92.jcn2
-===========
+
+1.3.93
+======
* Added some error messages for toplevel and stray string parse errors.
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=93
-MY_PATCH_LEVEL=tca1
+MY_PATCH_LEVEL=jcn2
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- /dev/null
+\score{
+ \context StaffGroup <
+ %<
+ \context Staff=one \notes\relative c''{
+ f,
+ <f, a c>
+ }
+ \context Staff=two \notes\relative c{
+ \clef bass;
+ g
+ <g b d>
+ }
+ >
+ \paper{
+ \translator{
+ \StaffContext
+ \consists Arpeggio_engraver;
+ }
+ }
+}
*/
#include "align-interface.hh"
-
#include "score-element.hh"
#include "group-interface.hh"
#include "axis-group-interface.hh"
This callback is set in the children of the align element. It does
not compute anything, but a side effect of a->do_side_processing ()
is that the elements are placed correctly. */
-Real
-Align_interface::alignment_callback (Score_element *sc, Axis ax)
+MAKE_SCHEME_CALLBACK(Align_interface,alignment_callback,2);
+SCM
+Align_interface::alignment_callback (SCM element_smob, SCM axis)
{
- Score_element * par = sc->parent_l (ax);
+ Score_element * sun = unsmob_element (element_smob);
+ Axis ax = (Axis )gh_scm2int (axis);
+ Score_element * par = sun->parent_l (ax);
if (par && !to_boolean (par->get_elt_property ("alignment-done")))
{
Align_interface::do_side_processing (par, ax);
}
- return 0.0;
+ return gh_double2scm (0.0);
}
void
Align_interface::add_element (Score_element*me,Score_element* s)
{
- s->add_offset_callback (alignment_callback, Align_interface::axis (me));
+ s->add_offset_callback (Align_interface_alignment_callback_proc, Align_interface::axis (me));
Axis_group_interface::add_element (me, s);
}
--- /dev/null
+/*
+ arpeggio-engraver.cc -- implement Arpeggio_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+ */
+
+#include "engraver.hh"
+#include "group-interface.hh"
+#include "item.hh"
+#include "arpeggio.hh"
+#include "stem.hh"
+
+class Arpeggio_engraver : public Engraver
+{
+public:
+ VIRTUAL_COPY_CONS (Translator);
+ Arpeggio_engraver ();
+
+protected:
+ virtual void acknowledge_element (Score_element_info);
+ virtual void process_acknowledged ();
+ virtual void do_pre_move_processing ();
+
+private:
+ Item* arpeggio_;
+ Link_array <Score_element> stems_;
+};
+
+Arpeggio_engraver::Arpeggio_engraver ()
+{
+ arpeggio_ = 0;
+}
+
+void
+Arpeggio_engraver::acknowledge_element (Score_element_info info)
+{
+ if (Stem::has_interface (info.elem_l_))
+ {
+ stems_.push (info.elem_l_);
+ }
+}
+
+void
+Arpeggio_engraver::process_acknowledged ()
+{
+ if (!arpeggio_ && !stems_.empty ())
+ {
+ arpeggio_ = new Item (get_property ("basicArpeggioProperties"));
+ Pointer_group_interface pgi (arpeggio_, "stems");
+ for (int i = 0; i < stems_.size (); i++)
+ {
+ pgi.add_element (stems_[i]);
+ arpeggio_->add_dependency (stems_[i]);
+ }
+ announce_element (arpeggio_, 0);
+ }
+}
+
+void
+Arpeggio_engraver::do_pre_move_processing ()
+{
+ if (arpeggio_)
+ {
+ typeset_element (arpeggio_);
+ arpeggio_ = 0;
+ }
+ stems_.clear ();
+}
+
+
+ADD_THIS_TRANSLATOR (Arpeggio_engraver);
+
--- /dev/null
+/*
+ arpegggio.cc -- implement Arpeggio
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+ */
+
+#include "molecule.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+#include "arpeggio.hh"
+#include "score-element.hh"
+#include "stem.hh"
+#include "staff-symbol-referencer.hh"
+
+bool
+Arpeggio::has_interface (Score_element* me)
+{
+ return me && me->has_interface (ly_symbol2scm ("arpeggio-interface"));
+}
+
+MAKE_SCHEME_CALLBACK (Arpeggio, brew_molecule, 1);
+SCM
+Arpeggio::brew_molecule (SCM smob)
+{
+ Score_element *me = unsmob_element (smob);
+
+ Interval iv;
+ for (SCM s = me->get_elt_property ("stems"); gh_pair_p (s); s = gh_cdr (s))
+ {
+ Score_element *stem = unsmob_element (gh_car (s));
+ iv.unite (Stem::head_positions (stem));
+ }
+
+ Molecule mol;
+ Molecule dot = me->paper_l ()->lookup_l (0)->afm_find ("dots-dot");
+ Real half_space = Staff_symbol_referencer::staff_space (me) / 2;
+ for (Real i = iv[MIN]; i <= iv[MAX]; i++)
+ {
+ Molecule d (dot);
+ d.translate_axis (i * half_space, Y_AXIS);
+ mol.add_molecule (d);
+ }
+ mol.translate (Offset (-3, 0));
+
+ return mol.create_scheme ();
+}
+
+
#include "item.hh"
#include "staff-symbol-referencer.hh"
-MAKE_SCHEME_CALLBACK(Bar,brew_molecule);
+MAKE_SCHEME_CALLBACK(Bar,brew_molecule,1);
SCM
Bar::brew_molecule (SCM smob)
return me->lookup_l ()->filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
}
-MAKE_SCHEME_CALLBACK(Bar,before_line_breaking );
+MAKE_SCHEME_CALLBACK(Bar,before_line_breaking ,1);
SCM
Bar::before_line_breaking (SCM smob)
}
-MAKE_SCHEME_CALLBACK(Bar,get_staff_bar_size);
+MAKE_SCHEME_CALLBACK(Bar,get_staff_bar_size,1);
SCM
Bar::get_staff_bar_size (SCM smob)
{
{
if (Rest::has_interface (info.elem_l_))
{
- info.elem_l_->add_offset_callback (Beam::rest_collision_callback, Y_AXIS);
+ info.elem_l_->add_offset_callback (Beam_rest_collision_callback_proc, Y_AXIS);
}
else if (Stem::has_interface (info.elem_l_))
{
[Alternatively, stems could set its own directions, according to
their beam, during 'final-pre-processing'.]
*/
-MAKE_SCHEME_CALLBACK(Beam,before_line_breaking);
+MAKE_SCHEME_CALLBACK(Beam,before_line_breaking,1);
SCM
Beam::before_line_breaking (SCM smob)
{
Set elt properties height and y-position if not set.
Adjust stem lengths to reach beam.
*/
-MAKE_SCHEME_CALLBACK(Beam,after_line_breaking);
+MAKE_SCHEME_CALLBACK(Beam,after_line_breaking,1);
SCM
Beam::after_line_breaking (SCM smob)
{
return leftbeams;
}
-MAKE_SCHEME_CALLBACK(Beam,brew_molecule);
+MAKE_SCHEME_CALLBACK(Beam,brew_molecule,1);
SCM
Beam::brew_molecule (SCM smob)
{
rest -> stem -> beam -> interpolate_y_position ()
*/
-Real
-Beam::rest_collision_callback (Score_element *rest, Axis a )
+MAKE_SCHEME_CALLBACK(Beam,rest_collision_callback,1);
+SCM
+Beam::rest_collision_callback (SCM element_smob, SCM axis)
{
+ Score_element *rest = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
+
assert (a == Y_AXIS);
Score_element * st = unsmob_element (rest->get_elt_property ("stem"));
Score_element * stem = st;
if (!stem)
- return 0.0;
+ return gh_double2scm (0.0);
Score_element * beam = unsmob_element (stem->get_elt_property ("beam"));
if (!beam || !Beam::has_interface (beam) || !Beam::visible_stem_count (beam))
- return 0.0;
+ return gh_double2scm (0.0);
// make callback for rest from this.
Real beam_dy = 0;
#include "group-interface.hh"
#include "align-interface.hh"
-MAKE_SCHEME_CALLBACK(Break_align_interface,before_line_breaking);
+MAKE_SCHEME_CALLBACK(Break_align_interface,before_line_breaking,1);
SCM
Break_align_interface::before_line_breaking (SCM smob)
do_alignment (me);
return SCM_UNSPECIFIED;
}
+MAKE_SCHEME_CALLBACK(Break_align_interface,alignment_callback,2);
-Real
-Break_align_interface::alignment_callback (Score_element*c, Axis a)
+SCM
+Break_align_interface::alignment_callback (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
+
assert (a == X_AXIS);
- Score_element *par = c->parent_l (a);
+ Score_element *par = me->parent_l (a);
if (par && !to_boolean (par->get_elt_property ("break-alignment-done")))\
{
par->set_elt_property ("break-alignment-done", SCM_BOOL_T);
Break_align_interface::do_alignment (par);
}
- return 0.0;
+ return gh_double2scm (0);
}
-Real
-Break_align_interface::self_align_callback (Score_element *me, Axis a)
+MAKE_SCHEME_CALLBACK(Break_align_interface,self_align_callback,2);
+SCM
+Break_align_interface::self_align_callback (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
assert (a == X_AXIS);
Item* item = dynamic_cast<Item*> (me);
me->set_elt_property ("self-alignment-X", gh_int2scm (RIGHT));
}
- return Side_position::aligned_on_self (me, a);
+ return Side_position::aligned_on_self (element_smob, axis);
}
void
Break_align_interface::add_element (Score_element*me, Score_element *toadd)
{
- toadd->add_offset_callback (alignment_callback, X_AXIS);
+ toadd->add_offset_callback (Break_align_interface_alignment_callback_proc, X_AXIS);
Axis_group_interface::add_element (me, toadd);
}
Align_interface::set_interface (me);
Align_interface::set_axis (me,X_AXIS);
- me->add_offset_callback (Break_align_interface::self_align_callback, X_AXIS);
+ me->add_offset_callback (Break_align_interface_self_align_callback_proc, X_AXIS);
}
-MAKE_SCHEME_CALLBACK(Breathing_sign,brew_molecule);
+MAKE_SCHEME_CALLBACK(Breathing_sign,brew_molecule,1);
SCM
Breathing_sign::brew_molecule (SCM smob)
return me->lookup_l()->filledbox(b).create_scheme ();
}
-Real
-Breathing_sign::offset_callback (Score_element * b, Axis a)
+MAKE_SCHEME_CALLBACK(Breathing_sign,offset_callback,2);
+SCM
+Breathing_sign::offset_callback (SCM element_smob, SCM axis)
{
- Score_element * me = (Score_element*)b;
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
+
- Direction d = Directional_element_interface::get (b);
+ Direction d = Directional_element_interface::get (me);
if (!d)
{
d = UP;
Real inter_f = Staff_symbol_referencer::staff_space (me)/2;
int sz = Staff_symbol_referencer::line_count (me)-1;
- return inter_f * sz * d;
+ return gh_double2scm ( inter_f * sz * d);
}
void
Breathing_sign::set_interface (Score_element *b)
{
Staff_symbol_referencer::set_interface (b);
- b->add_offset_callback (Breathing_sign::offset_callback,Y_AXIS);
+ b->add_offset_callback (Breathing_sign_offset_callback_proc,Y_AXIS);
}
"text"
("text" . property-alist)
*/
-
Molecule
Chord_name::ly_word2molecule (Score_element * me, SCM word, Real* x)
{
return mol;
}
-MAKE_SCHEME_CALLBACK (Chord_name, after_line_breaking);
+MAKE_SCHEME_CALLBACK (Chord_name,after_line_breaking,1);
SCM
Chord_name::after_line_breaking (SCM smob)
{
return SCM_UNSPECIFIED;
}
-MAKE_SCHEME_CALLBACK (Chord_name, brew_molecule);
+MAKE_SCHEME_CALLBACK (Chord_name,brew_molecule,1);
SCM
Chord_name::brew_molecule (SCM smob)
{
SCM pitches = me->get_elt_property ("pitches");
SCM func = me->get_elt_property (ly_symbol2scm ("chord-name-function"));
- SCM text = gh_call3 (func, style, ly_quote_scm (pitches), ly_quote_scm (gh_cons (inversion, bass)));
+ SCM text = gh_call3 (func, style, pitches, gh_cons (inversion, bass));
return ly_text2molecule (me, text).create_scheme ();
}
}
s->set_elt_property ("direction", d);
- if (Rhythmic_req* r = dynamic_cast <Rhythmic_req *> (info.req_l_))
+ if (dynamic_cast <Rhythmic_req *> (info.req_l_))
{
Beam::add_stem (beam_p_, s);
- Moment stem_location = now_mom () -
- start_mom_ + beam_start_location_;
}
else
{
g->set_parent (clef_p_, Y_AXIS);
g->set_parent (clef_p_, X_AXIS);
- g->add_offset_callback (Side_position::aligned_on_self, X_AXIS);
- g->add_offset_callback (Side_position::centered_on_parent, X_AXIS);
+ g->add_offset_callback (Side_position_aligned_on_self_proc, X_AXIS);
+ g->add_offset_callback (Side_position_centered_on_parent_proc, X_AXIS);
g->set_elt_property ("direction", gh_int2scm (octave_dir_));
octavate_p_ = g;
announce_element (octavate_p_, clef_req_l_);
FIXME: should use symbol for #'style.
*/
-MAKE_SCHEME_CALLBACK(Clef,before_line_breaking);
+MAKE_SCHEME_CALLBACK(Clef,before_line_breaking,1);
SCM
Clef::before_line_breaking (SCM smob)
{
#include "axis-group-interface.hh"
#include "item.hh"
-void
-Collision::add_column (Score_element*me,Score_element* ncol_l)
-{
- ncol_l->add_offset_callback (force_shift_callback, X_AXIS);
- Axis_group_interface::add_element (me, ncol_l);
- me->add_dependency (ncol_l);
-}
-Real
-Collision::force_shift_callback (Score_element * c, Axis a)
+MAKE_SCHEME_CALLBACK(Collision,force_shift_callback,2);
+SCM
+Collision::force_shift_callback (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
assert (a == X_AXIS);
- Score_element * me = c->parent_l (a);
+ me = me->parent_l (a);
/*
ugh. the way DONE is done is not clean
*/
do_shifts (me);
}
- return 0.0;
+ return gh_double2scm (0.0);
}
/*
+
+void
+Collision::add_column (Score_element*me,Score_element* ncol_l)
+{
+ ncol_l->add_offset_callback (Collision_force_shift_callback_proc, X_AXIS);
+ Axis_group_interface::add_element (me, ncol_l);
+ me->add_dependency (ncol_l);
+}
-MAKE_SCHEME_CALLBACK(Crescendo,brew_molecule);
+MAKE_SCHEME_CALLBACK(Crescendo,brew_molecule,1);
/*
init();
extent_callback_l_ = d.extent_callback_l_;
offset_ = d.offset_;
- off_callbacks_ = d.off_callbacks_;
+ offset_callbacks_ = d.offset_callbacks_;
+ offsets_left_ = d.offsets_left_;
parent_l_ = d.parent_l_;
}
Dimension_cache::init()
{
extent_callback_l_ =0;
- offset_ =0.0;
+ offsets_left_ = 0;
+ offset_callbacks_ = SCM_EOL;
offset_ =0.0;
dim_.set_empty ();
-void
-Dot_column::add_head (Score_element * me, Score_element *rh)
-{
- Score_element * d = unsmob_element (rh->get_elt_property ("dot"));
- if (d)
- {
- Side_position::add_support (me,rh);
-
- Pointer_group_interface gi (me, "dots");
- gi.add_element (d);
-
- d->add_offset_callback (force_shift_callback , Y_AXIS);
- Axis_group_interface::add_element (me, d);
- }
-}
-
-
void
*/
-Real
-Dot_column::force_shift_callback (Score_element * dot, Axis a)
+MAKE_SCHEME_CALLBACK(Dot_column,force_shift_callback,2);
+SCM
+Dot_column::force_shift_callback (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
assert (a == Y_AXIS);
- Score_element * me = dot->parent_l (X_AXIS);
+ me = me->parent_l (X_AXIS);
SCM dots = me->get_elt_property ("dots");
do_shifts (dots);
- return 0.0;
+ return gh_double2scm (0.0);
}
SCM
{
return m && m->has_interface (ly_symbol2scm ("dot-column-interface"));
}
+
+
+void
+Dot_column::add_head (Score_element * me, Score_element *rh)
+{
+ Score_element * d = unsmob_element (rh->get_elt_property ("dot"));
+ if (d)
+ {
+ Side_position::add_support (me,rh);
+
+ Pointer_group_interface gi (me, "dots");
+ gi.add_element (d);
+
+ d->add_offset_callback (Dot_column_force_shift_callback_proc , Y_AXIS);
+ Axis_group_interface::add_element (me, d);
+ }
+}
+
#include "directional-element-interface.hh"
-Real
-Dots::quantised_position_callback (Score_element * me, Axis a)
+MAKE_SCHEME_CALLBACK(Dots,quantised_position_callback,2);
+SCM
+Dots::quantised_position_callback (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
assert (a == Y_AXIS);
SCM d= me->get_elt_property ("dot-count");
Directional_element_interface::set (me, UP);
if (Staff_symbol_referencer::on_staffline (me))
- return Staff_symbol_referencer::staff_space (me) / 2.0 * Directional_element_interface::get (me);
+ return gh_double2scm (Staff_symbol_referencer::staff_space (me) / 2.0 * Directional_element_interface::get (me));
}
- return 0.0;
+ return gh_double2scm (0.0);
}
-MAKE_SCHEME_CALLBACK(Dots,brew_molecule);
+MAKE_SCHEME_CALLBACK(Dots,brew_molecule,1);
SCM
Dots::brew_molecule (SCM d)
{
Axis_group_interface::add_element (line_spanner_, text_p_);
- text_p_->add_offset_callback (Side_position::aligned_on_self,
+ text_p_->add_offset_callback (Side_position_aligned_on_self_proc,
Y_AXIS);
announce_element (text_p_, text_req_l_);
}
Axis_group_interface::add_element (line_spanner_, cresc_p_);
cresc_p_->set_elt_property ("self-alignment-Y", gh_int2scm (0));
cresc_p_->add_offset_callback
- (Side_position::aligned_on_self, Y_AXIS);
+ (Side_position_aligned_on_self_proc, Y_AXIS);
announce_element (cresc_p_, accepted_spanreqs_drul_[START]);
}
}
#include "paper-column.hh"
#include "paper-def.hh"
-MAKE_SCHEME_CALLBACK(Grace_align_item,before_line_breaking);
+MAKE_SCHEME_CALLBACK(Grace_align_item,before_line_breaking,1);
SCM
Grace_align_item::before_line_breaking (SCM smob)
{
#include "debug.hh"
#include "item.hh"
-void
-Hara_kiri_group_spanner::set_interface (Score_element*me)
-{
- me->add_offset_callback (force_hara_kiri_callback, Y_AXIS);
- me->set_interface (ly_symbol2scm ("hara-kiri-spanner-interface"));
- me->set_extent_callback (Hara_kiri_group_spanner::y_extent, Y_AXIS);
-}
Interval
Hara_kiri_group_spanner::y_extent(Score_element*me, Axis a)
We can't rely on offsets and dimensions of elements in a hara-kiri
group. Use a callback to make sure that hara-kiri has been done
before asking for offsets. */
-Real
-Hara_kiri_group_spanner::force_hara_kiri_callback (Score_element *elt, Axis a)
+MAKE_SCHEME_CALLBACK(Hara_kiri_group_spanner,force_hara_kiri_callback,2);
+SCM
+Hara_kiri_group_spanner::force_hara_kiri_callback (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
assert (a == Y_AXIS);
- consider_suicide (elt);
- return 0.0;
+ consider_suicide (me);
+ return gh_double2scm (0.0);
}
-Real
-Hara_kiri_group_spanner::force_hara_kiri_in_parent_callback (Score_element*daughter, Axis a)
+MAKE_SCHEME_CALLBACK(Hara_kiri_group_spanner,force_hara_kiri_in_parent_callback,2);
+SCM
+Hara_kiri_group_spanner::force_hara_kiri_in_parent_callback (SCM element_smob, SCM axis)
{
+ Score_element *daughter = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
assert (a == Y_AXIS);
- force_hara_kiri_callback (daughter->parent_l (a), Y_AXIS);
- return 0.0;
+ force_hara_kiri_callback (daughter->parent_l (a)->self_scm (), Y_AXIS);
+ return gh_double2scm ( 0.0);
}
void
// e->add_offset_callback (force_hara_kiri_in_parent_callback, Y_AXIS);
Axis_group_interface::add_element (me, e);
}
+
+
+void
+Hara_kiri_group_spanner::set_interface (Score_element*me)
+{
+ me->add_offset_callback (Hara_kiri_group_spanner_force_hara_kiri_callback_proc, Y_AXIS);
+ me->set_interface (ly_symbol2scm ("hara-kiri-spanner-interface"));
+ me->set_extent_callback (Hara_kiri_group_spanner::y_extent, Y_AXIS);
+}
#include "spanner.hh"
#include "item.hh"
-MAKE_SCHEME_CALLBACK(Hyphen_spanner,brew_molecule)
+MAKE_SCHEME_CALLBACK(Hyphen_spanner,brew_molecule,1)
SCM
Hyphen_spanner::brew_molecule (SCM smob)
#include "axes.hh"
#include "lily-proto.hh"
+#include "lily-guile.hh"
+extern SCM Align_interface_alignment_callback_proc;
/*
Order elements top to bottom/left to right/right to left etc.
*/
struct Align_interface {
- static Real alignment_callback (Score_element *,Axis);
+ static SCM alignment_callback (SCM element, SCM axis);
static void do_side_processing (Score_element*,Axis a);
static void set_axis (Score_element*,Axis);
static Axis axis (Score_element*) ;
static int get_count (Score_element*,Score_element*);
static void set_interface (Score_element*);
static bool has_interface (Score_element*);
- static Real center_on_element (Score_element *c, Axis);
+ static SCM center_on_element (SCM element, SCM axis);
};
#endif /* ALIGN_INTERFACE_HH */
--- /dev/null
+/*
+ arpegio.hh -- declare Arpeggio
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef ARPEGGIO_HH
+#define ARPEGGIO_HH
+
+#include "lily-guile.hh"
+#include "lily-proto.hh"
+
+class Arpeggio
+{
+public:
+ static SCM brew_molecule (SCM);
+ static bool has_interface (Score_element*);
+};
+
+#endif /* ARPEGGIO_HH */
+
#include "lily-guile.hh"
+extern SCM Beam_rest_collision_callback_proc;
/** a beam connects multiple stems.
Beam adjusts the stems its owns to make sure that they reach the
static Item* last_visible_stem (Score_element*);
static bool has_interface (Score_element*);
static void set_interface (Score_element*);
- static Real rest_collision_callback (Score_element *,Axis);
+ static SCM rest_collision_callback (SCM element, SCM axis);
Beam (SCM);
static void add_stem (Score_element*,Score_element*);
static void set_beaming (Score_element*,Beaming_info_list *);
#define BREAK_ALIGN_ITEM_HH
#include "item.hh"
-
+extern SCM Break_align_interface_alignment_callback_proc;
/**
align breakable items (clef, bar, etc.)
static void set_interface (Score_element*);
static bool has_interface (Score_element*);
static void add_element (Score_element*me, Score_element*add);
- static Real alignment_callback (Score_element*, Axis);
- static Real self_align_callback (Score_element*, Axis);
+ static SCM alignment_callback (SCM element, SCM axis);
+ static SCM self_align_callback (SCM element, SCM axis);
};
#endif // BREAK_ALIGN_ITEM_HH
{
public:
static SCM brew_molecule (SCM);
- static Real offset_callback (Score_element *, Axis);
+ static SCM offset_callback (SCM element, SCM axis);
static void set_interface (Score_element*);
static bool has_interface (Score_element*);
};
public:
static SCM automatic_shift (Score_element*);
static SCM forced_shift (Score_element*);
- static Real force_shift_callback (Score_element *, Axis);
+ static SCM force_shift_callback (SCM element, SCM axis);
static void do_shifts (Score_element*);
static void add_column (Score_element*me,Score_element*ncol_l);
};
#include "lily-proto.hh"
#include "parray.hh"
#include "dimension-cache-callback.hh"
+#include "lily-guile.hh"
/**
- Adminstration of offset dimension info.
- */
+ Adminstration of offset dimension info.
+
+ TODO: use SCM for callbacks, and let them be set as basic
+ properties.
+*/
struct Dimension_cache
{
- bool valid_b_;
Interval dim_;
/**
The offset wrt. to the center of #parent_l_#
*/
Real offset_;
-
-
+ SCM offset_callbacks_;
- Array<Offset_callback> off_callbacks_;
+ bool valid_b_;
+ char offsets_left_;
/**
What to call to find extent. Nil means empty.
static void add_head (Score_element * dotcol, Score_element* rh );
static void set_interface (Score_element*);
static bool has_interface (Score_element*);
- static Real force_shift_callback (Score_element * , Axis);
+ static SCM force_shift_callback (SCM,SCM);
static SCM do_shifts (SCM dotlist);
};
#endif // DOT_COLUMN_HH
#include "lily-proto.hh"
#include "lily-guile.hh"
+extern SCM Dots_quantised_position_callback_proc;
/**
The dots to go with a notehead/rest. A separate class, since they
class Dots // interface
{
public:
- static Real quantised_position_callback(Score_element*, Axis);
+ static SCM quantised_position_callback (SCM element, SCM axis);
static SCM brew_molecule (SCM);
};
class Hara_kiri_group_spanner
{
public:
- static Real force_hara_kiri_callback (Score_element * , Axis);
+ static SCM force_hara_kiri_callback (SCM,SCM);
static Interval y_extent (Score_element * , Axis);
- static Real force_hara_kiri_in_parent_callback (Score_element * , Axis);
+ static SCM force_hara_kiri_in_parent_callback(SCM,SCM);
static void add_element (Score_element *me, Score_element *e);
static void set_interface (Score_element*me);
static bool has_interface (Score_element*);
typedef SCM(*Scheme_function_unknown)();
#if __GNUC_MINOR__ >= 96
-typedef SCM(*Scheme_function_1)(SCM);
+typedef SCM(*Scheme_function_1)(SCM);
+typedef SCM(*Scheme_function_2)(SCM,SCM);
#else
typedef SCM(*Scheme_function_1)(...);
+typedef SCM(*Scheme_function_2)(...);
#endif
-#define MAKE_SCHEME_CALLBACK(TYPE, FUNC) \
-static SCM TYPE ## _ ## FUNC ## _proc;\
+#define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGS) \
+SCM TYPE ## _ ## FUNC ## _proc;\
void \
TYPE ## _ ## FUNC ## _init_functions () \
{ \
- TYPE ## _ ## FUNC ## _proc = gh_new_procedure1_0 (#TYPE "::" #FUNC, \
- ((Scheme_function_1)TYPE :: FUNC)); \
+ TYPE ## _ ## FUNC ## _proc = gh_new_procedure ## ARGS ## _0 (#TYPE "::" #FUNC, \
+ ((Scheme_function_ ## ARGS)TYPE :: FUNC)); \
} \
\
ADD_SCM_INIT_FUNC(TYPE ## _ ## FUNC ## _callback, TYPE ## _ ## FUNC ## _init_functions); \
right aligning end of phrases, centering others under their notes.
*/
-
/*
* Build an engraver that catches noteheads and lyrics.
*/
class Repeated_music : public Music
{
- Music * repeat_body_p_;
- Music_sequence * alternatives_p_;
public:
-
Music * body () const;
Music_sequence * alternatives () const;
String type_;
#include "lily-guile.hh"
+extern SCM Rest_collision_force_shift_callback_proc;
/*
Move rests in note-columns so that they do not collide.
static void add_column (Score_element*me,Score_element*);
static void set_interface (Score_element*me);
static bool has_interface (Score_element*);
- static Real force_shift_callback (Score_element *, Axis);
+ static SCM force_shift_callback (SCM element, SCM axis);
static SCM do_shift (Score_element*,SCM);
};
#endif // REST_COLLISION_HH
Score_element*common_refpoint (SCM elt_list, Axis a) const;
// duh. slim down interface here. (todo)
- bool has_offset_callback_b (Offset_callback, Axis)const;
- void add_offset_callback (Offset_callback, Axis);
+ bool has_offset_callback_b (SCM callback, Axis)const;
+ void add_offset_callback (SCM callback, Axis);
+
bool has_extent_callback_b (Extent_callback, Axis)const;
bool has_extent_callback_b (Axis) const;
void set_extent_callback (Extent_callback , Axis);
#include "spanner.hh"
#include "item.hh"
+extern SCM Side_position_aligned_on_self_proc;
+extern SCM Side_position_centered_on_parent_proc;
+extern SCM Side_position_quantised_position_proc;
/**
Position victim object (ELT_L_) next to other objects (the support).
struct Side_position
{
public:
- static Real side_position (Score_element *, Axis);
- static Real aligned_on_self (Score_element *, Axis);
- static Real aligned_side (Score_element *, Axis);
- static Real quantised_position (Score_element *, Axis);
- static Real centered_on_parent (Score_element *, Axis);
+ static SCM side_position (SCM element, SCM axis);
+ static SCM aligned_on_self (SCM element, SCM axis);
+ static SCM aligned_side (SCM element, SCM axis);
+ static SCM quantised_position (SCM element, SCM axis);
+ static SCM centered_on_parent (SCM element, SCM axis);
static void set_axis (Score_element*,Axis);
static void set_minimum_space (Score_element*,Real);
static void set_padding (Score_element*,Real);
--- /dev/null
+/*
+ span-arpegio.hh -- declare Span_arpeggio
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef SPAN_ARPEGGIO_HH
+#define SPAN_ARPEGGIO_HH
+
+#include "lily-guile.hh"
+#include "lily-proto.hh"
+#include "interval.hh"
+
+class Span_arpeggio
+{
+public:
+ static SCM brew_molecule (SCM);
+ static bool has_interface (Score_element*);
+};
+
+#endif /* SPAN_ARPEGGIO_HH */
+
static Interval width_callback(Score_element *, Axis) ;
static SCM get_bar_size (SCM);
static SCM before_line_breaking (SCM);
- static Real center_on_spanned_callback (Score_element*,Axis);
+ static SCM center_on_spanned_callback (SCM element, SCM axis);
};
#endif // SPAN_BAR_HH
static void set_interface (Score_element*);
static bool has_interface (Score_element*);
static void set_position (Score_element*,Real);
- static Real callback (Score_element *, Axis a);
+ static SCM callback (SCM element, SCM axis);
/**
Leading are the lead strips between the sticks (lines) of
static Real get_default_stem_end_position (Score_element*me) ;
static void position_noteheads(Score_element*);
static Real stem_end_position (Score_element*) ;
- static Real off_callback (Score_element *, Axis);
+ static SCM off_callback (SCM element, SCM axis);
static Molecule flag (Score_element*);
static SCM before_line_breaking (SCM);
static Interval dim_callback (Score_element *,Axis);
*/
virtual void do_add_processing ();
virtual bool do_try_music (Music *req_l);
-
virtual void do_pre_move_processing();
virtual void do_post_move_processing();
virtual void do_process_music () ;
{
if (text_)
{
- text_->add_offset_callback (Side_position::centered_on_parent,
+ text_->add_offset_callback (Side_position_centered_on_parent_proc,
Y_AXIS);
typeset_element (text_);
TODO
- space the `natural' signs wider
*/
-MAKE_SCHEME_CALLBACK(Key_item,brew_molecule);
+MAKE_SCHEME_CALLBACK(Key_item,brew_molecule,1);
SCM
Key_item::brew_molecule (SCM smob)
{
accidental placement is more complicated than this.
*/
-MAKE_SCHEME_CALLBACK(Local_key_item,brew_molecule);
+MAKE_SCHEME_CALLBACK(Local_key_item,brew_molecule,1);
SCM
Local_key_item::brew_molecule (SCM smob)
{
// ly_str02scm ((req_l_->text_str_ + " ").ch_C ()));
ly_str02scm ((req_l_->text_str_).ch_C ()));
- text_p_->add_offset_callback (&Side_position::aligned_on_self,X_AXIS);
+ text_p_->add_offset_callback (Side_position_aligned_on_self_proc,X_AXIS);
/*
We can't reach the notehead where we're centered from here. So
we kludge.
#include "lyric-extender.hh"
-MAKE_SCHEME_CALLBACK(Lyric_extender,brew_molecule)
+MAKE_SCHEME_CALLBACK(Lyric_extender,brew_molecule,1)
SCM
Lyric_extender::brew_molecule (SCM smob)
{
ADD_THIS_TRANSLATOR (Lyric_phrasing_engraver);
+/*
+ TODO: this code is too hairy, and does things that should be in the
+ backend. Fixme.
+*/
+
+
/*
We find start and end of phrases, and align lyrics accordingly.
Also, lyrics at start of melismata should be left aligned.
// ((current . oldflag) . previous)
if(!to_boolean(gh_cdar(v_entry))) { // not an old entry left over from a prior note ...
Syllable_group *entry = unsmob_voice_entry(gh_caar(v_entry));
+
+ /*
+ TODO: give context for warning.
+ */
if(! entry->set_lyric_align(punc.ch_C(), any_notehead_l_))
warning (_ ("lyrics found without any matching notehead"));
[TODO] 17
* variable-sized multi-measure rest symbol: |====| ??
*/
-MAKE_SCHEME_CALLBACK(Multi_measure_rest,brew_molecule);
+MAKE_SCHEME_CALLBACK(Multi_measure_rest,brew_molecule,1);
SCM
Multi_measure_rest::brew_molecule (SCM smob)
{
}
-MAKE_SCHEME_CALLBACK (Multi_measure_rest, set_spacing_rods);
+MAKE_SCHEME_CALLBACK (Multi_measure_rest, set_spacing_rods,1);
SCM
Multi_measure_rest::set_spacing_rods (SCM smob)
}
-MAKE_SCHEME_CALLBACK(Note_head,brew_molecule);
+MAKE_SCHEME_CALLBACK(Note_head,brew_molecule,1);
SCM
Note_head::brew_molecule (SCM smob)
return true;
}
- else if (Tonic_req* t = dynamic_cast<Tonic_req*> (m))
+ else if ( dynamic_cast<Tonic_req*> (m))
{
return true;
}
- else if (Inversion_req* i = dynamic_cast<Inversion_req*> (m))
+ else if ( dynamic_cast<Inversion_req*> (m))
{
return true;
}
- else if (Bass_req* b = dynamic_cast<Bass_req*> (m))
+ else if (dynamic_cast<Bass_req*> (m))
{
return true;
}
d->set_elt_property ("dot-count", gh_int2scm (note_req_l->duration_.dots_i_));
d->set_parent (note_p, Y_AXIS);
- d->add_offset_callback (Dots::quantised_position_callback, Y_AXIS);
+ d->add_offset_callback (Dots_quantised_position_callback_proc, Y_AXIS);
announce_element (d,0);
dot_p_arr_.push (d);
}
Side_position::set_axis (p->item_p_,Y_AXIS);
// todo: init with basic props.
- p->item_p_->add_offset_callback (Side_position::aligned_on_self, X_AXIS);
- p->item_p_->add_offset_callback (Side_position::centered_on_parent, X_AXIS);
+ p->item_p_->add_offset_callback (Side_position_aligned_on_self_proc, X_AXIS);
+ p->item_p_->add_offset_callback (Side_position_centered_on_parent_proc, X_AXIS);
announce_element (p->item_p_,
p->req_l_drul_[START]
? p->req_l_drul_[START]
#include "staff-symbol-referencer.hh"
#include "duration.hh"
-Real
-Rest_collision::force_shift_callback (Score_element *them, Axis a)
+MAKE_SCHEME_CALLBACK(Rest_collision,force_shift_callback,2);
+SCM
+Rest_collision::force_shift_callback (SCM element_smob, SCM axis)
{
+ Score_element *them = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
assert (a == Y_AXIS);
Score_element * rc = unsmob_element (them->get_elt_property ("rest-collision"));
do_shift (rc, elts);
}
- return 0.0;
+ return gh_double2scm (0.0);
}
void
Pointer_group_interface gi (me);
gi.add_element (p);
- p->add_offset_callback (&Rest_collision::force_shift_callback, Y_AXIS);
+ p->add_offset_callback (Rest_collision_force_shift_callback_proc, Y_AXIS);
p->set_elt_property ("rest-collision", me->self_scm ());
}
Staff_symbol_referencer::set_interface (dot_p_);
Rhythmic_head::set_dots (rest_p_, dot_p_);
dot_p_->set_parent (rest_p_, Y_AXIS);
- dot_p_->add_offset_callback (Dots::quantised_position_callback, Y_AXIS);
+ dot_p_->add_offset_callback (Dots_quantised_position_callback_proc, Y_AXIS);
dot_p_->set_elt_property ("dot-count",
gh_int2scm (rest_req_l_->duration_.dots_i_));
announce_element (dot_p_,0);
#include "staff-symbol-referencer.hh"
// -> offset callback
-MAKE_SCHEME_CALLBACK(Rest,after_line_breaking);
+MAKE_SCHEME_CALLBACK(Rest,after_line_breaking,1);
SCM
Rest::after_line_breaking (SCM smob)
{
}
-MAKE_SCHEME_CALLBACK(Rest,brew_molecule)
+MAKE_SCHEME_CALLBACK(Rest,brew_molecule,1)
SCM
Rest::brew_molecule (SCM smob)
{
mutable_property_alist_ = SCM_EOL;
smobify_self ();
+
+ dim_cache_[X_AXIS].offset_callbacks_
+ = get_elt_property ("X-offset-callbacks");
+ dim_cache_[Y_AXIS].offset_callbacks_
+ = get_elt_property ("Y-offset-callbacks");
+
+ dim_cache_[X_AXIS].offsets_left_ = scm_ilength (dim_cache_[X_AXIS].offset_callbacks_);
+ dim_cache_[Y_AXIS].offsets_left_ = scm_ilength (dim_cache_[Y_AXIS].offset_callbacks_);
}
}
-MAKE_SCHEME_CALLBACK(Score_element,brew_molecule)
+MAKE_SCHEME_CALLBACK(Score_element,brew_molecule,1)
/*
ugh.
for (int a= X_AXIS; a <= Y_AXIS; a++)
{
- dim_cache_[a].off_callbacks_.clear ();
+ dim_cache_[a].offset_callbacks_ = SCM_EOL;
+ dim_cache_[a].offsets_left_ = 0;
}
}
Score_element::get_offset (Axis a) const
{
Score_element *me = (Score_element*) this;
- while (dim_cache_[a].off_callbacks_.size ())
+ while (dim_cache_[a].offsets_left_)
{
- Offset_callback c = dim_cache_[a].off_callbacks_[0];
- me->dim_cache_[a].off_callbacks_.del (0);
- Real r = (*c) (me,a );
+ int l = --me->dim_cache_[a].offsets_left_;
+ SCM cb = scm_list_ref (dim_cache_[a].offset_callbacks_, gh_int2scm (l));
+ SCM retval = gh_call2 (cb, self_scm (), gh_int2scm (a));
+
+ Real r = gh_scm2double (retval);
if (isinf (r) || isnan (r))
{
programming_error (INFINITY_MSG);
}
void
-Score_element::add_offset_callback (Offset_callback cb, Axis a)
+Score_element::add_offset_callback (SCM cb, Axis a)
{
- dim_cache_[a].off_callbacks_.push (cb);
+ dim_cache_[a].offset_callbacks_ = gh_cons (cb, dim_cache_[a].offset_callbacks_ );
+ dim_cache_[a].offsets_left_ ++;
}
bool
}
bool
-Score_element::has_offset_callback_b (Offset_callback cb, Axis a)const
+Score_element::has_offset_callback_b (SCM cb, Axis a)const
{
- for (int i= dim_cache_[a].off_callbacks_.size (); i--;)
- {
- if (dim_cache_[a].off_callbacks_[i] == cb)
- return true;
- }
- return false;
+ return scm_memq (cb, dim_cache_[a].offset_callbacks_) != SCM_BOOL_F;
}
void
dim_cache_[a].parent_l_ = g;
}
-MAKE_SCHEME_CALLBACK(Score_element,fixup_refpoint);
+MAKE_SCHEME_CALLBACK(Score_element,fixup_refpoint,1);
SCM
Score_element::fixup_refpoint (SCM smob)
{
Score_element * s = (Score_element*) SCM_CELL_WORD_1(ses);
scm_gc_mark (s->immutable_property_alist_);
scm_gc_mark (s->mutable_property_alist_);
+ scm_gc_mark (s->dim_cache_[X_AXIS].offset_callbacks_);
+ scm_gc_mark (s->dim_cache_[Y_AXIS].offset_callbacks_);
if (s->parent_l (Y_AXIS))
scm_gc_mark (s->parent_l (Y_AXIS)->self_scm ());
return gh_scm2int (p1) - gh_scm2int (p2);
}
-MAKE_SCHEME_CALLBACK(Script_column,before_line_breaking);
+MAKE_SCHEME_CALLBACK(Script_column,before_line_breaking,1);
SCM
Script_column::before_line_breaking (SCM smob)
Score_element *p =new Item (get_property ("basicScriptProperties"));
Script::set_interface (p);
- p->add_offset_callback (Side_position::centered_on_parent, X_AXIS);
+ p->add_offset_callback (Side_position_centered_on_parent_proc, X_AXIS);
list = gh_cdr (list);
p->set_elt_property ("molecule",
p->set_elt_property ("staff-support", SCM_BOOL_T);
if (!xaxis && follow_staff)
- p->add_offset_callback (Side_position::quantised_position, Y_AXIS);
+ p->add_offset_callback (Side_position_quantised_position_proc, Y_AXIS);
p->set_elt_property ("script-priority", priority);
return Molecule ();
}
-MAKE_SCHEME_CALLBACK(Script,after_line_breaking);
+MAKE_SCHEME_CALLBACK(Script,after_line_breaking,1);
SCM
Script::after_line_breaking (SCM smob)
{
return SCM_UNSPECIFIED;
}
-MAKE_SCHEME_CALLBACK(Script,brew_molecule);
+MAKE_SCHEME_CALLBACK(Script,brew_molecule,1);
SCM
Script::brew_molecule (SCM smob)
rod.add_to_cols ();
}
-MAKE_SCHEME_CALLBACK(Separating_group_spanner,set_spacing_rods);
+MAKE_SCHEME_CALLBACK(Separating_group_spanner,set_spacing_rods,1);
SCM
Separating_group_spanner::set_spacing_rods (SCM smob)
{
Callback that does the aligning. Puts the element next to the support
*/
-Real
-Side_position::side_position (Score_element *cme, Axis axis)
+MAKE_SCHEME_CALLBACK(Side_position,side_position,2);
+SCM
+Side_position::side_position (SCM element_smob, SCM axis)
{
- Score_element* me = (Score_element*)cme;
- Score_element *common = me->parent_l (axis);
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
+
+ Score_element *common = me->parent_l (a);
SCM support = me->get_elt_property ("side-support-elements");
for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
Score_element * e = unsmob_element (gh_car (s));
if (e)
- common = common->common_refpoint (e, axis);
+ common = common->common_refpoint (e, a);
}
Interval dim;
Score_element * e = unsmob_element ( gh_car (s));
if (e)
{
- Real coord = e->relative_coordinate (common, axis);
+ Real coord = e->relative_coordinate (common, a);
- dim.unite (coord + e->extent (axis));
+ dim.unite (coord + e->extent (a));
}
}
Direction dir = Side_position::get_direction (me);
- Real off = me->parent_l (axis)->relative_coordinate (common, axis);
+ Real off = me->parent_l (a)->relative_coordinate (common, a);
SCM minimum = me->remove_elt_property ("minimum-space");
Real total_off = dim[dir] + off;
if (fabs (total_off) > 100 CM)
programming_error ("Huh ? Improbable staff side dim.");
- return total_off;
+ return gh_double2scm (total_off);
}
/**
callback that centers the element on itself
*/
-Real
-Side_position::aligned_on_self (Score_element *me, Axis ax)
+MAKE_SCHEME_CALLBACK(Side_position,aligned_on_self,2);
+SCM
+Side_position::aligned_on_self (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
String s ("self-alignment-");
- s += (ax == X_AXIS) ? "X" : "Y";
+ s += (a == X_AXIS) ? "X" : "Y";
SCM align (me->get_elt_property (s.ch_C()));
if (gh_number_p (align))
{
- Interval ext(me->extent (ax));
+ Interval ext(me->extent (a));
if (ext.empty_b ())
{
programming_error ("I'm empty. Can't align on self");
- return 0.0;
+ return gh_double2scm (0.0);
}
else
{
Real lambda = (0.5 - gh_scm2double (align) / 2.0);
- return - (lambda * ext[LEFT] + (1 - lambda) * ext[RIGHT]);
+ return gh_double2scm (- (lambda * ext[LEFT] + (1 - lambda) * ext[RIGHT]));
}
}
else if (unsmob_element (align))
{
- return - unsmob_element (align)->relative_coordinate (me, ax);
+ return gh_double2scm (- unsmob_element (align)->relative_coordinate (me, a));
}
- return 0.0;
+ return gh_double2scm (0.0);
}
Only rounds when we're inside the staff, as determined by
Staff_symbol_referencer::staff_radius() */
-Real
-Side_position::quantised_position (Score_element *me, Axis )
+MAKE_SCHEME_CALLBACK(Side_position,quantised_position,2);
+SCM
+Side_position::quantised_position (SCM element_smob, SCM )
{
+ Score_element *me = unsmob_element (element_smob);
+
+
Direction d = Side_position::get_direction (me);
if (Staff_symbol_referencer::has_interface (me))
rp += d;
}
- return (rp - p) * Staff_symbol_referencer::staff_space (me) / 2.0;
+ return gh_double2scm ((rp - p) * Staff_symbol_referencer::staff_space (me) / 2.0);
}
- return 0.0;
+ return gh_double2scm (0.0);
}
/*
Position next to support, taking into account my own dimensions and padding.
*/
-Real
-Side_position::aligned_side (Score_element *me, Axis ax)
+MAKE_SCHEME_CALLBACK(Side_position,aligned_side,2);
+SCM
+Side_position::aligned_side (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
- Direction d = Side_position ::get_direction (me);
- Real o = side_position (me,ax);
+ Direction d = Side_position::get_direction (me);
+ Real o = gh_scm2double (side_position (element_smob,axis));
- Interval iv = me->extent (ax);
+ Interval iv = me->extent (a);
if (!iv.empty_b ())
{
if (gh_number_p (pad))
o += d *gh_scm2double (pad) ;
}
- return o;
+ return gh_double2scm (o);
}
/*
Position centered on parent.
*/
-Real
-Side_position::centered_on_parent (Score_element * me, Axis a)
+MAKE_SCHEME_CALLBACK(Side_position,centered_on_parent,2);
+SCM
+Side_position::centered_on_parent (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
Score_element *him = me->parent_l (a);
- return him->extent (a).center ();
+ return gh_double2scm (him->extent (a).center ());
}
void
Side_position::set_axis (Score_element*me, Axis a)
{
- if (!me->has_offset_callback_b (aligned_side, a))
- me->add_offset_callback (aligned_side, a);
+ if (!me->has_offset_callback_b (Side_position_aligned_side_proc, a))
+ me->add_offset_callback (Side_position_aligned_side_proc, a);
}
-
+// ugh. doesn't cactch all variants.
Axis
Side_position::get_axis (Score_element*me)
{
- if (me->has_offset_callback_b (&side_position, X_AXIS)
- || me->has_offset_callback_b (&aligned_side , X_AXIS))
+ if (me->has_offset_callback_b (Side_position_aligned_side_proc, X_AXIS)
+ || me->has_offset_callback_b (Side_position_aligned_side_proc , X_AXIS))
return X_AXIS;
}
-MAKE_SCHEME_CALLBACK (Slur, after_line_breaking);
+MAKE_SCHEME_CALLBACK (Slur, after_line_breaking,1);
SCM
Slur::after_line_breaking (SCM smob)
{
}
-MAKE_SCHEME_CALLBACK(Slur,set_spacing_rods);
+MAKE_SCHEME_CALLBACK(Slur,set_spacing_rods,1);
SCM
Slur::set_spacing_rods (SCM smob)
{
/*
Ugh should have dash-length + dash-period
*/
-MAKE_SCHEME_CALLBACK (Slur, brew_molecule);
+MAKE_SCHEME_CALLBACK (Slur, brew_molecule,1);
SCM
Slur::brew_molecule (SCM smob)
{
}
-MAKE_SCHEME_CALLBACK(Spacing_spanner, set_springs);
+MAKE_SCHEME_CALLBACK(Spacing_spanner, set_springs,1);
SCM
Spacing_spanner::set_springs (SCM smob)
{
--- /dev/null
+/*
+ span-arpeggio-engraver.cc -- implement Span_arpeggio_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "engraver.hh"
+#include "item.hh"
+#include "arpeggio.hh"
+#include "span-arpeggio.hh"
+#include "group-interface.hh"
+
+
+/**
+
+ Make arpeggios that span multiple staffs. Catch arpeggios, and span a
+ Span_arpeggio over them if we find more than two arpeggios.
+ */
+class Span_arpeggio_engraver : public Engraver
+{
+public:
+ VIRTUAL_COPY_CONS (Translator);
+ Span_arpeggio_engraver ();
+
+protected:
+ virtual void acknowledge_element (Score_element_info);
+ virtual void process_acknowledged ();
+ virtual void do_pre_move_processing ();
+
+private:
+ Item *span_arpeggio_;
+ Link_array<Score_element> arpeggios_;
+};
+
+
+Span_arpeggio_engraver::Span_arpeggio_engraver ()
+{
+ span_arpeggio_ = 0;
+}
+
+void
+Span_arpeggio_engraver::acknowledge_element (Score_element_info info)
+{
+ int depth = info.origin_trans_l_arr (this).size ();
+ if (Arpeggio::has_interface (info.elem_l_))
+ //if (info.origin_trans_l_arr (this).size ()
+ // && Arpeggio::has_interface (info.elem_l_))
+ {
+ arpeggios_.push (info.elem_l_);
+ }
+}
+
+void
+Span_arpeggio_engraver::process_acknowledged ()
+{
+ if (arpeggios_.size () > 1 && !span_arpeggio_)
+ {
+ span_arpeggio_ = new Item (get_property ("basicSpanArpeggioProperties"));
+ Pointer_group_interface pgi (span_arpeggio_, "arpeggios");
+ for (int i = 0; i < arpeggios_.size () ; i++)
+ {
+ pgi.add_element (arpeggios_[i]);
+ span_arpeggio_->add_dependency (arpeggios_[i]);
+ }
+
+ span_arpeggio_->set_parent (arpeggios_[0], Y_AXIS);
+ span_arpeggio_->set_parent (arpeggios_[0], X_AXIS);
+
+ announce_element (span_arpeggio_, 0);
+ }
+}
+
+void
+Span_arpeggio_engraver::do_pre_move_processing ()
+{
+ if (span_arpeggio_)
+ {
+ typeset_element (span_arpeggio_);
+ span_arpeggio_ = 0;
+ }
+ arpeggios_.clear ();
+}
+
+ADD_THIS_TRANSLATOR (Span_arpeggio_engraver);
+
--- /dev/null
+/*
+ span-arpeggio.cc -- implement Span_arpeggio
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "axis-group-interface.hh"
+#include "molecule.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+#include "arpeggio.hh"
+#include "span-arpeggio.hh"
+#include "score-element.hh"
+#include "stem.hh"
+#include "staff-symbol-referencer.hh"
+
+bool
+Span_arpeggio::has_interface (Score_element* me)
+{
+ return me && me->has_interface (ly_symbol2scm ("span-arpeggio-interface"));
+}
+
+/*
+ We could collapse this with Arpeggio::brew_molecule, but that requires
+ hairy scm callback hacking.
+ */
+MAKE_SCHEME_CALLBACK (Span_arpeggio, brew_molecule, 1);
+SCM
+Span_arpeggio::brew_molecule (SCM smob)
+{
+ Score_element *me = unsmob_element (smob);
+
+ Interval iv;
+ Score_element *common = me;
+ for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s))
+ {
+ Score_element *arpeggio = unsmob_element (gh_car (s));
+ common = arpeggio->common_refpoint (common, Y_AXIS);
+ }
+ // Hmm, nothing in common?
+ if (0) //(common)
+ for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s))
+ {
+ Score_element *arpeggio = unsmob_element (gh_car (s));
+ Real c = common->relative_coordinate (arpeggio, Y_AXIS);
+ //iv.unite (Arpeggio::head_positions (stem));
+ iv.unite (Interval (c, c));
+ }
+ else
+ iv = Interval (-23, 5);
+
+ Molecule mol;
+ Molecule dot = me->paper_l ()->lookup_l (0)->afm_find ("dots-dot");
+ Real half_space = Staff_symbol_referencer::staff_space (me) / 2;
+ for (Real i = iv[MIN]; i < iv[MAX]; i++)
+ {
+ Molecule d (dot);
+ d.translate_axis (i * half_space, Y_AXIS);
+ mol.add_molecule (d);
+ }
+ mol.translate (Offset (-6, 0));
+
+ return mol.create_scheme ();
+}
+
+
return m.extent (X_AXIS);
}
-MAKE_SCHEME_CALLBACK(Span_bar,before_line_breaking);
+MAKE_SCHEME_CALLBACK(Span_bar,before_line_breaking,1);
SCM
Span_bar::before_line_breaking (SCM smob)
{
return SCM_UNSPECIFIED;
}
-Real
-Span_bar::center_on_spanned_callback (Score_element * me, Axis a)
+MAKE_SCHEME_CALLBACK(Span_bar,center_on_spanned_callback,2);
+SCM
+Span_bar::center_on_spanned_callback (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
assert (a == Y_AXIS);
Interval i (get_spanned_interval (me));
we have to translate ourselves to be in the center of the
interval that we span. */
- return i.center ();
+ return gh_double2scm (i.center ());
}
void
}
-MAKE_SCHEME_CALLBACK(Span_bar,get_bar_size);
+MAKE_SCHEME_CALLBACK(Span_bar,get_bar_size,1);
SCM
Span_bar::get_bar_size (SCM smob)
{
}
return gh_double2scm (iv.length ());
}
+
void
Span_bar::set_interface (Score_element *me)
{
Pointer_group_interface(me).set_interface ();
me->set_extent_callback (width_callback, X_AXIS);
- me->add_offset_callback (center_on_spanned_callback, Y_AXIS);
+ me->add_offset_callback (Span_bar_center_on_spanned_callback_proc, Y_AXIS);
me->set_interface (ly_symbol2scm ("span-bar-interface"));
me->set_extent_callback (0, Y_AXIS);
}
#include "staff-symbol.hh"
#include "paper-def.hh"
-
-
-
-void
-Staff_symbol_referencer::set_interface (Score_element * e)
-{
- if (!gh_number_p (e->get_elt_property ("staff-position")))
- e->set_elt_property ("staff-position", gh_double2scm (0.0));
-
- e->add_offset_callback (callback, Y_AXIS);
-}
-
bool
Staff_symbol_referencer::has_interface (Score_element*e)
{
|| gh_number_p (e->get_elt_property ("staff-position"));
}
-
int
Staff_symbol_referencer::line_count (Score_element*me)
{
/*
should use offset callback!
*/
-Real
-Staff_symbol_referencer::callback (Score_element * sc,Axis )
+MAKE_SCHEME_CALLBACK(Staff_symbol_referencer,callback,2);
+SCM
+Staff_symbol_referencer::callback (SCM element_smob, SCM axis)
{
- Score_element* me = (Score_element*)sc; // UGH.
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
- SCM pos = sc->get_elt_property ("staff-position");
+ SCM pos = me->get_elt_property ("staff-position");
Real off =0.0;
if (gh_number_p (pos))
{
- Real space = Staff_symbol_referencer::staff_space (sc);
+ Real space = Staff_symbol_referencer::staff_space (me);
off = gh_scm2double (pos) * space/2.0;
}
me->set_elt_property ("staff-position", gh_double2scm (0.0));
- return off;
+ return gh_double2scm (off);
}
-/*
+ /*
This sets the position relative to the center of the staff symbol.
-
+
The function is hairy, because it can be callled in two situations:
1. There is no staff yet; we must set staff-position
}
- if (me->has_offset_callback_b (callback, Y_AXIS))
+ if (me->has_offset_callback_b (Staff_symbol_referencer_callback_proc, Y_AXIS))
return ;
- me->add_offset_callback (callback, Y_AXIS);
+ me->add_offset_callback (Staff_symbol_referencer_callback_proc, Y_AXIS);
}
/*
return sign (Staff_symbol_referencer::position_f((Score_element*)a) -
Staff_symbol_referencer::position_f((Score_element*)b));
}
+
+
+void
+Staff_symbol_referencer::set_interface (Score_element * e)
+{
+ if (!gh_number_p (e->get_elt_property ("staff-position")))
+ e->set_elt_property ("staff-position", gh_double2scm (0.0));
+
+ e->add_offset_callback (Staff_symbol_referencer_callback_proc, Y_AXIS);
+}
#include "spanner.hh"
-MAKE_SCHEME_CALLBACK(Staff_symbol,brew_molecule);
+MAKE_SCHEME_CALLBACK(Staff_symbol,brew_molecule,1);
SCM
Staff_symbol::brew_molecule (SCM smob)
-MAKE_SCHEME_CALLBACK(Stem_tremolo,brew_molecule);
+MAKE_SCHEME_CALLBACK(Stem_tremolo,brew_molecule,1);
SCM
Stem_tremolo::brew_molecule (SCM smob)
{
}
}
-MAKE_SCHEME_CALLBACK(Stem,before_line_breaking);
+MAKE_SCHEME_CALLBACK(Stem,before_line_breaking,1);
SCM
Stem::before_line_breaking (SCM smob)
{
const Real ANGLE = 20* (2.0*M_PI/360.0); // ugh! Should be settable.
-MAKE_SCHEME_CALLBACK(Stem,brew_molecule);
+MAKE_SCHEME_CALLBACK(Stem,brew_molecule,1);
SCM
Stem::brew_molecule (SCM smob)
return mol.create_scheme();
}
-Real
-Stem::off_callback (Score_element * me, Axis)
+MAKE_SCHEME_CALLBACK(Stem,off_callback,2);
+SCM
+Stem::off_callback (SCM element_smob, SCM axis)
{
+ Score_element *me = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
Real r=0;
if (Score_element * f = first_head (me))
{
Interval head_wid(0, f->extent (X_AXIS).length ());
if (to_boolean (me->get_elt_property ("stem-centered")))
- return head_wid.center ();
+ return gh_double2scm ( head_wid.center ());
Real rule_thick = gh_scm2double (me->get_elt_property ("thickness")) * me->paper_l ()->get_var ("stafflinethickness");
Direction d = get_direction (me);
r = head_wid[d] - d * rule_thick ;
}
- return r;
+ return gh_double2scm (r);
}
Stem::set_interface (Score_element*me)
{
me->set_elt_property ("heads", SCM_EOL);
- me->add_offset_callback ( &Stem::off_callback, X_AXIS);
+ me->add_offset_callback ( Stem_off_callback_proc, X_AXIS);
me->set_interface (ly_symbol2scm ("stem-interface"));
}
};
-MAKE_SCHEME_CALLBACK(Sustain_pedal,brew_molecule);
+MAKE_SCHEME_CALLBACK(Sustain_pedal,brew_molecule,1);
SCM
Sustain_pedal::brew_molecule (SCM smob)
// centre on notehead ... if we have one.
if(notehead_l_) {
lyric->set_parent(notehead_l_, X_AXIS);
- lyric->add_offset_callback (Side_position::centered_on_parent, X_AXIS);
+ lyric->add_offset_callback (Side_position_centered_on_parent_proc, X_AXIS);
// reference is on the right of the notehead; move it left half way, and add translation
lyric->translate_axis (group_translation_f_-(notehead_l_->extent(X_AXIS)).center(), X_AXIS);
}
return me->lookup_l ()->filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
}
-MAKE_SCHEME_CALLBACK(System_start_delimiter,after_line_breaking);
+MAKE_SCHEME_CALLBACK(System_start_delimiter,after_line_breaking,1);
SCM
System_start_delimiter::after_line_breaking (SCM smob)
}
-MAKE_SCHEME_CALLBACK(System_start_delimiter,brew_molecule);
+MAKE_SCHEME_CALLBACK(System_start_delimiter,brew_molecule,1);
SCM
System_start_delimiter::brew_molecule (SCM smob)
/*
nicely center the scripts.
*/
- text->add_offset_callback (Side_position::aligned_on_self, X_AXIS);
- text->add_offset_callback (Side_position::centered_on_parent, X_AXIS);
+ text->add_offset_callback (Side_position_aligned_on_self_proc, X_AXIS);
+ text->add_offset_callback (Side_position_centered_on_parent_proc, X_AXIS);
}
};
-MAKE_SCHEME_CALLBACK(Text_item,brew_molecule)
+MAKE_SCHEME_CALLBACK(Text_item,brew_molecule,1);
SCM
Text_item::brew_molecule (SCM sm)
}
-MAKE_SCHEME_CALLBACK(Tie_column,after_line_breaking);
+MAKE_SCHEME_CALLBACK(Tie_column,after_line_breaking,1);
SCM
Tie_column::after_line_breaking (SCM smob)
{
return controls;
}
-MAKE_SCHEME_CALLBACK(Tie,set_spacing_rods);
+MAKE_SCHEME_CALLBACK(Tie,set_spacing_rods,1);
/*
TODO: set minimum distances for begin/end of line
return SCM_UNSPECIFIED;
}
-MAKE_SCHEME_CALLBACK(Tie,brew_molecule);
+MAKE_SCHEME_CALLBACK(Tie,brew_molecule,1);
SCM
Tie::brew_molecule (SCM smob)
{
#include "paper-def.hh"
#include "lookup.hh"
-MAKE_SCHEME_CALLBACK(Time_signature,brew_molecule);
+MAKE_SCHEME_CALLBACK(Time_signature,brew_molecule,1);
SCM
Time_signature::brew_molecule (SCM smob)
TODO.
*/
-MAKE_SCHEME_CALLBACK(Tuplet_spanner,brew_molecule);
+MAKE_SCHEME_CALLBACK(Tuplet_spanner,brew_molecule,1);
SCM
Tuplet_spanner::brew_molecule (SCM smob)
*dy = column_arr.top ()->extent (Y_AXIS) [d]
- column_arr[0]->extent (Y_AXIS) [d];
}
-MAKE_SCHEME_CALLBACK(Tuplet_spanner,after_line_breaking);
+MAKE_SCHEME_CALLBACK(Tuplet_spanner,after_line_breaking,1);
SCM
Tuplet_spanner::after_line_breaking (SCM smob)
}
}
+/*
+ TODO: add source information for debugging
+ */
void
Unfolded_repeat_iterator::add_repeat_command (SCM what)
{
bool early_stop = volta_span_p_ && unsmob_moment (l)
&&*unsmob_moment (l) <= now - started_mom_;
- if (end || early_stop)
+ if (end && !volta_span_p_)
+ {
+ warning (_("No volta spanner to end")); // fixme: be more verbose.
+ }
+ else if (end || early_stop)
{
end_volta_span_p_ = volta_span_p_;
volta_span_p_ =0;
*/
-MAKE_SCHEME_CALLBACK(Volta_spanner,brew_molecule);
+MAKE_SCHEME_CALLBACK(Volta_spanner,brew_molecule,1);
SCM
Volta_spanner::brew_molecule (SCM smob)
{
\consists "Rest_collision_engraver";
\consists "Local_key_engraver";
- startSustain = #"Ped."
- stopSustain = #"*"
- stopStartSustain = #"*Ped."
- startUnaChorda = #"una chorda"
- stopUnaChorda = #"tre chorde"
- % should make separate lists for stopsustain and startsustain
-
\consists "Piano_pedal_engraver";
+% \consists "Arpeggio_engraver";
+
\consistsend "Axis_group_engraver";
%{
\consists "Stem_engraver";
\consists "Beam_engraver";
\consists "Auto_beam_engraver";
- \include "auto-beam-settings.ly";
\consists "Chord_tremolo_engraver";
\consists "Melisma_engraver";
\consists "Slur_engraver";
\consists "Auto_beam_engraver";
- \include "auto-beam-settings.ly";
\consists "Align_note_column_engraver";
\consists "Rhythmic_column_engraver";
\type "Engraver_group_engraver";
\name GrandStaff;
\consists "Span_bar_engraver";
+ \consists "Span_arpeggio_engraver";
\consists "System_start_delimiter_engraver";
systemStartDelimiterGlyph = #'brace
StaffGroupContext= \translator {
\type "Engraver_group_engraver";
+ \name StaffGroup;
+
\consists "Span_bar_engraver";
+ \consists "Span_arpeggio_engraver";
\consists "Output_property_engraver";
+ systemStartDelimiterGlyph = #'bracket
\consists "System_start_delimiter_engraver";
- systemStartDelimiterGlyph = #'bracket
- \name StaffGroup;
\accepts "Staff";
\accepts "RhythmicStaff";
\accepts "GrandStaff";
\consists "Lyric_phrasing_engraver";
\consists "Bar_number_engraver";
+ \consists "Span_arpeggio_engraver";
\accepts "Staff";
explicitKeySignatureVisibility = #all-visible
scriptDefinitions = #default-script-alist
+
+ startSustain = #"Ped."
+ stopSustain = #"*"
+ stopStartSustain = #"*Ped."
+ startUnaChorda = #"una chorda"
+ stopUnaChorda = #"tre chorde"
+ % should make separate lists for stopsustain and startsustain
+
+
%
% what order to print accs. We could compute this,
% but computing is more work than putting it here.
% distances are given in stafflinethickness (thicknesses) and
% staffspace (distances)
%
+ basicArpeggioProperties = #`(
+ (interfaces . (arpeggio-interface))
+ (molecule-callback . ,Arpeggio::brew_molecule)
+ (name . "arpeggio")
+ )
basicBarProperties = #`(
(interfaces . (bar-interface staff-bar-interface))
(break-align-symbol . Staff_bar)
)
basicOctavateEightProperties = #`(
(self-alignment-X . 0)
- (text . "8")
+= (text . "8")
(visibility-lambda . ,begin-of-line-visible)
(molecule-callback . ,Text_item::brew_molecule)
(style . "italic")
(maximum-duration-for-spacing . ,(make-moment 1 8))
(name . "spacing spanner")
)
+ basicSpanArpeggioProperties = #`(
+ (interfaces . (span-arpeggio-interface))
+ (molecule-callback . ,Span_arpeggio::brew_molecule)
+ (name . "span arpeggio")
+ )
basicSpanBarProperties = #`(
(interfaces . (bar-interface span-bar-interface))
(break-align-symbol . Staff_bar)
(interfaces . (axis-group-interface))
(name . "Y-axis group")
)
+
+
+ \include "auto-beam-settings.ly";
+
}
OrchestralScoreContext= \translator {
#(eval-string (ly-gulp-file "script.scm"))
+#default-script-alist
+
"dash-hat" = "marcato"
"dash-plus" = "stopped"
"dash-dash" = "tenuto"
default-script-alist)
)
+
if ('MY_PATCH_LEVEL', '') in defs:
sys.stdout.write ('#define NO_MY_PATCHLEVEL')
+
+sys.stdout.write('\n');
TAGS:
-if [ "$(TAGS_FILES)" != "" ]; then \
- etags -CT $(TAGS_FILES) || \
- ctags -h ".h.hh.tcc.icc" $(TAGS_FILES) $(ERROR_LOG); \
+ etags $(ETAGS_FLAGS) $(TAGS_FILES) || \
+ ctags $(CTAGS_FLAGS) ".h.hh.tcc.icc" $(TAGS_FILES) $(ERROR_LOG); \
fi
$(LOOP)
DO_STRIP=true
LOOP=$(foreach i, $(SUBDIRS), $(MAKE) PACKAGE=$(PACKAGE) -C $(i) $@ &&) true
+ETAGS_FLAGS=-CT
+CTAGS_FLAGS=-h
include $(stepdir)/files.make
+