From 7249d131a7b58117ad502f17975af50ea4144a05 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 13 Oct 2000 18:52:53 +0200 Subject: [PATCH] release: 1.3.96 =========== * Added friendly message for the clueless dvips user. * Clef-engraver: changed c0-position, clef-position and glyph into properties, enabling ottava spanners: input/test/ottava.ly. * Added option for edge lines to Text spanner. * Bugfix for early initialisation of invalid (grace->voice) slur. * Dropped text support and padding of crescendo symbol. Horizontal alignment of dynamics is handled by side-support, Text crescendos use the generic Text spanner. * Added a generic Text spanner. 1.3.95.h --- CHANGES | 31 ++++---- Documentation/regression-test.tely | 7 ++ Documentation/user/mudela-book.tely | 5 ++ VERSION | 4 +- input/scarlatti-properties.ly | 22 ++++-- input/test/arpeggio.ly | 4 +- lily/align-interface.cc | 2 +- lily/arpeggio-engraver.cc | 17 +++-- lily/arpeggio.cc | 66 ++++++++++++++--- lily/axis-group-interface.cc | 6 +- lily/bar.cc | 24 ++++++- lily/beam.cc | 7 +- lily/break-align-item.cc | 6 +- lily/dot-column.cc | 4 +- lily/group-interface.cc | 40 +++-------- lily/hara-kiri-group-spanner.cc | 2 +- lily/hyphen-spanner.cc | 4 +- lily/include/arpeggio.hh | 5 ++ lily/include/group-interface.hh | 22 ++---- lily/include/score-element.hh | 7 +- lily/include/spaceable-element.hh | 2 +- lily/include/span-arpeggio.hh | 24 ------- lily/input-smob.cc | 2 +- lily/line-of-score.cc | 4 +- lily/local-key-engraver.cc | 30 ++++++-- lily/lyric-extender.cc | 6 +- lily/multi-measure-rest.cc | 8 +-- lily/note-column.cc | 5 +- lily/pointer-group-interface.cc | 39 ---------- lily/rest-collision.cc | 5 +- lily/score-element.cc | 61 ++++++++++------ lily/script-column.cc | 3 +- lily/separating-group-spanner.cc | 2 +- lily/separation-item.cc | 7 +- lily/side-position-interface.cc | 12 ++-- lily/slur.cc | 20 +++--- lily/spacing-spanner.cc | 4 +- lily/span-arpeggio-engraver.cc | 44 ++++++++---- lily/span-arpeggio.cc | 73 ------------------- lily/span-bar.cc | 3 +- lily/spanner.cc | 4 +- lily/stem-tremolo.cc | 7 +- lily/stem.cc | 28 ++++---- lily/syllable-group.cc | 22 +++--- lily/system-start-delimiter-engraver.cc | 2 +- lily/text-spanner.cc | 3 +- lily/tie-column.cc | 6 +- lily/tie.cc | 23 +++--- lily/tuplet-spanner.cc | 24 +++---- lily/volta-spanner.cc | 4 +- ly/engraver.ly | 25 ++++--- make/out/lilypond.lsm | 8 +-- make/out/lilypond.spec | 4 +- scripts/mudela-book.py | 95 ++++++++++++++++--------- 54 files changed, 451 insertions(+), 443 deletions(-) diff --git a/CHANGES b/CHANGES index 6d4d53fadd..ee5e336d24 100644 --- a/CHANGES +++ b/CHANGES @@ -3,33 +3,38 @@ * Added friendly message for the clueless dvips user. -1.3.95.jcn4 -=========== - * Clef-engraver: changed c0-position, clef-position and glyph into properties, enabling ottava spanners: input/test/ottava.ly. -1.3.95.jcn3 -=========== - * Added option for edge lines to Text spanner. * Bugfix for early initialisation of invalid (grace->voice) slur. -1.3.95.jcn2 -=========== - * Dropped text support and padding of crescendo symbol. Horizontal alignment of dynamics is handled by side-support, Text crescendos use the generic Text spanner. -1.3.95.jcn1 +* Added a generic Text spanner. + +1.3.95.hwn1 =========== -* Added a generic Text spanner. +* Bugfix: octavate eight. -1.3.94.uu1 -========== +* Rewrote arpeggio. + +* mudela-book fixes (Tom Cato) + +* Cleaned up Group_interface and Pointer_group_interface + +* Add accidentals to arpeggio support. + +* Stemup + barline combination gets extra space. + +* Score_element::extent () now takes a reference point argument. + +1.3.95 +====== * Use music property for setting type. This prevents accidental forgotten copies. diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index 5d9ca9f197..63774881e4 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -118,6 +118,13 @@ linked with (de)crescendi, they should be on the same line. @mudelafile{dyn-line.ly} + +Arpeggios are supported, both cross-staff and one-staff. + +@mudelafile{arpeggio.ly} + + + @section Chord names Chord names are generated from a list pitches, and are customisable diff --git a/Documentation/user/mudela-book.tely b/Documentation/user/mudela-book.tely index 774a141bbc..b135ca2f90 100644 --- a/Documentation/user/mudela-book.tely +++ b/Documentation/user/mudela-book.tely @@ -395,6 +395,11 @@ The La@TeX{} \includeonly@{...@} command is ignored. Ignores almost all La@TeX{} commands that changes margins and linewidths. +La@TeX{} comments can confuse @command{mudela-book}: +@example +% this music will be displayed: \mudela@{c d e@} +@end example + @section Authors @email{hanwen@@cs.uu.nl, Han-Wen Nienhuys}, @uref{http://www.cs.uu.nl/people/hanwen} diff --git a/VERSION b/VERSION index 50711b33d8..e089428ecd 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 -PATCH_LEVEL=95 -MY_PATCH_LEVEL=tca2 +PATCH_LEVEL=96 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/scarlatti-properties.ly b/input/scarlatti-properties.ly index 4dc3154eaa..b364b406d2 100644 --- a/input/scarlatti-properties.ly +++ b/input/scarlatti-properties.ly @@ -3,20 +3,32 @@ \version "1.3.93"; -rh=\property Thread.noteHeadStyle=##f -lh=\property Thread.noteHeadStyle = #'diamond -n=\property Thread.fontSize=#0 -sm=\property Thread.fontSize=#-1 +rh=\property Thread.NoteHead \push #'style = #'default +lh=\property Thread.NoteHead \push #'style = #'diamond + +n = \property Thread.NoteHead \pop #'font-size % = #'diamond %\property Thread.fontSize=#0 +sm=\property Thread.NoteHead \push #'font-size = #-1 + % su=\property Voice.verticalDirection=#1 % sd=\property Voice.verticalDirection=#-1 su=\property Voice.Stem \push #'direction = #1 sd=\property Voice.Stem \push #'direction = #-1 -zs=\property Voice.forceHorizontalShift=#0.0 + +%{ ls=\property Voice.forceHorizontalShift=#-0.6 sls=\property Voice.forceHorizontalShift=#-0.22 rs=\property Voice.forceHorizontalShift=#0.6 srs=\property Voice.forceHorizontalShift=#0.22 +%} +zs = \property Voice.NoteColumn \pop #'force-hshift % #0.0 +ls = \property Voice.NoteColumn \push #'force-hshift = #-0.6 +sls= \property Voice.NoteColumn \push #'force-hshift = #-0.22 +rs = \property Voice.NoteColumn \push #'force-hshift = #0.6 +srs= \property Voice.NoteColumn \push #'force-hshift = #0.22 + + + ab=\property Voice.noAutoBeaming=##f xb=\property Voice.noAutoBeaming=##t diff --git a/input/test/arpeggio.ly b/input/test/arpeggio.ly index 9e7f930ace..d2122aa777 100644 --- a/input/test/arpeggio.ly +++ b/input/test/arpeggio.ly @@ -1,14 +1,14 @@ \score{ \context PianoStaff < \context Staff=one \notes\relative c''{ - fis,\arpeggio + \context Voice < fis,-\arpeggio d a > %%\property PianoStaff.SpanArpeggio \push #'connect = ##t \property PianoStaff.connectArpeggios = ##t } \context Staff=two \notes\relative c{ \clef bass; - g + \context Voice < g b d-\arpeggio > } > diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 8bc3f13f25..12c8683d78 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -54,7 +54,7 @@ Align_interface::do_side_processing (Score_element * me, Axis a) = Pointer_group_interface__extract_elements ( me, (Score_element*) 0, "elements"); for (int i=0; i < all_elts.size(); i++) { - Interval y = all_elts[i]->extent(a) + all_elts[i]->relative_coordinate (me, a); + Interval y = all_elts[i]->extent(me, a); if (!y.empty_b()) { Score_element *e =dynamic_cast(all_elts[i]); diff --git a/lily/arpeggio-engraver.cc b/lily/arpeggio-engraver.cc index f9a2ee65bb..5a95deecdc 100644 --- a/lily/arpeggio-engraver.cc +++ b/lily/arpeggio-engraver.cc @@ -65,7 +65,13 @@ Arpeggio_engraver::acknowledge_element (Score_element_info info) { stems_.push (info.elem_l_); } - else if (Rhythmic_head::has_interface (info.elem_l_) + + else + + /* + We can't catch local key items from Voice context, but let's leave + it here in case someone moves this stuff around. */ + if (Rhythmic_head::has_interface (info.elem_l_) || Local_key_item::has_interface (info.elem_l_)) { supports_.push (info.elem_l_); @@ -80,13 +86,12 @@ Arpeggio_engraver::process_acknowledged () { arpeggio_ = new Item (get_property ("Arpeggio")); arpeggio_->set_parent (stems_[0], Y_AXIS); - Side_position::set_axis (arpeggio_, X_AXIS); - Side_position::set_direction (arpeggio_, LEFT); - Staff_symbol_referencer::set_interface (arpeggio_); - Pointer_group_interface pgi (arpeggio_, "stems"); + + // Staff_symbol_referencer::set_interface (arpeggio_); + for (int i = 0; i < stems_.size (); i++) { - pgi.add_element (stems_[i]); + Pointer_group_interface::add_element (arpeggio_, "stems", stems_[i]); //Side_position::add_support (arpeggio_, stems_[i]); } for (int i = 0; i < supports_.size (); i++) diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index b974768b0e..7f889715db 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -13,6 +13,8 @@ #include "score-element.hh" #include "stem.hh" #include "staff-symbol-referencer.hh" +#include "staff-symbol.hh" +#include "warn.hh" bool Arpeggio::has_interface (Score_element* me) @@ -26,25 +28,71 @@ Arpeggio::brew_molecule (SCM smob) { Score_element *me = unsmob_element (smob); - Interval iv; + Score_element * common = me; 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)); + Score_element * stem = unsmob_element (gh_car (s)); + common = common->common_refpoint (Staff_symbol_referencer::staff_symbol_l (stem), + Y_AXIS); } + /* + TODO: + + Using stems here is not very convenient; should store noteheads + instead, and also put them into the support. Now we will mess up + in vicinity of a collision. + + */ + Interval heads; + Real my_y = me->relative_coordinate (common, Y_AXIS); + + for (SCM s = me->get_elt_property ("stems"); gh_pair_p (s); s = gh_cdr (s)) + { + Score_element * stem = unsmob_element (gh_car (s)); + Score_element * ss = Staff_symbol_referencer::staff_symbol_l (stem); + Interval iv =Stem::head_positions (stem); + iv *= Staff_symbol::staff_space (ss)/2.0; + + heads.unite (iv + ss->relative_coordinate (common, Y_AXIS) + - my_y); + } + + if (heads.empty_b ()) + { + programming_error ("Huh? Dumb blonde encountered?"); + /* + Nee Valerie, jij bent _niet_ dom. + */ + return SCM_EOL; + } + Molecule mol; Molecule arpeggio = me->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio"); - Real staff_space = Staff_symbol_referencer::staff_space (me); - for (int i = (int)iv[MIN]/ 2; i < (int)(iv[MAX] - 1)/ 2; i++) + + Real y = heads[LEFT]; + while (y < heads[RIGHT]) { - Molecule a (arpeggio); - a.translate_axis (i * staff_space, Y_AXIS); - mol.add_molecule (a); + mol.add_at_edge (Y_AXIS, UP,arpeggio, 0.0); + y+= arpeggio. extent (Y_AXIS).length (); } - // mol.translate (Offset (-2 * staff_space, 0)); + mol.translate_axis (heads[LEFT], Y_AXIS); return mol.create_scheme (); } +/* + We have to do a callback, because brew_molecule () triggers a + vertical alignment if it is cross-staff. +*/ +MAKE_SCHEME_CALLBACK(Arpeggio, width_callback,2); +SCM +Arpeggio::width_callback (SCM smob, SCM axis) +{ + Score_element * me = unsmob_element (smob); + Axis a = (Axis)gh_scm2int (axis); + assert (a == X_AXIS); + Molecule arpeggio = me->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio"); + return ly_interval2scm (arpeggio.extent (X_AXIS)); +} diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index f7e8c22bf1..dcfc553fa4 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -21,7 +21,7 @@ Axis_group_interface::add_element (Score_element*me,Score_element *e) e->set_parent (me, a); } - Pointer_group_interface (me).add_element (e); + Pointer_group_interface::add_element (me, "elements", e); me->add_dependency (e); } @@ -44,9 +44,9 @@ Axis_group_interface::relative_group_extent (Axis a, Score_element *common, SCM for (SCM s = elts; gh_pair_p (s); s = gh_cdr (s)) { Score_element * se = unsmob_element (gh_car (s)); - Interval dims = se->extent (a); + Interval dims = se->extent (common, a); if (!dims.empty_b ()) - r.unite (dims + se->relative_coordinate (common, a)); + r.unite (dims); } return r; } diff --git a/lily/bar.cc b/lily/bar.cc index 11bcc38302..63b2632560 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -7,6 +7,7 @@ */ #include +#include "paper-column.hh" #include "main.hh" #include "dimensions.hh" #include "score-element.hh" @@ -150,15 +151,34 @@ Bar::before_line_breaking (SCM smob) if (! gh_equal_p (g, orig)) me->set_elt_property ("glyph", g); + + /* + set a (pseudo) stem-direction, so we extra space is inserted + between stemup and barline. + + TODO: should check if the barline is the leftmost object of the + break alignment. + */ + if (gh_string_p (g)) + { + Score_element * col = item->column_l (); + SCM dirlist = col->get_elt_property ("dir-list"); + SCM scmdir = gh_int2scm (-1); + if (scm_memq (scmdir, dirlist) == SCM_BOOL_F) + { + dirlist = gh_cons (scmdir, dirlist); + col->set_elt_property ("dir-list", dirlist); + } + } + return SCM_UNSPECIFIED; } void Bar::set_interface (Score_element*me) { - me->set_elt_property ("interfaces", - gh_cons (ly_symbol2scm ("bar-interface"), me->get_elt_property ("interfaces"))); + me->set_interface (ly_symbol2scm ("bar-interface")); } bool diff --git a/lily/beam.cc b/lily/beam.cc index 7def162133..c4013abfcf 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -39,8 +39,7 @@ void Beam::add_stem (Score_element*me, Score_element*s) { - Pointer_group_interface gi (me, "stems"); - gi.add_element (s); + Pointer_group_interface:: add_element(me, "stems", s); s->add_dependency (me); @@ -931,7 +930,9 @@ Beam::rest_collision_callback (SCM element_smob, SCM axis) Real beamy = (stem->relative_coordinate (0, X_AXIS) - x0) * dydx + beam_y; Real staff_space = Staff_symbol_referencer::staff_space (rest); - Real rest_dim = rest->extent (Y_AXIS)[d]*2.0 / staff_space ; + + + Real rest_dim = rest->extent (rest, Y_AXIS)[d]*2.0 / staff_space ; // refp?? Real minimum_dist = gh_scm2double (rest->get_elt_property ("minimum-beam-collision-distance")); diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index b8d87a0112..1ffdb1325c 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -87,7 +87,7 @@ Break_align_interface::do_alignment (Score_element *me) for (int i=0; i < all_elems.size(); i++) { - Interval y = all_elems[i]->extent(X_AXIS); + Interval y = all_elems[i]->extent(all_elems[i], X_AXIS); if (!y.empty_b()) elems.push (dynamic_cast (all_elems[i])); } @@ -175,13 +175,13 @@ Break_align_interface::do_alignment (Score_element *me) Real pre_space = elems[0]->relative_coordinate (column, X_AXIS); - Real xl = elems[0]->extent (X_AXIS)[LEFT]; + Real xl = elems[0]->extent (elems[0],X_AXIS)[LEFT]; if (!isinf (xl)) pre_space += xl; else programming_error ("Infinity reached. "); - Real xr = elems.top ()->extent (X_AXIS)[RIGHT]; + Real xr = elems.top ()->extent (elems.top (), X_AXIS)[RIGHT]; Real spring_len = elems.top ()->relative_coordinate (column, X_AXIS); if (!isinf (xr)) spring_len += xr; diff --git a/lily/dot-column.cc b/lily/dot-column.cc index d91e1b9de4..a9838ae13b 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -126,9 +126,7 @@ Dot_column::add_head (Score_element * me, Score_element *rh) { Side_position::add_support (me,rh); - Pointer_group_interface gi (me, "dots"); - gi.add_element (d); - + Pointer_group_interface ::add_element (me, "dots",d); d->add_offset_callback (Dot_column::force_shift_callback_proc , Y_AXIS); Axis_group_interface::add_element (me, d); } diff --git a/lily/group-interface.cc b/lily/group-interface.cc index a64ba45925..f7ec3d8fd6 100644 --- a/lily/group-interface.cc +++ b/lily/group-interface.cc @@ -9,44 +9,24 @@ #include "group-interface.hh" #include "score-element.hh" -/* - ugh: clean me, junk elt_l_ field - */ -Group_interface::Group_interface (Score_element * e) -{ - elt_l_ = (Score_element*)e; - name_ = "elements"; -} - - -Group_interface::Group_interface (Score_element *e, String s) -{ - elt_l_ =(Score_element*)e; - name_ = s; -} -bool -Group_interface::has_interface () -{ - SCM el = elt_l_->get_elt_property (name_.ch_C()); - - return el == SCM_EOL || gh_pair_p (el); -} - - void -Group_interface::add_thing (SCM s) +Group_interface::add_thing (Score_element*me, String name, SCM s) { - elt_l_->set_elt_property (name_.ch_C (), - gh_cons (s, elt_l_->get_elt_property (name_.ch_C()))); + me->set_elt_property (name.ch_C (), + gh_cons (s, me->get_elt_property (name.ch_C()))); } int -Group_interface::count () +Group_interface::count (Score_element *me, String name) { - return scm_ilength (elt_l_->get_elt_property (name_.ch_C())); + return scm_ilength (me->get_elt_property (name.ch_C())); } - +void +Pointer_group_interface::add_element (Score_element*me, String name, Score_element*p) +{ + Group_interface::add_thing (me, name, p->self_scm()); +} diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index 66bd0389ad..2db1040937 100644 --- a/lily/hara-kiri-group-spanner.cc +++ b/lily/hara-kiri-group-spanner.cc @@ -99,5 +99,5 @@ void Hara_kiri_group_spanner::add_interesting_item (Score_element* me,Score_element* n) { me->add_dependency (n); - Pointer_group_interface (me, "items-worth-living").add_element (n); + Pointer_group_interface::add_element (me, "items-worth-living",n); } diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index eb64b7d134..3ff71c7743 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -37,9 +37,7 @@ Hyphen_spanner::brew_molecule (SCM smob) do { - Real x = sp->get_bound (d)->relative_coordinate (common, X_AXIS); - Interval ext = sp->get_bound (d)->extent (X_AXIS); - bounds[d] = (x + ext[-d]); + bounds[d] = sp->get_bound (d)->extent (common, X_AXIS)[-d]; } while (flip (&d) != LEFT); diff --git a/lily/include/arpeggio.hh b/lily/include/arpeggio.hh index 317027d999..08c5a98c68 100644 --- a/lily/include/arpeggio.hh +++ b/lily/include/arpeggio.hh @@ -11,11 +11,16 @@ #include "lily-guile.hh" #include "lily-proto.hh" +/* + properties: + stems -- list of stem objects, corresponding to the notes that the + arp has to be before. */ class Arpeggio { public: DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); + DECLARE_SCHEME_CALLBACK(width_callback, (SCM,SCM)); static bool has_interface (Score_element*); }; diff --git a/lily/include/group-interface.hh b/lily/include/group-interface.hh index 81ee3e4ccf..fb19eec2fc 100644 --- a/lily/include/group-interface.hh +++ b/lily/include/group-interface.hh @@ -25,28 +25,14 @@ struct Group_interface { - Score_element * elt_l_; - String name_; public: - Group_interface (Score_element *); - Group_interface (Score_element *, String); - int count (); - void add_thing (SCM); - bool has_interface (); - + static int count (Score_element* , String); + static void add_thing (Score_element*, String nm, SCM); }; -struct Pointer_group_interface { - Score_element * elt_l_; - String name_; +struct Pointer_group_interface : public Group_interface { public: - Pointer_group_interface (Score_element*); - Pointer_group_interface (Score_element*, String); - int count (); - - static bool has_interface (Score_element*); - bool has_interface (); - void add_element (Score_element*); + static void add_element (Score_element*, String nm, Score_element*e); }; /** Put all score elements of ELT's property called NAME into an array, diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 99742defe0..81fa3115fc 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -18,8 +18,8 @@ for administration of what was done already */ enum Score_element_status { - ORPHAN=0, // not yet added to pstaff - VIRGIN, // added to pstaff + ORPHAN=0, // not yet added to Paper_score + VIRGIN, PRECALCING, PRECALCED, // calcs before spacing done POSTCALCING, // busy calculating. This is used to trap cyclic deps. @@ -152,7 +152,8 @@ public: public: bool empty_b (Axis a) const; - Interval extent (Axis) const; + + Interval extent (Score_element * refpoint, Axis) const; /** translate in one direction diff --git a/lily/include/spaceable-element.hh b/lily/include/spaceable-element.hh index 9b71907707..577f8902e1 100644 --- a/lily/include/spaceable-element.hh +++ b/lily/include/spaceable-element.hh @@ -12,6 +12,7 @@ #include "lily-guile.hh" #include "lily-proto.hh" + /* properties : @@ -21,7 +22,6 @@ dir-list -- list of stem directions. */ - struct Spaceable_element { /// set a minimum distance diff --git a/lily/include/span-arpeggio.hh b/lily/include/span-arpeggio.hh index a494fbeb26..e69de29bb2 100644 --- a/lily/include/span-arpeggio.hh +++ b/lily/include/span-arpeggio.hh @@ -1,24 +0,0 @@ -/* - span-arpegio.hh -- declare Span_arpeggio - - source file of the GNU LilyPond music typesetter - - (c) 2000 Jan Nieuwenhuizen -*/ - -#ifndef SPAN_ARPEGGIO_HH -#define SPAN_ARPEGGIO_HH - -#include "lily-guile.hh" -#include "lily-proto.hh" -#include "interval.hh" - -class Span_arpeggio -{ -public: - DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); - static bool has_interface (Score_element*); -}; - -#endif /* SPAN_ARPEGGIO_HH */ - diff --git a/lily/input-smob.cc b/lily/input-smob.cc index 2a9927db86..992c0e5baf 100644 --- a/lily/input-smob.cc +++ b/lily/input-smob.cc @@ -23,7 +23,7 @@ SCM mark_smob (SCM) static int print_smob (SCM s, SCM port, scm_print_state *) { - String str = "#location_str () + ">"; + String str = "#location_str () + ">"; scm_puts (str.ch_C(), port); return 1; } diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index bc70174dbc..91045bc1f9 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -51,7 +51,7 @@ void Line_of_score::typeset_element (Score_element * elem_p) { elem_p->pscore_l_ = pscore_l_; - Pointer_group_interface (this, "all-elements").add_element (elem_p); + Pointer_group_interface::add_element (this, "all-elements",elem_p); scm_unprotect_object (elem_p->self_scm ()); } @@ -287,7 +287,7 @@ Line_of_score::post_processing (bool last_line) ly_symbol2scm ("after-line-breaking-callback")); } - Interval i(extent(Y_AXIS)); + Interval i(extent(this, Y_AXIS)); if (i.empty_b()) programming_error ("Huh? Empty Line_of_score?"); else diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index f8fd3516ff..89e1a6f7f4 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -16,7 +16,7 @@ #include "staff-symbol-referencer.hh" #include "side-position-interface.hh" #include "engraver.hh" - +#include "arpeggio.hh" /** Make accidentals. Catches note heads, ties and notices key-change @@ -44,6 +44,12 @@ public: // todo -> property SCM last_keysig_; + + /* + Urgh. Since the accidentals depend on lots of variables, we have to + store all information before we can really create the accidentals. + */ + Link_array arpeggios_; Link_array mel_l_arr_; Link_array support_l_arr_; @@ -105,8 +111,8 @@ Local_key_engraver::process_acknowledged () { key_item_p_ = new Item(get_property ("Accidentals")); Local_key_item::set_interface (key_item_p_); - Side_position::set_axis (key_item_p_, X_AXIS); - Side_position::set_direction (key_item_p_, LEFT); + + Staff_symbol_referencer::set_interface (key_item_p_); announce_element (key_item_p_, 0); @@ -155,7 +161,17 @@ Local_key_engraver::process_acknowledged () Side_position::add_support (grace_align_l_,key_item_p_); grace_align_l_ =0; } - + + if (key_item_p_) + { + /* + Hmm. Which one has to be on the left? + */ + for (int i=0; i < arpeggios_.size (); i++) + Side_position::add_support (arpeggios_[i], key_item_p_); + + arpeggios_.clear (); + } } void @@ -178,6 +194,7 @@ Local_key_engraver::do_pre_move_processing() grace_align_l_ = 0; mel_l_arr_.clear(); + arpeggios_.clear (); tied_l_arr_.clear(); support_l_arr_.clear(); forced_l_arr_.clear(); @@ -210,6 +227,11 @@ Local_key_engraver::acknowledge_element (Score_element_info info) { tied_l_arr_.push (Tie::head (info.elem_l_, RIGHT)); } + else if (Arpeggio::has_interface (info.elem_l_)) + { + arpeggios_.push (info.elem_l_); + } + } /* diff --git a/lily/lyric-extender.cc b/lily/lyric-extender.cc index fb09d42307..744e3d6e21 100644 --- a/lily/lyric-extender.cc +++ b/lily/lyric-extender.cc @@ -21,8 +21,10 @@ SCM Lyric_extender::brew_molecule (SCM smob) { Spanner *sp = dynamic_cast (unsmob_element (smob)); - - Real leftext = sp->get_bound (LEFT)->extent (X_AXIS).length (); + + // ugh: refp + Real leftext = sp->get_bound (LEFT)->extent (sp->get_bound (LEFT), + X_AXIS).length (); Real ss = sp->paper_l ()->get_var ("staffspace"); Real sl = sp->paper_l ()->get_var ("stafflinethickness"); Real righttrim = 0.5; // default to half a staffspace gap on the right diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index e414c09bf6..fbe8996a31 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -49,8 +49,7 @@ Multi_measure_rest::brew_molecule (SCM smob) { Item * col = sp->get_bound (d)->column_l (); - Interval coldim = col->extent (X_AXIS) - + col->relative_coordinate (0, X_AXIS); + Interval coldim = col->extent (0, X_AXIS); sp_iv[d] = coldim[-d] ; } @@ -146,8 +145,7 @@ Multi_measure_rest::brew_molecule (SCM smob) void Multi_measure_rest::add_column (Score_element*me,Item* c) { - Pointer_group_interface gi (me, "columns"); - gi.add_element (c); + Pointer_group_interface::add_element (me, "columns",c); add_bound_item (dynamic_cast (me),c); } @@ -189,7 +187,7 @@ Multi_measure_rest::set_spacing_rods (SCM smob) /* should do something more advanced. */ - rod.distance_f_ = l->extent (X_AXIS)[BIGGER] - r->extent (X_AXIS)[SMALLER] + rod.distance_f_ = l->extent (l, X_AXIS)[BIGGER] - r->extent (r, X_AXIS)[SMALLER] + gh_scm2double (me->get_elt_property ("minimum-width")) * staff_space; rod.add_to_cols (); diff --git a/lily/note-column.cc b/lily/note-column.cc index f9711fc954..dde7969295 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -100,8 +100,7 @@ Note_column::add_head (Score_element*me,Score_element *h) } else if (Note_head::has_interface (h)) { - Pointer_group_interface gi (me, "note-heads"); - gi.add_element (h); + Pointer_group_interface::add_element (me, "note-heads",h); } Axis_group_interface::add_element (me, h); } @@ -132,7 +131,7 @@ Interval Note_column::rest_dim (Score_element*me) { Score_element * r = unsmob_element (me->get_elt_property ("rest")); - return r->extent (Y_AXIS); + return r->extent (r, Y_AXIS); // ?? } Score_element* diff --git a/lily/pointer-group-interface.cc b/lily/pointer-group-interface.cc index 66b327959a..7804d4fcbf 100644 --- a/lily/pointer-group-interface.cc +++ b/lily/pointer-group-interface.cc @@ -9,46 +9,7 @@ #include "group-interface.hh" #include "score-element.hh" -/* - UGH clean me . - */ -Pointer_group_interface::Pointer_group_interface (Score_element * e) -{ - elt_l_ = e; - name_ = "elements"; -} - - -Pointer_group_interface::Pointer_group_interface (Score_element *e, String s) -{ - elt_l_ =(Score_element*)e; - name_ = s; -} - -/* - duh. - */ -bool -Pointer_group_interface::has_interface () -{ - SCM el = elt_l_->get_elt_property (name_.ch_C()); - - return el == SCM_EOL || gh_pair_p (el); -} - -void -Pointer_group_interface::add_element (Score_element*p) -{ - elt_l_->set_elt_property (name_.ch_C(), - gh_cons (p->self_scm (), - elt_l_->get_elt_property (name_.ch_C()))); -} -int -Pointer_group_interface::count () -{ - return scm_ilength (elt_l_->get_elt_property (name_.ch_C())); -} diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index dad5f9cea4..b09bf84258 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -47,8 +47,7 @@ void Rest_collision::add_column (Score_element*me,Score_element *p) { me->add_dependency (p); - Pointer_group_interface gi (me); - gi.add_element (p); + Pointer_group_interface::add_element (me, "elements", p); p->add_offset_callback (Rest_collision::force_shift_callback_proc, Y_AXIS); p->set_elt_property ("rest-collision", me->self_scm ()); @@ -203,7 +202,7 @@ Rest_collision::do_shift (Score_element *me, SCM elts) Interval notedim; for (int i = 0; i < notes.size(); i++) { - notedim.unite (notes[i]->extent (Y_AXIS)); + notedim.unite (notes[i]->extent (notes[i],Y_AXIS)); // refp? } Interval inter (notedim); diff --git a/lily/score-element.cc b/lily/score-element.cc index 39405a4324..a19df5c7d0 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -48,8 +48,6 @@ Score_element::Score_element(SCM basicprops) /* fixme: default should be no callback. */ - set_extent_callback (molecule_extent_proc, X_AXIS); - set_extent_callback (molecule_extent_proc, Y_AXIS) ; pscore_l_=0; lookup_l_ =0; @@ -60,21 +58,32 @@ Score_element::Score_element(SCM basicprops) 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_); - - SCM cb = get_elt_property ("X-extent-callback"); - if (cb != SCM_EOL) - dim_cache_[X_AXIS].dimension_ = cb; - - cb = get_elt_property ("Y-extent-callback"); - if (cb != SCM_EOL) - dim_cache_[Y_AXIS].dimension_ = cb; + char const*onames[] = {"X-offset-callbacks", "Y-offset-callbacks"}; + char const*enames[] = {"X-extent-callback", "Y-extent-callback"}; + + for (int a = X_AXIS; a <= Y_AXIS; a++){ + SCM l = get_elt_property (onames[a]); + + if (scm_ilength (l) >=0) + { + dim_cache_[a].offset_callbacks_ = l; + dim_cache_[a].offsets_left_ = scm_ilength (l); + } + else + { + programming_error ("[XY]-offset-callbacks must be a list"); + } + + SCM cb = get_elt_property (enames[a]); + + /* + Should change default to be empty? + */ + if (!gh_procedure_p (cb) && !gh_pair_p (cb)) + cb = molecule_extent_proc; + + dim_cache_[a].dimension_ = cb; + } } @@ -338,8 +347,8 @@ Score_element::add_dependency (Score_element*e) { if (e) { - Pointer_group_interface gi (this, "dependencies"); - gi.add_element (e); + Pointer_group_interface ::add_element (this, "dependencies",e); + } else programming_error ("Null dependency added"); @@ -569,9 +578,19 @@ Score_element::empty_b (Axis a)const gh_procedure_p (dim_cache_[a].dimension_ )); } +/* + TODO: add + + Score_element *refpoint + + to arguments? + */ Interval -Score_element::extent (Axis a) const +Score_element::extent (Score_element * refp, Axis a) const { + Real x = relative_coordinate (refp, a); + + Dimension_cache * d = (Dimension_cache *)&dim_cache_[a]; Interval ext ; if (gh_pair_p (d->dimension_)) @@ -610,6 +629,8 @@ Score_element::extent (Axis a) const ext.unite (Interval (s * gh_scm2double (gh_car (extra)), s * gh_scm2double (gh_cdr (extra)))); } + + ext.translate (x); return ext; } diff --git a/lily/script-column.cc b/lily/script-column.cc index e4a1989c69..6247c6a910 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -18,8 +18,7 @@ Script_column::add_staff_sided (Score_element *me, Item *i) if (!gh_number_p (p)) return; - Pointer_group_interface gi (me, "scripts"); - gi.add_element (i); + Pointer_group_interface::add_element (me, "scripts",i); me->add_dependency (i); } diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 644366f5a9..6c9c628e99 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -98,7 +98,7 @@ Separating_group_spanner::set_spacing_rods (SCM smob) void Separating_group_spanner::add_spacing_unit (Score_element* me ,Item*i) { - Pointer_group_interface (me, "elements").add_element (i); + Pointer_group_interface::add_element (me, "elements",i); me->add_dependency (i); } diff --git a/lily/separation-item.cc b/lily/separation-item.cc index fa73f2f4bd..ce426d8dcf 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -23,7 +23,7 @@ void Separation_item::add_item (Score_element*s,Item* i) { assert (i); - Pointer_group_interface (s).add_element (i); + Pointer_group_interface::add_element (s,"elements",i); s->add_dependency (i); } @@ -53,11 +53,10 @@ Separation_item::my_width (Score_element *me) continue; } - Interval iv (il->extent (X_AXIS)); + Interval iv (il->extent (pc, X_AXIS)); if (!iv.empty_b ()) { - Real off = il->relative_coordinate (pc, X_AXIS); - w.unite (iv + off); + w.unite (iv); } } diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 9ad3f6f3c4..756993387e 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -18,7 +18,7 @@ void Side_position::add_support (Score_element*me, Score_element*e) { - Pointer_group_interface (me, "side-support-elements").add_element (e); + Pointer_group_interface::add_element (me, "side-support-elements",e); } @@ -74,9 +74,7 @@ Side_position::side_position (SCM element_smob, SCM axis) Score_element * e = unsmob_element ( gh_car (s)); if (e) { - Real coord = e->relative_coordinate (common, a); - - dim.unite (coord + e->extent (a)); + dim.unite (e->extent (common, a)); } } @@ -122,7 +120,7 @@ Side_position::aligned_on_self (SCM element_smob, SCM axis) SCM align (me->get_elt_property (s.ch_C())); if (gh_number_p (align)) { - Interval ext(me->extent (a)); + Interval ext(me->extent (me,a)); if (ext.empty_b ()) { @@ -199,7 +197,7 @@ Side_position::aligned_side (SCM element_smob, SCM axis) Direction d = Side_position::get_direction (me); Real o = gh_scm2double (side_position (element_smob,axis)); - Interval iv = me->extent (a); + Interval iv = me->extent (me, a); if (!iv.empty_b ()) { @@ -223,7 +221,7 @@ Side_position::centered_on_parent (SCM element_smob, SCM axis) Axis a = (Axis) gh_scm2int (axis); Score_element *him = me->parent_l (a); - return gh_double2scm (him->extent (a).center ()); + return gh_double2scm (him->extent (him,a).center ()); } diff --git a/lily/slur.cc b/lily/slur.cc index 7e37ddae47..38d163fde7 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -48,7 +48,7 @@ Slur::add_column (Score_element*me, Score_element*n) warning (_ ("Putting slur over rest. Ignoring.")); else { - Pointer_group_interface (me, "note-columns").add_element (n); + Pointer_group_interface::add_element (me, "note-columns",n); me->add_dependency (n); } @@ -238,7 +238,7 @@ Slur::get_attachment (Score_element*me,Direction dir, /* Default position is centered in X, on outer side of head Y */ - o += Offset (0.5 * n->extent (X_AXIS).length (), + o += Offset (0.5 * n->extent (n,X_AXIS).length (), 0.5 * ss * Directional_element_interface::get (me)); } else if (str == "alongside-stem") @@ -247,7 +247,7 @@ Slur::get_attachment (Score_element*me,Direction dir, /* Default position is on stem X, on outer side of head Y */ - o += Offset (n->extent (X_AXIS).length () + o += Offset (n->extent (n,X_AXIS).length () * (1 + Stem::get_direction (stem)), 0.5 * ss * Directional_element_interface::get (me)); } @@ -258,8 +258,8 @@ Slur::get_attachment (Score_element*me,Direction dir, Default position is on stem X, at stem end Y */ o += Offset (0.5 * - (n->extent (X_AXIS).length () - - stem->extent (X_AXIS).length ()) + (n->extent (n,X_AXIS).length () + - stem->extent (stem,X_AXIS).length ()) * (1 + Stem::get_direction (stem)), 0); } @@ -335,18 +335,16 @@ Slur::encompass_offset (Score_element*me, Simply set x to middle of notehead */ - o[X_AXIS] -= 0.5 * stem_dir * col->extent (X_AXIS).length (); + o[X_AXIS] -= 0.5 * stem_dir * col->extent (col,X_AXIS).length (); if ((stem_dir == dir) - && !stem_l->extent (Y_AXIS).empty_b ()) + && !stem_l->extent (stem_l, Y_AXIS).empty_b ()) { - o[Y_AXIS] = stem_l->relative_coordinate (common[Y_AXIS], Y_AXIS); // iuhg - o[Y_AXIS] += stem_l->extent (Y_AXIS)[dir]; + o[Y_AXIS] = stem_l->extent (common[Y_AXIS], Y_AXIS)[dir]; } else { - o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS); // ugh - o[Y_AXIS] += col->extent (Y_AXIS)[dir]; + o[Y_AXIS] = col->extent (common[Y_AXIS], Y_AXIS)[dir]; } /* diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 43ef9b974a..a1f329fc37 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -128,7 +128,7 @@ Spacing_spanner::do_measure (Score_element*me, Link_array cols) } else { - Interval ext (rc->extent (X_AXIS)); + Interval ext (rc->extent (rc, X_AXIS)); right_dist = ext.empty_b() ? 0.0 : - ext [LEFT]; } @@ -186,7 +186,7 @@ Real Spacing_spanner::default_bar_spacing (Score_element*me, Score_element *lc, Score_element *rc, Moment shortest) { - Real symbol_distance = lc->extent (X_AXIS)[RIGHT] ; + Real symbol_distance = lc->extent (lc,X_AXIS)[RIGHT] ; Real durational_distance = 0; Moment delta_t = Paper_column::when_mom (rc) - Paper_column::when_mom (lc); diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc index 7f628c3c4b..5ae4d1295d 100644 --- a/lily/span-arpeggio-engraver.cc +++ b/lily/span-arpeggio-engraver.cc @@ -17,7 +17,6 @@ /** - Make arpeggios that span multiple staffs. Catch arpeggios, and span a Span_arpeggio over them if we find more than two arpeggios. */ @@ -56,22 +55,19 @@ Span_arpeggio_engraver::acknowledge_element (Score_element_info info) void Span_arpeggio_engraver::process_acknowledged () { + /* + connectArpeggios is slightly brusque; we should really read a elt + property of the caught non-span arpeggios. That way, we can have + + both non-connected and connected arps in one pianostaff. + + + */ if (!span_arpeggio_ && arpeggios_.size () > 1 && to_boolean (get_property ("connectArpeggios"))) { - span_arpeggio_ = new Item (get_property ("SpanArpeggio")); - span_arpeggio_->set_parent (arpeggios_[0], Y_AXIS); - Side_position::set_axis (span_arpeggio_, X_AXIS); - Side_position::set_direction (span_arpeggio_, LEFT); - Staff_symbol_referencer::set_interface (span_arpeggio_); - 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]); - } - - announce_element (span_arpeggio_, 0); + span_arpeggio_ = new Item (get_property ("Arpeggio")); + announce_element (span_arpeggio_, 0); } } @@ -80,6 +76,26 @@ Span_arpeggio_engraver::do_pre_move_processing () { if (span_arpeggio_) { + /* + we do this very late, to make sure we also catch `extra' + side-pos support like accidentals. + */ + for (int i=0; i < arpeggios_.size (); i ++) + { + for (SCM s = arpeggios_[i]->get_elt_property ("stems"); + gh_pair_p (s); s = gh_cdr (s)) + Group_interface::add_thing (span_arpeggio_, "stems", gh_car (s)); + for (SCM s = arpeggios_[i]->get_elt_property ("side-support-elements"); + gh_pair_p (s); s = gh_cdr (s)) + Group_interface::add_thing (span_arpeggio_, "side-support-elements", gh_car (s)); + + /* + we can't kill the children, since we don't want to the + previous note to bump into the span arpeggio; so we make + it transparent. */ + arpeggios_[i]->set_elt_property ("molecule-callback", SCM_BOOL_T); + } + typeset_element (span_arpeggio_); span_arpeggio_ = 0; } diff --git a/lily/span-arpeggio.cc b/lily/span-arpeggio.cc index d55c4848c7..e69de29bb2 100644 --- a/lily/span-arpeggio.cc +++ b/lily/span-arpeggio.cc @@ -1,73 +0,0 @@ -/* - span-arpeggio.cc -- implement Span_arpeggio - - source file of the GNU LilyPond music typesetter - - (c) 2000 Jan Nieuwenhuizen -*/ - -#include - -#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 = common->common_refpoint (arpeggio, Y_AXIS); - } - 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 = arpeggio->relative_coordinate (common, Y_AXIS); - Interval height = arpeggio->extent (Y_AXIS); - iv.unite (height + c); - } - iv *= 0.5; - - Molecule mol; - Molecule arpeggio = me->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio"); - Real staff_space = Staff_symbol_referencer::staff_space (me); - for (int i = (int)iv[MIN]/ 2; i < (int)(iv[MAX] - 1)/ 2; i++) - { - Molecule a (arpeggio); - a.translate_axis (i * staff_space, Y_AXIS); - mol.add_molecule (a); - } - /* - urg? - */ - Real dy = -(int)me->relative_coordinate (common, Y_AXIS); - dy += iv.length () / 2; - dy /= staff_space; - dy = staff_space * rint (dy); - mol.translate (Offset (0, dy)); - - return mol.create_scheme (); -} - diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 189b54ff99..533bf5298a 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -20,8 +20,7 @@ void Span_bar::add_bar (Score_element*me, Score_element*b) { - Pointer_group_interface gi (me); - gi.add_element (b); + Pointer_group_interface::add_element (me,"elements", b); me->add_dependency (b); } diff --git a/lily/spanner.cc b/lily/spanner.cc index 184c253b9c..40d6710d02 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -198,7 +198,7 @@ Spanner::set_bound(Direction d, Score_element*s) */ if (dynamic_cast (i)) { - Pointer_group_interface (i, "bounded-by-me").add_element (this); + Pointer_group_interface::add_element (i, "bounded-by-me",this); } } @@ -286,7 +286,7 @@ Spanner::get_broken_left_end_align () const But that doesn't make a difference, since the Paper_column is likely to contain only a Break_align_item. */ - return sc->extent (X_AXIS)[RIGHT]; + return sc->extent (sc, X_AXIS)[RIGHT]; } return 0.0; diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 2db2edad8a..46d14dcfea 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -126,8 +126,11 @@ Stem_tremolo::brew_molecule (SCM smob) */ Real whole_note_correction; if (Stem::invisible_b (stem )) - whole_note_correction = -Stem::get_direction (stem ) - * Stem::support_head (stem )->extent (X_AXIS).length () / 2; + { + Score_element *hed = Stem::support_head (stem ); + whole_note_correction = -Stem::get_direction (stem ) + *hed->extent (hed, X_AXIS).length () / 2; + } else whole_note_correction = 0; diff --git a/lily/stem.cc b/lily/stem.cc index 58fd950b67..a7fe2500b3 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -150,8 +150,7 @@ Stem::support_head (Score_element*me) int Stem::heads_i (Score_element*me) { - Pointer_group_interface gi (me, "heads"); - return gi.count (); + return Pointer_group_interface::count (me, "heads"); } /* @@ -205,7 +204,7 @@ Stem::add_head (Score_element*me, Score_element *n) if (Note_head::has_interface (n)) { - Pointer_group_interface (me, "heads").add_element (n); + Pointer_group_interface::add_element (me, "heads",n); } else { @@ -334,10 +333,11 @@ Stem::position_noteheads (Score_element*me) heads.reverse (); - Real w = support_head (me)->extent (X_AXIS)[dir]; + Score_element *hed = support_head (me); + Real w = hed->extent (hed, X_AXIS)[dir]; for (int i=0; i < heads.size (); i++) { - heads[i]->translate_axis (w - heads[i]->extent (X_AXIS)[dir], X_AXIS); + heads[i]->translate_axis (w - heads[i]->extent (heads[i], X_AXIS)[dir], X_AXIS); } bool parity= true; // todo: make me settable. @@ -351,7 +351,7 @@ Stem::position_noteheads (Score_element*me) { if (parity) { - Real l = heads[i]->extent (X_AXIS).length (); + Real l = heads[i]->extent (heads[i], X_AXIS).length (); heads[i]->translate_axis (l * get_direction (me), X_AXIS); } parity = !parity; @@ -400,10 +400,7 @@ Stem::set_spacing_hints (Score_element*me) Item* item = dynamic_cast (me); Item * col = item->column_l (); SCM dirlist =col->get_elt_property ("dir-list"); - if (dirlist == SCM_UNDEFINED) - dirlist = SCM_EOL; - - if (scm_sloppy_memq (scmdir, dirlist) == SCM_EOL) + if (scm_sloppy_memq (scmdir, dirlist) == SCM_BOOL_F) { dirlist = gh_cons (scmdir, dirlist); col->set_elt_property ("dir-list", dirlist); @@ -466,8 +463,9 @@ Stem::brew_molecule (SCM smob) Real dy = Staff_symbol_referencer::staff_space (me)/2.0; Real head_wid = 0; - if (support_head (me)) - head_wid = support_head (me)->extent (X_AXIS).length (); + + if (Score_element *hed = support_head (me)) + head_wid = hed->extent (hed,X_AXIS).length (); stem_y[Direction(-d)] += d * head_wid * tan(ANGLE)/(2*dy); if (!invisible_b (me)) @@ -490,14 +488,14 @@ Stem::brew_molecule (SCM smob) MAKE_SCHEME_CALLBACK(Stem,off_callback,2); SCM -Stem::off_callback (SCM element_smob, SCM axis) +Stem::off_callback (SCM element_smob, SCM ) { Score_element *me = unsmob_element (element_smob); - + Real r=0; if (Score_element * f = first_head (me)) { - Interval head_wid(0, f->extent (X_AXIS).length ()); + Interval head_wid(0, f->extent (f,X_AXIS).length ()); if (to_boolean (me->get_elt_property ("stem-centered"))) return gh_double2scm ( head_wid.center ()); diff --git a/lily/syllable-group.cc b/lily/syllable-group.cc index f1438f69f8..66dc8830c4 100644 --- a/lily/syllable-group.cc +++ b/lily/syllable-group.cc @@ -67,9 +67,9 @@ Syllable_group::add_lyric(Score_element * lyric) lyric_list_.push(lyric); /* record longest and shortest lyrics */ if( longest_lyric_l_ ) { - if(lyric->extent(X_AXIS).length() > (longest_lyric_l_->extent(X_AXIS)).length()) + if(lyric->extent(lyric,X_AXIS).length() > (longest_lyric_l_->extent(longest_lyric_l_, X_AXIS)).length()) longest_lyric_l_ = lyric; - if(lyric->extent(X_AXIS).length() < (shortest_lyric_l_->extent(X_AXIS)).length()) + if(lyric->extent(lyric, X_AXIS).length() < (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length()) shortest_lyric_l_ = lyric; } else @@ -90,7 +90,7 @@ Syllable_group::add_extender(Score_element * extender) // Right: Real ss = extender->paper_l ()->get_var ("staffspace"); extender->set_elt_property("right-trim-amount", - gh_double2scm(-notehead_l_->extent(X_AXIS).length()/ss)); + gh_double2scm(-notehead_l_->extent(notehead_l_, X_AXIS).length()/ss)); } } @@ -122,7 +122,7 @@ Syllable_group::set_lyric_align(const char *punc, Score_element *default_notehea lyric->set_parent(notehead_l_, 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); + lyric->translate_axis (group_translation_f_-(notehead_l_->extent(notehead_l_, X_AXIS)).center(), X_AXIS); } } return (notehead_l_); @@ -142,11 +142,11 @@ Syllable_group::amount_to_translate() Real translate = 0.0; if(alignment_i_ != CENTER) { // FIXME: do we really know the lyric extent here? Some font sizing comes later? - if((longest_lyric_l_->extent(X_AXIS)).length() < - (shortest_lyric_l_->extent(X_AXIS)).length() * 2 ) - translate = alignment_i_*(longest_lyric_l_->extent(X_AXIS)).length()/2; - else - translate = alignment_i_*(shortest_lyric_l_->extent(X_AXIS)).length(); + Real l1 = longest_lyric_l_->extent(longest_lyric_l_, X_AXIS).length() / 2; + Real l2 = shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS).length(); + + translate = l1 extent(X_AXIS)).length()/2; + translation += (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length()/2; break; case RIGHT: // move right so smallest lyric is left-aligned on notehead - translation += (shortest_lyric_l_->extent(X_AXIS)).length(); + translation += (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length(); break; } group_translation_f_ += translation; diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index 0a89d2edc4..a6955147cb 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -40,7 +40,7 @@ System_start_delimiter_engraver::acknowledge_element (Score_element_info inf) don't add as Axis_group_interface::add_element (delim_, ), because that would set the parent as well */ - Pointer_group_interface (delim_).add_element (inf.elem_l_); + Pointer_group_interface::add_element (delim_, "elements", inf.elem_l_); } else if (System_start_delimiter::has_interface (inf.elem_l_)) { diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 1263a8d33c..4b658b0a5b 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -96,7 +96,8 @@ Text_spanner::brew_molecule (SCM smob) Real broken_left = spanner->get_broken_left_end_align (); Real width = spanner->spanner_length (); - width += spanner->get_bound (RIGHT)->extent (X_AXIS).length (); + Score_element *bnd = spanner->get_bound (RIGHT); + width += bnd->extent (bnd, X_AXIS).length (); width -= broken_left; width -= shorten[LEFT] + shorten[RIGHT]; width -= edge[LEFT].extent (X_AXIS).length () diff --git a/lily/tie-column.cc b/lily/tie-column.cc index 32d6f4a1ad..4d68c24074 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -33,14 +33,14 @@ Tie_column::has_interface (Score_element*me) void Tie_column::add_tie (Score_element*me,Score_element *s) { - Pointer_group_interface g (me, "ties"); - if (!g.count ()) + + if (! Pointer_group_interface ::count (me, "ties")) { dynamic_cast (me)->set_bound (LEFT, Tie::head (s,LEFT)); dynamic_cast (me)->set_bound (RIGHT, Tie::head (s,RIGHT)); } - Pointer_group_interface (me, "ties").add_element (s); + Pointer_group_interface::add_element (me, "ties",s); s->add_dependency (me); } diff --git a/lily/tie.cc b/lily/tie.cc index f395296288..39bc2306de 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -137,31 +137,29 @@ Tie::get_control_points (SCM smob) Real left_x; if (Note_head::has_interface (me->get_bound (LEFT))) - left_x = l->extent (X_AXIS)[RIGHT] + x_gap_f; + left_x = l->extent (l, X_AXIS)[RIGHT] + x_gap_f; else - left_x = l->extent (X_AXIS).length () / 2; + left_x = l->extent (l, X_AXIS).length () / 2; Real width; if (Note_head::has_interface (me->get_bound (LEFT)) && Note_head::has_interface (me->get_bound (RIGHT))) { - width = r->relative_coordinate (commonx, X_AXIS) - + r->extent (X_AXIS)[LEFT] - - l->relative_coordinate (commonx, X_AXIS) - - l->extent (X_AXIS)[RIGHT] + width = + + r->extent (commonx,X_AXIS)[LEFT] + - l->extent (commonx, X_AXIS)[RIGHT] -2 * x_gap_f; } else { if (Note_head::has_interface (me->get_bound (LEFT))) width = r->relative_coordinate (commonx, X_AXIS) - - l->relative_coordinate (commonx, X_AXIS) - - l->extent (X_AXIS)[RIGHT] + - l->extent (commonx, X_AXIS)[RIGHT] - 2 * x_gap_f; else - width = r->relative_coordinate (commonx, X_AXIS) - - l->extent (X_AXIS).length () / 2 - + r->extent (X_AXIS)[LEFT] + width = + - l->extent (l, X_AXIS).length () / 2 + + r->extent (commonx, X_AXIS)[LEFT] - l->relative_coordinate (commonx, X_AXIS) - 2 * x_gap_f; } @@ -180,7 +178,8 @@ Tie::get_control_points (SCM smob) Offset leave_dir = b.control_[1] - b.control_[0]; - Real dx = (head (me, headdir)->extent (X_AXIS).length () + x_gap_f)/2.0; + Score_element *hed =head (me, headdir); + Real dx = (hed->extent (hed, X_AXIS).length () + x_gap_f)/2.0; Real max_gap = leave_dir[Y_AXIS] * dx / leave_dir[X_AXIS]; /* diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index 9a2e596b7c..b35fb98b65 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -66,7 +66,7 @@ Tuplet_spanner::brew_molecule (SCM smob) Link_array column_arr= Pointer_group_interface__extract_elements (me, (Score_element*)0, "columns"); - Real ncw = column_arr.top ()->extent(X_AXIS).length (); + Real ncw = column_arr.top ()->extent(column_arr.top (), X_AXIS).length (); Real w = dynamic_cast(me)->spanner_length () + ncw; Real staff_space = me->paper_l ()->get_var ("staffspace"); @@ -143,8 +143,8 @@ Tuplet_spanner::calc_position_and_height (Score_element*me,Real *offset, Real * if (l < r) { - *dy = column_arr[r]->extent (Y_AXIS) [d] + column_arr[r]->relative_coordinate (commony, Y_AXIS) - - column_arr[l]->extent (Y_AXIS) [d] - column_arr[l]->relative_coordinate (commony, Y_AXIS); + *dy = column_arr[r]->extent (commony, Y_AXIS) [d] + - column_arr[l]->extent (commony, Y_AXIS) [d] ; } else * dy = 0; @@ -162,8 +162,7 @@ Tuplet_spanner::calc_position_and_height (Score_element*me,Real *offset, Real * for (int i = 0; i < column_arr.size (); i++) { - Real notey = column_arr[i]->extent (Y_AXIS)[d] - + column_arr[i]->relative_coordinate (commony, Y_AXIS) + Real notey = column_arr[i]->extent (commony, Y_AXIS)[d] - me->relative_coordinate (commony, Y_AXIS); Real x = column_arr[i]->relative_coordinate (commonx, X_AXIS) - x0; @@ -182,10 +181,13 @@ Tuplet_spanner::calc_dy (Score_element*me,Real * dy) { Link_array column_arr= Pointer_group_interface__extract_elements (me, (Score_element*)0, "columns"); - + + /* + ugh. refps. + */ Direction d = Directional_element_interface::get (me); - *dy = column_arr.top ()->extent (Y_AXIS) [d] - - column_arr[0]->extent (Y_AXIS) [d]; + *dy = column_arr.top ()->extent (column_arr.top (), Y_AXIS) [d] + - column_arr[0]->extent (column_arr[0], Y_AXIS) [d]; } MAKE_SCHEME_CALLBACK(Tuplet_spanner,after_line_breaking,1); @@ -263,15 +265,13 @@ void Tuplet_spanner::add_beam (Score_element*me, Score_element *b) { me->add_dependency (b); - Pointer_group_interface gi (me, "beams"); - gi.add_element (b); + Pointer_group_interface::add_element (me, "beams",b); } void Tuplet_spanner::add_column (Score_element*me, Item*n) { - Pointer_group_interface gi (me, "columns"); - gi.add_element (n); + Pointer_group_interface::add_element (me, "columns",n); me->add_dependency (n); add_bound_item (dynamic_cast (me), n); diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index 7467464a63..b2b42ac4f5 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -103,9 +103,7 @@ Volta_spanner::brew_molecule (SCM smob) void Volta_spanner::add_bar (Score_element *me, Item* b) { - Pointer_group_interface gi(me, "bars"); - gi.add_element (b); - + Pointer_group_interface::add_element(me, "bars",b); Side_position::add_support (me,b); add_bound_item (dynamic_cast(me), b); } diff --git a/ly/engraver.ly b/ly/engraver.ly index 107f4b101f..d24a5da6f2 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -32,7 +32,6 @@ StaffContext=\translator { \consists "Rest_collision_engraver"; \consists "Local_key_engraver"; \consists "Piano_pedal_engraver"; - \consists "Arpeggio_engraver"; \consistsend "Axis_group_engraver"; @@ -100,6 +99,7 @@ VoiceContext = \translator { Generic_property_list = #generic-voice-properties \consists "Output_property_engraver"; + \consists "Arpeggio_engraver"; \consists "Dynamic_engraver"; % must come before text_engraver. \consists "Text_spanner_engraver"; @@ -440,9 +440,14 @@ ScoreContext = \translator { % staffspace (distances) % Arpeggio = #`( - (interfaces . (arpeggio-interface)) + (interfaces . (arpeggio-interface side-position-interface)) + (X-extent-callback . ,Arpeggio::width_callback) (molecule-callback . ,Arpeggio::brew_molecule) - (name . "arpeggio") + (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) + (X-offset-callbacks . (,Side_position::aligned_side)) + (direction . -1) + (staff-position . 0.0) + (name . "Arpeggio") ) BarLine = #`( (interfaces . (bar-interface staff-bar-interface)) @@ -639,6 +644,8 @@ ScoreContext = \translator { Accidentals = #`( (molecule-callback . ,Local_key_item::brew_molecule) + (X-offset-callbacks . (,Side_position::aligned_side)) + (direction . -1) (left-padding . 0.2) (right-padding . 0.4) (interfaces . (accidentals-interface)) @@ -713,11 +720,8 @@ ScoreContext = \translator { (self-alignment-X . 0) (text . "8") (visibility-lambda . ,begin-of-line-visible) - (X-offset-callbacks . - (,Side_position::centered_on_parent - ,Side_position::aligned_on_self - ,Side_position::aligned_side - )) + (X-offset-callbacks . (,Side_position::centered_on_parent ,Side_position::aligned_on_self)) + (Y-offset-callbacks . (,Side_position::aligned_side)) (molecule-callback . ,Text_item::brew_molecule) (style . "italic") (name . "OctavateEight") @@ -765,11 +769,6 @@ ScoreContext = \translator { (maximum-duration-for-spacing . ,(make-moment 1 8)) (name . "SpacingSpanner") ) - SpanArpeggio = #`( - (interfaces . (span-arpeggio-interface)) - (molecule-callback . ,Span_arpeggio::brew_molecule) - (name . "SpanArpeggio") - ) SpanBar = #`( (interfaces . (bar-interface span-bar-interface)) (break-align-symbol . Staff_bar) diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index c318b7dfef..2ce63ea474 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.3.95 -Entered-date: 11OCT00 +Version: 1.3.96 +Entered-date: 13OKT00 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.95.tar.gz + 1000k lilypond-1.3.96.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.3.95.tar.gz + 1000k lilypond-1.3.96.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index ea06e44e7d..f1cbe8e9ba 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.3.95 +Version: 1.3.96 Release: 1 License: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.95.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.96.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond # Icon: lilypond-icon.gif diff --git a/scripts/mudela-book.py b/scripts/mudela-book.py index fa2ec8706e..587a514b06 100644 --- a/scripts/mudela-book.py +++ b/scripts/mudela-book.py @@ -1,8 +1,25 @@ #!@PYTHON@ # vim: set noexpandtab: # TODO: -# * Figure out clean set of options. Hmm, isn't it pretty ok now? +# * Figure out clean set of options. # * add support for .lilyrc +# * %\def\preMudelaExample should be ignored by mudela-book because +# it is commented out +# * if you run mudela-book once with --no-pictures, and then again +# without the option, then the pngs will not be created. You have +# to delete the generated .ly files and rerun mudela-book. +# * kontroller hvordan det skannes etter preMudelaExample i preamble +# det ser ut til at \usepackage{graphics} legges til bare hvis +# preMudelaExample ikke finnes. +# * add suppoert for @c comments. Check that preamble scanning works after this. + +# * in LaTeX, commenting out blocks like this +# %\begin{mudela} +# %c d e +# %\end{mudela} works as expected. +# * \usepackage{landscape} is gone. Convince me it is really neede to get it back. +# * We are calculating more of the linewidths, for example 2 col from 1 col. + # This is was the idea for handling of comments: @@ -351,11 +368,15 @@ output_dict= { } } -def output_verbatim (body): +def output_verbatim (body):#ugh .format if __main__.format == 'texi': body = re.sub ('([@{}])', '@\\1', body) return get_output ('output-verbatim') % body +def output_mbverbatim (body):#ugh .format + if __main__.format == 'texi': + body = re.sub ('([@{}])', '@\\1', body) + return get_output ('output-verbatim') % body re_dict = { 'latex': {'input': r'(?m)^[^%\n]*?(?P\\mbinput{?([^}\t \n}]*))', @@ -386,11 +407,13 @@ re_dict = { 'landscape': no_match, 'verbatim': r"""(?s)(?P@example\s.*?@end example\s)""", 'verb': r"""(?P@code{.*?})""", - 'mudela-file': '(?m)^(?!@c)(?P@mudelafile(\[(?P.*?)\])?{(?P[^}]+)})', + 'mudela-file': '(?P@mudelafile(\[(?P.*?)\])?{(?P[^}]+)})', 'mudela' : '(?m)^(?!@c)(?P@mudela(\[(?P.*?)\])?{(?P.*?)})', + #ugh add check for @c 'mudela-block': r"""(?m)^(?!@c)(?P(?s)(?P@mudela(\[(?P.*?)\])?\s(?P.*?)@end mudela\s))""", 'option-sep' : ', *', 'intertext': r',?\s*intertext=\".*?\"', + #ugh fix 'multiline-comment': r"(?sm)^\s*(?!@c\s+)(?P@ignore\s.*?@end ignore)\s", 'singleline-comment': r"(?m)^.*?(?P(?P@c.*$\n+))", 'numcols': no_match, @@ -551,24 +574,16 @@ def scan_latex_preamble(chunks): paperguru.set_geo_option(k, o[k]) idx = idx + 1 -def scan_texi_preamble (chunks): - # this is not bulletproof..., it checks the first 10 chunks - idx = 0 - while 1: - if chunks[idx][0] == 'input': - if string.find(chunks[idx][1], "@afourpaper") != -1: - paperguru.m_papersize = 'a4' - elif string.find(chunks[idx][1], "@afourwide") != -1: - paperguru.m_papersize = 'a4wide' - elif string.find(chunks[idx][1], "@smallbook") != -1: - paperguru.m_papersize = 'smallbook' - idx = idx + 1 - if idx == 10 or idx == len(chunks): - break - def scan_preamble (chunks): if __main__.format == 'texi': - scan_texi_preamble(chunks) + #ugh has to be fixed when @c comments are implemented + # also the searching here is far from bullet proof. + if string.find(chunks[0][1], "@afourpaper") != -1: + paperguru.m_papersize = 'a4' + elif string.find(chunks[0][1], "@afourwide") != -1: + paperguru.m_papersize = 'a4wide' + elif string.find(chunks[0][1], "@smallbook") != -1: + paperguru.m_papersize = 'smallbook' else: assert __main__.format == 'latex' scan_latex_preamble(chunks) @@ -664,6 +679,17 @@ def make_mudela_block(m): else: options = [] options = filter(lambda s: s != '', options) + if 'mbverbatim' in options:#ugh this is ugly and only for texi format + s = m.group() + im = get_re('intertext').search(s) + if im: + s = s[:im.start()] + s[im.end():] + im = re.search('mbverbatim', s) + if im: + s = s[:im.start()] + s[im.end():] + if s[:9] == "@mudela[]": + s = "@mudela" + s[9:] + return [('mudela', m.group('code'), options, s)] return [('mudela', m.group('code'), options)] def do_columns(m): @@ -741,7 +767,11 @@ def schedule_mudela_block (chunk): TODO has format [basename, extension, extension, ... ] """ - (type, body, opts) = chunk + if len(chunk) == 3: + (type, body, opts) = chunk + complete_body = None + else:# mbverbatim + (type, body, opts, complete_body) = chunk assert type == 'mudela' file_body = compose_full_body (body, opts) basename = `abs(hash (file_body))` @@ -754,6 +784,7 @@ def schedule_mudela_block (chunk): else: taken_file_names[basename] = taken_file_names[basename] + 1 basename = basename + "-%i" % taken_file_names[basename] + # writes the file if necessary, returns true if it was written if not g_read_lys: update_file(file_body, os.path.join(g_outdir, basename) + '.ly') needed_filetypes = ['tex'] @@ -764,24 +795,18 @@ def schedule_mudela_block (chunk): if 'eps' in opts and not ('eps' in needed_filetypes): needed_filetypes.append('eps') outname = os.path.join(g_outdir, basename) - def f(base, ext1, ext2): - a = os.path.isfile(base + ext2) - if (os.path.isfile(base + ext1) and - os.path.isfile(base + ext2) and - os.stat(base+ext1)[stat.ST_MTIME] > - os.stat(base+ext2)[stat.ST_MTIME]) or \ - not os.path.isfile(base + ext2): - return 1 - todo = [] - if 'tex' in needed_filetypes and f(outname, '.ly', '.tex'): - todo.append('tex') - if 'eps' in needed_filetypes and f(outname, '.tex', '.eps'): - todo.append('eps') - if 'png' in needed_filetypes and f(outname, '.eps', '.png'): - todo.append('png') + if not os.path.isfile(outname + '.tex') \ + or os.stat(outname+'.ly')[stat.ST_MTIME] > \ + os.stat(outname+'.tex')[stat.ST_MTIME]: + todo = needed_filetypes + else: + todo = [] + newbody = '' if 'verbatim' in opts: newbody = output_verbatim (body) + elif 'mbverbatim' in opts: + newbody = output_mbverbatim (complete_body) for o in opts: m = re.search ('intertext="(.*?)"', o) -- 2.39.2