From 8ecd09ad7514d57630fb611d38c161f3c3c708db Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 22 Oct 2000 01:09:39 +0200 Subject: [PATCH] patch::: 1.3.96.jcn9 1.3.96.jcn9 --- CHANGES | 39 +- Documentation/user/mudela-book.tely | 8 +- NEWS | 2 +- VERSION | 2 +- input/test/american-chords.ly | 7 +- input/test/chord-names.ly | 5 +- input/test/chords.ly | 2 +- input/test/jazz-chords.ly | 16 +- lily/align-interface.cc | 4 +- lily/bar.cc | 4 +- lily/dynamic-engraver.cc | 3 +- lily/dynamic-performer.cc | 2 +- lily/include/align-interface.hh | 38 -- lily/include/arpeggio.hh | 4 - lily/include/axis-group-interface.hh | 8 - lily/include/beam.hh | 42 -- lily/include/break-align-item.hh | 9 - lily/include/clef.hh | 12 - lily/include/collision.hh | 13 - lily/include/crescendo.hh | 4 +- lily/include/dots.hh | 12 +- lily/include/grace-align-item.hh | 4 - lily/include/hyphen-spanner.hh | 21 - lily/include/key-item.hh | 6 +- lily/include/ly-smobs.icc | 15 + lily/include/lyric-extender.hh | 16 +- lily/include/multi-measure-rest.hh | 10 - lily/include/musical-request.hh | 11 - lily/include/note-head.hh | 2 - lily/include/paper-column.hh | 11 - lily/include/rest.hh | 9 - lily/include/rhythmic-head.hh | 12 - lily/include/side-position-interface.hh | 23 +- lily/include/slur.hh | 30 -- lily/include/smobs.hh | 1 + lily/include/spaceable-element.hh | 9 - lily/include/spacing-spanner.hh | 23 - lily/include/span-bar.hh | 4 - lily/include/staff-symbol.hh | 3 - lily/include/stem-tremolo.hh | 3 - lily/include/tie.hh | 3 - lily/include/volta-spanner.hh | 11 +- lily/lyric-engraver.cc | 2 +- lily/lyric-performer.cc | 7 +- lily/mark-engraver.cc | 3 +- lily/moment.cc | 3 +- lily/musical-request.cc | 3 +- lily/my-lily-lexer.cc | 1 + lily/parser.yy | 22 +- lily/property-engraver.cc | 5 +- lily/score-element.cc | 19 +- lily/spaceable-element.cc | 1 + lily/span-arpeggio-engraver.cc | 1 - lily/text-engraver.cc | 2 +- lily/text-spanner.cc | 19 +- lily/tie-column.cc | 4 +- lily/translator-group.cc | 42 ++ ly/chord-modifiers.ly | 7 - ly/declarations.ly | 15 +- ly/engraver.ly | 629 +----------------------- ly/generate-documentation.ly | 2 + scm/basic-properties.scm | 3 +- scm/chord-names.scm | 121 +++-- scm/element-descriptions.scm | 569 +++++++++++++++++++++ scm/font.scm | 7 +- scm/generate-documentation.scm | 111 +++++ scm/interface.scm | 606 +++++++++++++++++++++++ scm/lily.scm | 20 +- scm/slur.scm | 19 +- scripts/etf2ly.py | 8 +- scripts/mudela-book.py | 95 ++-- 71 files changed, 1604 insertions(+), 1205 deletions(-) create mode 100644 ly/generate-documentation.ly create mode 100644 scm/element-descriptions.scm create mode 100644 scm/generate-documentation.scm create mode 100644 scm/interface.scm diff --git a/CHANGES b/CHANGES index f84b624f13..7f4589422d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,38 +1,47 @@ -1.3.96.jcn7 +1.3.96.jcn9 =========== -* Junked all old style text lookups, except for feta definitions. +* Moved Text_script_req's text_ member into mus-property. -1.3.96.jcn6 -=========== +* Renamed ChordName to ChordNames, for consistancy. -* Added support for name-based character lookups. +* Resurrected most of chord names, superscripting and kerning + is currently broken, though. -1.3.96.jcn5 +1.3.96.jcn7 =========== -* Added support for font styles and papersize style sheets. +* Junked all old style text lookups, except for feta definitions. -1.3.96.jcn4 -=========== +* Added support for name-based character lookups. + +* Added support for font styles and papersize style sheets. * Added new code for font selection and scm text markup. Only used for testing in \textscript SCM. See input/test/markup.ly. -1.3.96.jcn3 -=========== - * Fixed (added actually, it got lost?) word-space for chords. -1.3.96.jcn1 -=========== - * Added slope-limit and attachment-offset properties to slur. * Slur's broken trend now weighs in the number of note-columns. * Spacing tweaks: +1.3.96.hwn1 +=========== + +* Mudela-book fixes (Tom Cato Amundsen) + +* Put marks above chords. + +* Solaris fix. + +* Type checking for \push and \pop; elt property description (docs +inclusive) is now in Scheme. Preliminary auto-documentation in +ly/generate-documentation.ly + + 1.3.95.jcn5 =========== diff --git a/Documentation/user/mudela-book.tely b/Documentation/user/mudela-book.tely index b135ca2f90..ae77afe0d2 100644 --- a/Documentation/user/mudela-book.tely +++ b/Documentation/user/mudela-book.tely @@ -318,6 +318,9 @@ TeXinfo input will be written to a file with ext @file{.texi}. So be careful, don't give the source file that ext, or the file will be overwritten. +If you use @code{--outdir}, you should also @code{cd} to that directory +before running LaTeX or makeinfo. + @strong{[UGH: IS THIS THE BEST WAY TO DO IT. MAYBE ADD A COMMENT LINE TO THE GENERATED FILE, SO MUDELA-BOOK CAN TEST IF THE FILE IT IS TO OVERWRITE IS GENERATED.]} @@ -395,11 +398,6 @@ 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/NEWS b/NEWS index a35ea96679..de0d3f6cf1 100644 --- a/NEWS +++ b/NEWS @@ -15,7 +15,7 @@ internals: LilyPond is smaller, cleaner, more flexible, etc. - Improved robustness: Lily almost never crashes. -* Piano pedal support +* Piano pedal support, Arpeggios * MIDI: dynamics, tempo changes diff --git a/VERSION b/VERSION index bcd827905b..8a957f0f5c 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=96 -MY_PATCH_LEVEL=jcn8 +MY_PATCH_LEVEL=jcn9 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/test/american-chords.ly b/input/test/american-chords.ly index 91f6238088..bc20a85f4c 100644 --- a/input/test/american-chords.ly +++ b/input/test/american-chords.ly @@ -1,3 +1,4 @@ +\version "1.3.96" %{ See scm/chord-names.scm: chord::names-alist-american James Hammons @@ -13,7 +14,7 @@ chord::names-alist-american)) chord = \notes\transpose c''\chords{ - \property ChordNames.ChordName \push #'style = #"american" + \property ChordNames.ChordNames \push #'style = #"american" c cs:m df:m5- @@ -47,8 +48,8 @@ c:m7.9 \paper { \translator { - \ChordNameContext - ChordName \push #'word-space = #1 + \ChordNamesContext + ChordNames \push #'word-space = #1 } } } diff --git a/input/test/chord-names.ly b/input/test/chord-names.ly index 76a0246148..940999a4b4 100644 --- a/input/test/chord-names.ly +++ b/input/test/chord-names.ly @@ -1,3 +1,4 @@ +\version "1.3.96" chord = \notes\transpose c''\chords{ c1 c:m @@ -21,8 +22,8 @@ chord = \notes\transpose c''\chords{ \paper{ linewidth = -1.0; \translator { - \ChordNameContext - ChordName \push #'word-space = #1 + \ChordNamesContext + ChordNames \push #'word-space = #1 } } } diff --git a/input/test/chords.ly b/input/test/chords.ly index c5b31dcfb5..76e1ca7395 100644 --- a/input/test/chords.ly +++ b/input/test/chords.ly @@ -1,4 +1,4 @@ -\version "1.3.96"; +\version "1.3.97"; %{ Would this be acceptable/good enough/convenient for entry? diff --git a/input/test/jazz-chords.ly b/input/test/jazz-chords.ly index 731a360f1e..44d35bc008 100644 --- a/input/test/jazz-chords.ly +++ b/input/test/jazz-chords.ly @@ -1,3 +1,4 @@ +\version "1.3.96" %% This should only be necessary if your kpathsea setup is broken %% %% Make sure the correct msamxx.tfm is where lily can find it @@ -13,19 +14,18 @@ ;; any changes here, see scm/chord-names.scm - ;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (("o7" (type . "super")))) + ;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super "o7")) ;jazz: the delta, see jazz-chords.ly - (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (("N" (type . "super") (style . "msam") (size . -3)))) + (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((family . "math") "N"))) - ;(((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (("x7" (type . "super")))) + ;(((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (super "x7")) ; slashed o - (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (("o" (type . "super")) ("/" (size . -2) (offset . (-0.58 . 0.5))) ("7" (type . "super")))) - + (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows (super "o") ((kern . -0.5) ((size . "-3") "/")) "7")) ) chord::names-alist-american)) chord = \notes\transpose c''\chords{ - \property ChordNames.ChordName \push #'style = #"american" + \property ChordNames.ChordNames \push #'style = #"american" c:m5-.7- c:m5-.7 } @@ -38,8 +38,8 @@ chord = \notes\transpose c''\chords{ \paper { \translator { - \ChordNameContext - ChordName \push #'word-space = #1 + \ChordNamesContext + ChordNames \push #'word-space = #1 } } } diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 12c8683d78..ef4fc214bd 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -21,9 +21,9 @@ MAKE_SCHEME_CALLBACK(Align_interface,alignment_callback,2); SCM Align_interface::alignment_callback (SCM element_smob, SCM axis) { - Score_element * sun = unsmob_element (element_smob); + Score_element * me = unsmob_element (element_smob); Axis ax = (Axis )gh_scm2int (axis); - Score_element * par = sun->parent_l (ax); + Score_element * par = me->parent_l (ax); if (par && !to_boolean (par->get_elt_property ("alignment-done"))) { Align_interface::do_side_processing (par, ax); diff --git a/lily/bar.cc b/lily/bar.cc index 63b2632560..4192fd0780 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -178,13 +178,13 @@ Bar::before_line_breaking (SCM smob) void Bar::set_interface (Score_element*me) { - me->set_interface (ly_symbol2scm ("bar-interface")); + me->set_interface (ly_symbol2scm ("bar-line-interface")); } bool Bar::has_interface (Score_element*m) { - return m && m->has_interface (ly_symbol2scm ("bar-interface")); + return m && m->has_interface (ly_symbol2scm ("bar-line-interface")); } diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 2a7ca06770..0da8f321c6 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -182,7 +182,8 @@ Dynamic_engraver::do_process_music () if (script_req_l_) { script_p_ = new Item (get_property ("DynamicText")); - script_p_->set_elt_property ("text", script_req_l_->text_); + script_p_->set_elt_property ("text", + script_req_l_->get_mus_property ("text")); if (Direction d = script_req_l_->get_direction ()) Directional_element_interface::set (line_spanner_, d); diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc index f3f60b9483..92e53acd49 100644 --- a/lily/dynamic-performer.cc +++ b/lily/dynamic-performer.cc @@ -61,7 +61,7 @@ Dynamic_performer::do_process_music () if (gh_procedure_p (proc)) { // urg - svolume = gh_call1 (proc, script_req_l_->text_); + svolume = gh_call1 (proc, script_req_l_->get_mus_property ("text")); } Real volume = 0.5; diff --git a/lily/include/align-interface.hh b/lily/include/align-interface.hh index 924ca2dec3..904f20202a 100644 --- a/lily/include/align-interface.hh +++ b/lily/include/align-interface.hh @@ -14,44 +14,6 @@ #include "lily-proto.hh" #include "lily-guile.hh" - -/* - Order elements top to bottom/left to right/right to left etc. - - - ******* - - element properties - - stacking-dir -- stack contents of elements in which direction ? - - align-dir -- Which side to align? -1: left side, 0: centered (around - center_l_ if not nil, or around center of width), 1: right side - - threshold -- (cons MIN MAX), where MIN and MAX are dimensions in - staffspace - - alignment-done -- boolean to administrate whether we've done the alignment already (to ensure that the process is done only once) - - center-element -- element which will be at the center of the group - after aligning (when using - Align_interface::center_on_element). The center element should - have this object as a reference point. - - elements -- to be aligned elements - - axes -- list of axis numbers. Should contain only one number. - - ******* - - Reads the following from its elements - - - minimum-space -- (cons LEFT RIGHT) - - extra-space -- (cons LEFT RIGHT) - -*/ struct Align_interface { DECLARE_SCHEME_CALLBACK(alignment_callback, (SCM element, SCM axis)); static void do_side_processing (Score_element*,Axis a); diff --git a/lily/include/arpeggio.hh b/lily/include/arpeggio.hh index 08c5a98c68..d912c49615 100644 --- a/lily/include/arpeggio.hh +++ b/lily/include/arpeggio.hh @@ -11,11 +11,7 @@ #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: diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh index 258ff65dc4..3c4676b989 100644 --- a/lily/include/axis-group-interface.hh +++ b/lily/include/axis-group-interface.hh @@ -17,14 +17,6 @@ added to ELT_L_ to ELT_L_. Properties: - - axes -- list of axis (number) in which this group works - - transparent -- an Axis_group is transparent by default - - elements -- contains list of pointers to other elements - - interfaces -- Axis_group is added to this list. */ struct Axis_group_interface { diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 11bc3d3704..ba926a0972 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -12,48 +12,6 @@ -/** a beam connects multiple stems. - - Beam adjusts the stems its owns to make sure that they reach the - beam and that point in the correct direction (urg?) - - elt_properties: - - y-position -- real (position of left edge) - - height -- real (dy) - - - Read-only - ========= - - flag-width-function -- - - damping -- amount of beam slope damping. (int) - should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams - - default-neutral-direction -- which direction to choose if we're in - the middle of the staff - - thickness -- weight of beams, in staffspace - - space-function -- function of type multiplicity -> real (in staffspace) - - beamed-stem-shorten -- - - height-quants -- - - vertical-position-quant-function -- - - dir-function -- - - damping -- damping factor (real). - - outer-stem-length-limit -- catch suspect beam slopes, set slope to zero if - outer stem is lengthened more than this (in staffspace) - - slope-limit -- set slope to zero if slope is running away steeper than this. -*/ class Beam { public: diff --git a/lily/include/break-align-item.hh b/lily/include/break-align-item.hh index 3e9d0d6c1d..75d65e7ace 100644 --- a/lily/include/break-align-item.hh +++ b/lily/include/break-align-item.hh @@ -12,15 +12,6 @@ #include "item.hh" -/** - align breakable items (clef, bar, etc.) - - Properties: - - break-align-symbol -- the index in the spacing table (symbol) of - the to be aligned item. - -*/ class Break_align_interface { public: diff --git a/lily/include/clef.hh b/lily/include/clef.hh index bd59e6ee1d..e5308818df 100644 --- a/lily/include/clef.hh +++ b/lily/include/clef.hh @@ -12,18 +12,6 @@ #include "lily-guile.hh" #include "lily-proto.hh" -/** - Set a clef in a staff. - - properties: - - non-default -- not set because of existence of a bar? - - change -- is this a change clef (smaller size)? - - glyph -- a string determining what glyph is typeset - - */ struct Clef { DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM )); diff --git a/lily/include/collision.hh b/lily/include/collision.hh index d700f5a34a..483ad4bff1 100644 --- a/lily/include/collision.hh +++ b/lily/include/collision.hh @@ -24,19 +24,6 @@ * Make interface of this, similar to align-interface. - Properties: - - elements -- (see Axis_group_interface) - - merge-differently-dotted -- merge black noteheads with differing dot count. - - horizontal-shift -- integer that identifies ranking of note-column for horizontal shifting. - - force-hshift -- amount of collision_note_width that overides automatic collision settings. - Read and removed from elements. - - note-width -- unit for horizontal translation, measured in staff-space. - */ class Collision // interface { diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh index 0fe05d8396..c487894bc2 100644 --- a/lily/include/crescendo.hh +++ b/lily/include/crescendo.hh @@ -12,9 +12,7 @@ #include "lily-guile.hh" /** - The hairpin symbol. (cresc) - - (normal spanner?) + The hairpin symbol. */ struct Crescendo { diff --git a/lily/include/dots.hh b/lily/include/dots.hh index ea4ce9be63..075bf3fdc7 100644 --- a/lily/include/dots.hh +++ b/lily/include/dots.hh @@ -15,17 +15,7 @@ -/** - The dots to go with a notehead/rest. A separate class, since they - are a party in collision resolution. - - properties: - - dot-count -- number of dots. - - - */ -class Dots // interface +class Dots { public: DECLARE_SCHEME_CALLBACK(quantised_position_callback, (SCM element, SCM axis)); diff --git a/lily/include/grace-align-item.hh b/lily/include/grace-align-item.hh index 812a442e29..e367a4dbc8 100644 --- a/lily/include/grace-align-item.hh +++ b/lily/include/grace-align-item.hh @@ -14,10 +14,6 @@ #include "lily-guile.hh" #include "lily-proto.hh" -/* - horizontal-space -- amount of space to add after a note (in staff-space) - */ - class Grace_align_item { public: diff --git a/lily/include/hyphen-spanner.hh b/lily/include/hyphen-spanner.hh index fba4ed4c26..8d8b90f483 100644 --- a/lily/include/hyphen-spanner.hh +++ b/lily/include/hyphen-spanner.hh @@ -9,27 +9,6 @@ #include "spanner.hh" -/** - centred hyphen - - A centred hyphen is a simple line between lyrics used to - divide syllables. - - The length of the hyphen line should stretch based on the - size of the gap between syllables. - -properties: - - thickness -- thickness of line (in stafflinethickness) - - height -- vertical offset (in staffspace) - - minimum-length -- try to make the hyphens at least this long. Also works - as a scaling parameter for the length - - word-space -- elongate left by this much (FIXME: cumbersome semantics) - - */ struct Hyphen_spanner { public: diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index 706f65530f..3f48ff410d 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -11,15 +11,11 @@ #include "lily-proto.hh" /** - A group of accidentals. - Properties: - c0-position -- integer indicating the position of central C? + Properties: - old-accidentals -- list of (pitch, accidental) pairs - new-accidentals -- list of (pitch, accidental) pairs */ struct Key_item { diff --git a/lily/include/ly-smobs.icc b/lily/include/ly-smobs.icc index 0bcb9d2e8d..902f8c507f 100644 --- a/lily/include/ly-smobs.icc +++ b/lily/include/ly-smobs.icc @@ -20,6 +20,12 @@ unsmob_ ## name ( SCM s) \ return CL::unsmob (s); \ } +#define IMPLEMENT_TYPE_P(CL, FUNCNAME)\ +void init_type_p_ ## CL ()\ +{\ + scm_make_gsubr (FUNCNAME, 1, 0, 0, (Scheme_function_unknown) CL::smob_p);\ +}\ +ADD_SCM_INIT_FUNC(init_type_p_ ## CL, init_type_p_ ## CL) #ifndef SCM_CELL_TYPE #define SCM_CELL_TYPE(X) SCM_CAR(X) @@ -32,6 +38,15 @@ return CL::unsmob (s); \ #define IMPLEMENT_SIMPLE_SMOBS(CL) \ long CL::smob_tag_; \ +SCM \ +CL::smob_p (SCM s) \ +{ \ + if (SCM_NIMP(s) && SCM_CELL_TYPE(s) == smob_tag_) \ + return SCM_BOOL_T; \ + else \ + return SCM_BOOL_F; \ + \ +} \ void \ CL::init_smobs () \ { \ diff --git a/lily/include/lyric-extender.hh b/lily/include/lyric-extender.hh index 1204a3befc..a8926002e8 100644 --- a/lily/include/lyric-extender.hh +++ b/lily/include/lyric-extender.hh @@ -10,11 +10,7 @@ #include "spanner.hh" -/** - simple extender line - - The extender is a simple line at the baseline of the lyric - that helps show the length of a melissima (tied/slurred note). +/* Extenders must be entered manually for now. @@ -28,16 +24,10 @@ extend beond, lasting the whole duration of the melissima (as in MUP, urg). - Properties: - - word-space -- - height -- in stafflinethickness + */ - right-trim-amount -- - - */ -class Lyric_extender // interface +class Lyric_extender { public: Spanner*elt_l_; diff --git a/lily/include/multi-measure-rest.hh b/lily/include/multi-measure-rest.hh index d516dbfd96..c53350773d 100644 --- a/lily/include/multi-measure-rest.hh +++ b/lily/include/multi-measure-rest.hh @@ -13,17 +13,7 @@ #include "lily-proto.hh" #include "lily-guile.hh" #include "rod.hh" -/* - properties: - columns -- list of paper-columns - - expand-limit -- int : max number of measures expanded in church rests - - minimum-width -- Real in staffspace - - padding -- staffspace -*/ class Multi_measure_rest { public: diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index c38fd7fee9..5fb7299a69 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -15,8 +15,6 @@ #include "duration.hh" #include "musical-pitch.hh" #include "array.hh" -#include "protected-scm.hh" - /** a request with a duration. This request is used only used as a base class. @@ -52,9 +50,6 @@ struct Tremolo_req : public Request { */ class Lyric_req : public Rhythmic_req { -public: - Protected_scm text_; - protected: VIRTUAL_COPY_CONS (Music); }; @@ -72,9 +67,6 @@ protected: class Text_script_req : public Script_req { -public: - Protected_scm text_; - protected: VIRTUAL_COPY_CONS (Music); virtual bool do_equal_b (Request const*) const; @@ -82,9 +74,6 @@ protected: class Dynamic_script_req : public Script_req { -public: - Protected_scm text_; - protected: VIRTUAL_COPY_CONS (Music); }; diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 6703c443bb..0a2f95efb0 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -15,8 +15,6 @@ NoteHead is a kind of RhythmicHead, see there. Read-only: - - style -- symbol that sets note head style */ class Note_head diff --git a/lily/include/paper-column.hh b/lily/include/paper-column.hh index 5633cb0fb2..cc4778dddd 100644 --- a/lily/include/paper-column.hh +++ b/lily/include/paper-column.hh @@ -14,17 +14,6 @@ #include "rod.hh" #include "spring.hh" -/** - bounded-by-me -- list of elts. - - shortest-starter-duration -- rational signifying shortest moment that starts here - - - Interfaces: - - axis-group, spaceable-element. - */ - class Paper_column : public Item { public: diff --git a/lily/include/rest.hh b/lily/include/rest.hh index 051bdaf989..f623aa3bfe 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -12,15 +12,6 @@ #include "lily-guile.hh" -/** - A pause. - - See also Rhythmic_head, Staff_symbol_referencer. - - Read-only properties: - - style -- string specifying glyph style - */ class Rest { public: diff --git a/lily/include/rhythmic-head.hh b/lily/include/rhythmic-head.hh index 50b1b87187..1c222f873c 100644 --- a/lily/include/rhythmic-head.hh +++ b/lily/include/rhythmic-head.hh @@ -13,18 +13,6 @@ #include "lily-guile.hh" #include "lily-proto.hh" -/* - Properties - - dot -- reference to Dots object. - - stem -- pointer to Stem object - - Read-only - - duration-log -- 2-log of the notehead duration - -*/ class Rhythmic_head { public: diff --git a/lily/include/side-position-interface.hh b/lily/include/side-position-interface.hh index db67e19143..6c9cb6e5ed 100644 --- a/lily/include/side-position-interface.hh +++ b/lily/include/side-position-interface.hh @@ -13,38 +13,17 @@ #include "spanner.hh" #include "item.hh" - - - - /** Position victim object (ELT_L_) next to other objects (the support). side-support -- list of score elements - direction -- where to put the victim object (left or right?) - - side-relative-direction -- if set: get the direction from a different object, and multiply by this. - direction-source -- in case side-relative-direction is set, where - to get the direction + to get the direction - minimum-space -- minimum distance that the victim should move - (after padding) - - padding -- add this much extra space between victim and support - - self-alignment-X -- real number: -1 = left aligned, 0 = center, 1 - right-aligned in X direction. - - Set to an element pointer, if you want that element to be the center. - - self-alignment-Y -- like self-alignment-X but for Y axis - TODO: move out unrelated callbacks. TODO: reduce number of methods. - */ struct Side_position { diff --git a/lily/include/slur.hh b/lily/include/slur.hh index 82f5b9a125..c788b68e0f 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -12,36 +12,6 @@ #include "rod.hh" /** - - de-uglify-parameters -- list of 3 real constants. They define the - valid areas for the middle control points. Used in de_uglyfy. - They are a bit empirical. - - details -- alist containing contaning a few magic constants. - - note-columns -- list of elt pointers to note columns. - - attachment -- cons of symbols, '(LEFT-TYPE . RIGHT-TYPE), where - both types may be alongside-stem, stem, head or loose-end - - direction -- up or down? - - y-free -- ? - - control-points -- - - - - Read-only - ========= - - extremity-rules -- - - extremity-offset-alist -- - - thickness -- - - dash -- number representing the length of the dashes. */ class Slur { diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh index c881c05ad6..3c46977016 100644 --- a/lily/include/smobs.hh +++ b/lily/include/smobs.hh @@ -111,6 +111,7 @@ private:\ public: \ static SCM equal_p (SCM a, SCM b);\ static CL * unsmob (SCM);\ + static SCM smob_p (SCM);\ static void init_smobs(); \ private: diff --git a/lily/include/spaceable-element.hh b/lily/include/spaceable-element.hh index 577f8902e1..03489cd810 100644 --- a/lily/include/spaceable-element.hh +++ b/lily/include/spaceable-element.hh @@ -13,15 +13,6 @@ #include "lily-guile.hh" #include "lily-proto.hh" -/* - properties : - - minimum-distances -- list of rods (ie. (OBJ . DIST) pairs) - - ideal-distances -- (OBJ . (DIST . STRENGTH)) pairs - - dir-list -- list of stem directions. - */ struct Spaceable_element { /// set a minimum distance diff --git a/lily/include/spacing-spanner.hh b/lily/include/spacing-spanner.hh index f0f81dde76..7f678043ee 100644 --- a/lily/include/spacing-spanner.hh +++ b/lily/include/spacing-spanner.hh @@ -12,29 +12,6 @@ #include "spanner.hh" -/** - Read-only properties - - maximum-duration-for-spacing -- rational: space as if a duration of - this type is available in this measure. - - - - Read properties from paper-column - - dir-list -- list of stem directions - - shortest-playing-duration -- duration of the shortest playing in that column. - - shortest-starter-duration -- duration of the shortest notes that starts - exactly in that column. - - contains-grace -- boolean. Used to widen entries for grace notes. - - extra-space -- pair of distances - - stretch-distance -- pair of distances - */ class Spacing_spanner { public: diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index 9b942fada0..880eb0dba0 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -17,10 +17,6 @@ This is a barline that is spanned across other bar lines. This is the implementation of the long barlines that occur in orchestral score and other multi-staff music. - - TODO: Is this usable for other stuff besides barlines? We only have - to span a Score_element. Perhaps this can be used for large time - sigs? */ class Span_bar { diff --git a/lily/include/staff-symbol.hh b/lily/include/staff-symbol.hh index 5bcf6196a7..ce78e12711 100644 --- a/lily/include/staff-symbol.hh +++ b/lily/include/staff-symbol.hh @@ -13,9 +13,6 @@ #include "lily-guile.hh" /** - This spanner draws the lines of a pstaff. - The bottom line is position 0. - TODO: add stafflinethickness as parameter. */ class Staff_symbol diff --git a/lily/include/stem-tremolo.hh b/lily/include/stem-tremolo.hh index 81ef981d10..11fa9dda0c 100644 --- a/lily/include/stem-tremolo.hh +++ b/lily/include/stem-tremolo.hh @@ -13,9 +13,6 @@ #include "lily-proto.hh" #include "lily-guile.hh" -/* - stem -- pointer to the stem object. - */ class Stem_tremolo { public: diff --git a/lily/include/tie.hh b/lily/include/tie.hh index a5553555a9..7155dfbba8 100644 --- a/lily/include/tie.hh +++ b/lily/include/tie.hh @@ -14,9 +14,6 @@ #include "lily-proto.hh" -/* - heads -- pair of element pointers, pointing to the two heads of the - tie. */ class Tie { public: diff --git a/lily/include/volta-spanner.hh b/lily/include/volta-spanner.hh index 6bf3608531..3619fe0e4c 100644 --- a/lily/include/volta-spanner.hh +++ b/lily/include/volta-spanner.hh @@ -10,16 +10,7 @@ #include "spanner.hh" -/** Volta bracket with number - -properties: - -bars -- list of barline ptrs. - -thickness -- in stafflinethickness - -height -- in staffspace - +/** */ class Volta_spanner diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index fe69dea3ed..c0af7c4fd8 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -43,7 +43,7 @@ Lyric_engraver::do_process_music() { text_p_= new Item (get_property ("LyricText")); - text_p_->set_elt_property ("text", req_l_->text_); + text_p_->set_elt_property ("text", req_l_->get_mus_property ("text")); /* We can't reach the notehead where we're centered from here. So diff --git a/lily/lyric-performer.cc b/lily/lyric-performer.cc index 1ba885ff19..4557f43076 100644 --- a/lily/lyric-performer.cc +++ b/lily/lyric-performer.cc @@ -22,11 +22,12 @@ void Lyric_performer::do_process_music () { // FIXME: won't work with fancy lyrics - if (lreq_arr_.size () && gh_string_p (lreq_arr_[0]->text_) - && ly_scm2string (lreq_arr_[0]->text_).length_i ()) + if (lreq_arr_.size () + && gh_string_p (lreq_arr_[0]->get_mus_property ("text")) + && ly_scm2string (lreq_arr_[0]->get_mus_property ("text")).length_i ()) { audio_p_ = new Audio_text (Audio_text::LYRIC, - ly_scm2string (lreq_arr_[0]->text_)); + ly_scm2string (lreq_arr_[0]->get_mus_property ("text"))); Audio_element_info info (audio_p_, lreq_arr_[0]); announce_element (info); } diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index eeada94856..629870d6c3 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -67,7 +67,8 @@ void Mark_engraver::acknowledge_element (Score_element_info inf) { Score_element * s = inf.elem_l_; - if (Staff_symbol::has_interface (s)) + if (Staff_symbol::has_interface (s) + || to_boolean (s->get_elt_property ("invisible-staff"))) { SCM sts = get_property ("staffsFound"); SCM thisstaff = inf.elem_l_->self_scm (); diff --git a/lily/moment.cc b/lily/moment.cc index c3ebbf02c9..ff21fb5ebf 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -15,7 +15,7 @@ IMPLEMENT_UNSMOB(Moment,moment); IMPLEMENT_SIMPLE_SMOBS(Moment); - +IMPLEMENT_TYPE_P (Moment, "moment?"); SCM Moment::mark_smob (SCM) @@ -67,6 +67,7 @@ void init_moments () { scm_make_gsubr ("make-moment", 2 , 0, 0, (Scheme_function_unknown) make_rational); + scm_make_gsubr ("make-moment", 2 , 0, 0, (Scheme_function_unknown) make_rational); } ADD_SCM_INIT_FUNC(moms,init_moments); diff --git a/lily/musical-request.cc b/lily/musical-request.cc index d91e6d35ec..81183d7d29 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -114,7 +114,8 @@ bool Text_script_req::do_equal_b (Request const* r) const { Text_script_req const* t = dynamic_cast (r); - return t && gh_equal_p (text_, t->text_); + return t && gh_equal_p (get_mus_property ("text"), + t->get_mus_property ("text")); } diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index a20e1df14a..1f0033f86f 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -44,6 +44,7 @@ static Keyword_ent the_key_tab[]={ {"denies", DENIES}, {"duration", DURATION}, {"dynamicscript", DYNAMICSCRIPT}, + {"elementdescriptions", ELEMENTDESCRIPTIONS}, {"font", FONT}, {"grace", GRACE}, {"header", HEADER}, diff --git a/lily/parser.yy b/lily/parser.yy index 1ac8e9b9e9..a0fab22726 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -141,6 +141,7 @@ yylex (YYSTYPE *s, void * v_l) %token CM_T %token CONSISTS %token SEQUENTIAL +%token ELEMENTDESCRIPTIONS %token SIMULTANEOUS %token CONSISTSEND %token DENIES @@ -460,6 +461,12 @@ translator_spec_body: | translator_spec_body CONSISTS STRING semicolon { unsmob_translator_def ($$)->add_element ($3); } + | translator_spec_body ELEMENTDESCRIPTIONS embedded_scm { + for (SCM p = $3; gh_pair_p (p); p = gh_cdr (p)) + unsmob_translator_def ($$) + ->add_property_assign (scm_symbol_to_string (gh_caar (p)), gh_cdar (p)); + + } | translator_spec_body CONSISTSEND STRING semicolon { unsmob_translator_def ($$)->add_last_element ( $3); } @@ -1059,13 +1066,13 @@ verbose_request: } | DYNAMICSCRIPT embedded_scm { Dynamic_script_req *d = new Dynamic_script_req; - d->text_ = $2; + d->set_mus_property ("text", $2); d->set_spot (THIS->here_input ()); $$ = d; } | TEXTSCRIPT embedded_scm { Text_script_req *t = new Text_script_req; - t->text_ = $2; + t->set_mus_property ("text", $2); t->set_spot (THIS->here_input ()); $$ = t; } @@ -1232,13 +1239,13 @@ open_request_parens: gen_text_def: embedded_scm { Text_script_req *t = new Text_script_req; - t->text_ = $1; + t->set_mus_property ("text", $1); t->set_spot (THIS->here_input ()); $$ = t; } | string { Text_script_req *t = new Text_script_req; - t->text_ = $1; + t->set_mus_property ("text", $1); t->set_spot (THIS->here_input ()); $$ = t; } @@ -1247,8 +1254,9 @@ gen_text_def: Maybe use Finger_script_request? */ Text_script_req* t = new Text_script_req; - t->text_ = gh_cons (ly_symbol2scm ("finger"), - ly_str02scm (to_str ($1).ch_C ())); + t->set_mus_property ("text", + gh_cons (ly_symbol2scm ("finger"), + ly_str02scm (to_str ($1).ch_C ()))); t->set_spot (THIS->here_input ()); $$ = t; } @@ -1433,7 +1441,7 @@ simple_element: else THIS->pop_spot (); Lyric_req* lreq_p = new Lyric_req; - lreq_p ->text_ = $1; + lreq_p->set_mus_property ("text", $1); lreq_p->duration_ = *$3; lreq_p->set_spot (THIS->here_input()); Simultaneous_music* velt_p = new Request_chord (gh_list (lreq_p->self_scm (), SCM_UNDEFINED)); diff --git a/lily/property-engraver.cc b/lily/property-engraver.cc index 9877b430ec..2b511ff261 100644 --- a/lily/property-engraver.cc +++ b/lily/property-engraver.cc @@ -118,12 +118,13 @@ Property_engraver::apply_properties (SCM p, Score_element *e, Translator_group*o SCM errport = scm_current_error_port (); scm_display (prop_sym, errport); - scm_puts (" is deprecated. Use\n \\property ", errport); + scm_puts (_(" is deprecated. Use\n \\property ").ch_C(), errport); - SCM name = e->get_elt_property ("name"); scm_puts (origin->type_str_.ch_C(), errport); scm_puts (".", errport); + SCM name = e->get_elt_property ("meta"); + name = scm_assoc (ly_symbol2scm ("name"), name); scm_display (name, errport); scm_puts(" \\push #'",errport); scm_display (elt_prop_sym,errport); diff --git a/lily/score-element.cc b/lily/score-element.cc index a19df5c7d0..4a4c59d60d 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -84,6 +84,11 @@ Score_element::Score_element(SCM basicprops) dim_cache_[a].dimension_ = cb; } + + SCM meta = get_elt_property ("meta"); + SCM ifs = scm_assoc (ly_symbol2scm ("interfaces"), meta); + + set_elt_property ("interfaces",gh_cdr (ifs)); } @@ -605,6 +610,9 @@ Score_element::extent (Score_element * refp, Axis a) const else return ext; + if (!gh_pair_p (d->dimension_)) + return ext; + ext = ly_scm2interval (d->dimension_); SCM extra = get_elt_property (a == X_AXIS @@ -675,9 +683,10 @@ Score_element::common_refpoint (SCM elist, Axis a) const String Score_element::name () const { - SCM nm = get_elt_property ("name"); - - return nm == SCM_EOL ? classname (this) :ly_scm2string (nm) ; + SCM meta = get_elt_property ("meta"); + SCM nm = scm_assoc (ly_symbol2scm ("name"), meta); + nm = (gh_pair_p (nm)) ? gh_cdr (nm) : SCM_EOL; + return gh_string_p (nm) ?ly_scm2string (nm) : classname (this); } void @@ -878,7 +887,7 @@ static void init_functions () { interfaces_sym = scm_permanent_object (ly_symbol2scm ("interfaces")); - + scm_make_gsubr ("ly-get-elt-property", 2, 0, 0, (Scheme_function_unknown)ly_get_elt_property); scm_make_gsubr ("ly-set-elt-property", 3, 0, 0, (Scheme_function_unknown)ly_set_elt_property); scm_make_gsubr ("ly-get-spanner-bound", 2 , 0, 0, (Scheme_function_unknown) spanner_get_bound); @@ -906,4 +915,4 @@ Score_element::set_interface (SCM k) ADD_SCM_INIT_FUNC(scoreelt, init_functions); - +IMPLEMENT_TYPE_P(Score_element, "ly-element?"); diff --git a/lily/spaceable-element.cc b/lily/spaceable-element.cc index 37cac89a5e..f2478b56c4 100644 --- a/lily/spaceable-element.cc +++ b/lily/spaceable-element.cc @@ -78,4 +78,5 @@ Spaceable_element::remove_interface (Score_element*me) void Spaceable_element::set_interface (Score_element*me) { + me->set_interface (ly_symbol2scm ("spaceable-element-interface")); } diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc index 5ae4d1295d..d90b51df24 100644 --- a/lily/span-arpeggio-engraver.cc +++ b/lily/span-arpeggio-engraver.cc @@ -10,7 +10,6 @@ #include "lily-guile.hh" #include "item.hh" #include "arpeggio.hh" -#include "span-arpeggio.hh" #include "group-interface.hh" #include "side-position-interface.hh" #include "staff-symbol-referencer.hh" diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index 79113f421e..2322691825 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -126,7 +126,7 @@ Text_engraver::do_process_music () if (r->get_direction ()) Side_position::set_direction (text, r->get_direction ()); - text->set_elt_property ("text", r->text_); + text->set_elt_property ("text", r->get_mus_property ("text")); SCM nonempty = get_property ("textNonEmpty"); if (to_boolean (nonempty)) diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 82d840a5e8..cfd1bd292f 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -18,23 +18,6 @@ #include "staff-symbol-referencer.hh" /* - Generic Text spanner: - - type: "line", "dashed-line", "dotted-line" - edge-text: ("le" . "re") - text-style: "italic" - egde-height: (lh . rh) - - "le"--------------"re" - |^ - |v rh - - fine tuning: - - dash-period - dash-length - line-thickness - TODO: - vertical start / vertical end (fixme-name) | - contination types (vert. star, vert. end) |-> eat volta-spanner @@ -167,7 +150,7 @@ Text_spanner::brew_molecule (SCM smob) if (gh_pair_p (s)) { Direction d = LEFT; - int dir = me->get_elt_property ("direction"); + int dir = to_dir (me->get_elt_property ("direction")); do { Real dy = gh_scm2double (index_cell (s, d)) * - dir; diff --git a/lily/tie-column.cc b/lily/tie-column.cc index 4d68c24074..9da8e66885 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -19,7 +19,7 @@ void Tie_column::set_interface (Score_element*me) { - me->set_interface (ly_symbol2scm ("tie-column")); + me->set_interface (ly_symbol2scm ("tie-column-interface")); me->set_extent_callback (SCM_EOL, X_AXIS); me->set_extent_callback (SCM_EOL, Y_AXIS) ; } @@ -27,7 +27,7 @@ Tie_column::set_interface (Score_element*me) bool Tie_column::has_interface (Score_element*me) { - return me->has_interface (ly_symbol2scm ("tie-column")); + return me->has_interface (ly_symbol2scm ("tie-column-interface")); } void diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 24416817d0..6b735ad953 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -343,9 +343,51 @@ Translator_group::execute_single_pushpop_property (SCM prop, SCM eltprop, SCM va */ if (gh_pair_p (prev) || prev == SCM_EOL) { + bool ok = true; + + SCM errport = scm_current_error_port (); + + SCM meta = scm_assoc (ly_symbol2scm ("meta"), prev); + SCM props = scm_assoc (ly_symbol2scm ("properties"), gh_cdr (meta)); + SCM propdesc = scm_assoc (eltprop, gh_cdr (props)); + if (!gh_pair_p (propdesc)) + { + scm_puts (_("Couldn't find property description for #'").ch_C(),errport); + scm_display (eltprop, errport); + + scm_puts (_(" in element description ").ch_C(),errport); + scm_display (prop, errport); + + scm_puts (_(". Perhaps you made a typing error?\n").ch_C(),errport); + } + else + { + + SCM predicate = gh_cadr (propdesc); + if (gh_call1 (predicate, val) == SCM_BOOL_F) + { + ok = false; + scm_puts (_("Failed typecheck for #'").ch_C (),errport); + scm_display (eltprop,errport); + scm_puts ( _(", value ").ch_C (), errport); + scm_display (val, errport); + scm_puts (_(" must satisfy ").ch_C (), errport); + scm_display (predicate, errport); + scm_puts ("\n", errport); + } + } + + if (ok) + { prev = gh_cons (gh_cons (eltprop, val), prev); set_property (prop, prev); + } } + else + { + // warning here. + } + } else { diff --git a/ly/chord-modifiers.ly b/ly/chord-modifiers.ly index bab60b66f4..673620ddf8 100644 --- a/ly/chord-modifiers.ly +++ b/ly/chord-modifiers.ly @@ -1,10 +1,3 @@ -%{ - chord modifiers -%} - -% UGR -#(eval-string (ly-gulp-file "chord-names.scm")) - % urg! % diff --git a/ly/declarations.ly b/ly/declarations.ly index 230ea0d8b8..b2781c3dd2 100644 --- a/ly/declarations.ly +++ b/ly/declarations.ly @@ -2,20 +2,10 @@ breve = \duration #'( -1 0) longa = \duration #'( -2 0 ) maxima = \duration #'( -3 0 ) - -#(begin - (eval-string (ly-gulp-file "slur.scm")) - (eval-string (ly-gulp-file "font.scm")) - (eval-string (ly-gulp-file "generic-property.scm")) - (eval-string (ly-gulp-file "basic-properties.scm")) - ) - \include "nederlands.ly" % dutch \include "chord-modifiers.ly" \include "script.ly" - - % declarations for standard directions left = -1 right = 1 @@ -25,7 +15,6 @@ start = -1 stop = 1 smaller = -1 bigger = 1 - center=0 break = \penalty -1000000; @@ -34,10 +23,8 @@ nobreak = \penalty 1000000; melisma = \property Staff.melismaBusy = ##t melismaEnd = \property Staff.melismaBusy = ##f - - - papersize = "a4" + \include "engraver.ly" \include "generic-paper.ly" \include "paper20.ly" diff --git a/ly/engraver.ly b/ly/engraver.ly index ee09f7bee8..8d5be1e064 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -165,13 +165,13 @@ GraceContext=\translator { TextScript \push #'font-size = #-1 Slur \push #'font-size = #-1 Accidentals \push #'font-size = #-1 - Beam \push #'beam-thickness = #0.3 - Beam \push #'beam-space-function = #(lambda (x) 0.5) + Beam \push #'thickness = #0.3 + Beam \push #'space-function = #(lambda (x) 0.5) Stem \push #'lengths = #(map (lambda (x) (* 0.8 x)) '(3.5 3.5 3.5 4.5 5.0)) Stem \push #'beamed-lengths = #'(0.0 2.5 2.0 1.5) - Stem \push #'minimum-beamed-lengths + Stem \push #'beamed-minimum-lengths = #(map (lambda (x) (* 0.8 x)) '(0.0 2.5 2.0 1.5)) weAreGraceContext = ##t @@ -280,9 +280,12 @@ ChordNamesContext = \translator { \name ChordNames; Generic_property_list = #generic-chord-staff-properties + \consists "Property_engraver"; \consists "Output_property_engraver"; \accepts "ChordNamesVoice"; + + VerticalAxisGroup \push #'invisible-staff = ##t \consistsend "Axis_group_engraver"; } @@ -429,627 +432,13 @@ ScoreContext = \translator { Time_signature Stanza_number ) - + + + \elementdescriptions #all-element-descriptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: uniform naming.; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - - % - % distances are given in stafflinethickness (thicknesses) and - % staffspace (distances) - % - Arpeggio = #`( - (interfaces . (arpeggio-interface side-position-interface)) - (X-extent-callback . ,Arpeggio::width_callback) - (molecule-callback . ,Arpeggio::brew_molecule) - (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) - (X-offset-callbacks . (,Side_position::aligned_side)) - (right-padding . 0.4) ; Hmm, not generic? - (direction . -1) - (staff-position . 0.0) - (name . "Arpeggio") - ) - BarLine = #`( - (interfaces . (bar-interface staff-bar-interface)) - (break-align-symbol . Staff_bar) - (glyph . "|") - (break-glyph-function . ,default-break-barline) - (barsize-procedure . ,Bar::get_staff_bar_size) - (molecule-callback . ,Bar::brew_molecule) - (visibility-lambda . ,all-visible) - (breakable . #t) - (before-line-breaking-callback . ,Bar::before_line_breaking) - ;; - ;; Ross. page 151 lists other values, we opt for a leaner look - ;; - (kern . 3.0) - (thin-kern . 3.0) - (hair-thickness . 1.6) - (thick-thickness . 6.0) - (name . "BarLine") - ) - - BarNumber = #`( - (molecule-callback . ,Text_item::brew_molecule) - (breakable . #t) - (visibility-lambda . ,begin-of-line-visible) - (padding . 1.0) - (direction . 1) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (font-family . roman) - (name . "BarNumber") - ) - - Beam = #basic-beam-properties - - BreakAlignment = #`( - (breakable . #t) - (interfaces . (break-align-interface)) - (stacking-dir . 1) - (axes 0) - (X-offset-callbacks . (,Break_align_interface::self_align_callback)) - (space-alist . ,default-break-align-space-alist) - (name . "BreakAlignment") - ) - - BreakAlignGroup = #`( - (interfaces . (axis-group-interface)) - (axes . (0)) - (X-offset-callbacks . (,Break_align_interface::alignment_callback)) - - (name . "BreakAlignGroup") - ) - - BreathingSign = #`( - (interfaces . (breathing-sign-interface)) - (break-align-symbol . Breathing_sign) - (breakable . #t ) - (molecule-callback . ,Breathing_sign::brew_molecule) - (Y-offset-callbacks . (,Breathing_sign::offset_callback)) - (visibility-lambda . ,begin-of-line-invisible) - (name . "BreathingSign") - ) - - Clef = #`( - (interfaces . (clef-interface)) - (molecule-callback . ,Score_element::brew_molecule) - (before-line-breaking-callback . ,Clef::before_line_breaking) - (breakable . #t) - (break-align-symbol . Clef_item) - (visibility-lambda . ,begin-of-line-visible) - (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) - (name . "Clef") - ) - - ChordNames = #`( - (molecule-callback . ,Chord_name::brew_molecule) - (interfaces . (chord-name-interface)) - (after-line-breaking-callback . ,Chord_name::after_line_breaking) - (chord-name-function . ,default-chord-name-function) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (font-family . roman) - (name . "ChordNames") - ) - - NoteCollision = #`( - (axes 0 1) - (interfaces . (collision-interface)) - (note-width . 1.65) - (name . "NoteCollision") - ) - - Crescendo = #`( - (molecule-callback . ,Crescendo::brew_molecule) - (interfaces . (crescendo-interface dynamic-interface)) - (thickness . 1.0) - (shorten-for-letter . 4.0) - (height . 0.6666) - (dash-thickness . 1.2) - (dash-length . 4.0) - (name . "Crescendo") - (self-alignment-Y . 0) - (Y-offset-callbacks . (,Side_position::aligned_on_self)) - ) - - DotColumn = #`( - (interfaces . (dot-column-interface axis-group-interface )) - (axes 0 ) - (name . "DotColumn") - ) - - Dots = #`( - (interfaces . (dot-interface)) - (molecule-callback . ,Dots::brew_molecule) - (dot-count . 1) - (staff-position . 0.0) - (Y-offset-callbacks . (,Dots::quantised_position_callback ,Staff_symbol_referencer::callback)) - - (name . "Dots") - ) - - DynamicText = #`( - (interfaces . (dynamic-interface)) - (Y-offset-callbacks . (,Side_position::aligned_on_self)) - (molecule-callback . ,Text_item::brew_molecule) - (font-style . dynamic) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (script-priority . 100) - (self-alignment-Y . 0) - (name . "DynamicText") - ) - - DynamicLineSpanner = #`( - (interfaces . (dynamic-interface axis-group-interface side-position-interface)) - (axes . ( 1)) - (padding . 3) - (minimum-space . 6) - (name . "dynamic alignment") - ) - - LeftEdge = #`( - (break-align-symbol . Left_edge_item) - (breakable . #t) - (name . "LeftEdge") - ) - - Fingering = #`( - (interfaces . (finger-interface text-script-interface text-item-interface side-position-interface)) - (molecule-callback . ,Text_item::brew_molecule) - (padding . 3.0) - (self-alignment-X . 0) - (name . "Fingering") - ) - - GraceAlignment = #`( - (interfaces . (axis-group-interface align-interface)) - (axes . (0)) - (horizontal-space . 1.2) - (padding . 1.0) - (before-line-breaking-callback . ,Grace_align_item::before_line_breaking) - (name . "GraceAlignment") - ) - - HaraKiriVerticalGroup = #`( - (Y-offset-callbacks . (,Hara_kiri_group_spanner::force_hara_kiri_callback)) - (Y-extent-callback . ,Hara_kiri_group_spanner::y_extent) - (interfaces . (hara-kiri-group-interface)) - (axes 1) - (name . "HaraKiriVerticalGroup") - ) - - LyricHyphen = #`( - (interfaces . (lyric-hyphen-interface)) - (thickness . 1.0) - (height . 0.4) - (minimum-length . 0.5) - (molecule-callback . ,Hyphen_spanner::brew_molecule) - (Y-extent-callback . ,Score_element::point_dimension_callback) - (name . "LyricHyphen") - ) - - InstrumentName = #`( - (interfaces . (instrument-name-interface)) - (breakable . #t) - (Y-offset-callbacks . (,Side_position::centered_on_parent)) - (molecule-callback . ,Text_item::brew_molecule) - (break-align-symbol . Instrument_name) - (visibility-lambda . ,begin-of-line-visible) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (font-family . roman) - (name . "InstrumentName") - ) - - KeySignature = #`( - (interfaces . (key-item-interface)) - (molecule-callback . ,Key_item::brew_molecule) - (break-align-symbol . Key_item) - (visibility-lambda . ,begin-of-line-visible) - (breakable . #t) - (name . "KeySignature") - ) - - 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)) - (name . "Accidentals") - ) - - LineOfScore = #`( - (axes . (0 1)) - (interfaces . (axis-group-interface)) - (name . "LineOfScore") - ) - - LyricExtender = #`( - (interfaces . (lyric-extender-interface)) - (molecule-callback . ,Lyric_extender::brew_molecule) - (height . 0.8) ; stafflinethickness; - (right-trim-amount . 0.5) - (Y-extent-callback . ,Score_element::point_dimension_callback) - (name . "LyricExtender") - ) - - LyricText = #`( - (interfaces . (lyric-syllable-interface text-item-interface)) - (molecule-callback . ,Text_item::brew_molecule) - (X-offset-callbacks . (,Side_position::aligned_on_self)) - (self-alignment-X . 0) - (non-rhythmic . #t) - (word-space . 0.6) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (font-family . roman) - (name . "LyricText") - ) - - RehearsalMark = #`( - (interfaces . (mark-interface side-position-interface)) - (molecule-callback . ,Text_item::brew_molecule) - (breakable . #t) - (visibility-lambda . ,end-of-line-invisible) - (padding . 4.0) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (font-style . mark) - (name . "RehearsalMark") - ) - - MultiMeasureRest = #`( - (interfaces . (multi-measure-rest-interface)) - (spacing-procedure . ,Multi_measure_rest::set_spacing_rods) - (molecule-callback . ,Multi_measure_rest::brew_molecule) - (staff-position . 0) - (expand-limit . 10) - (padding . 2.0) ; staffspace - (minimum-width . 12.5) ; staffspace - (name . "MultiMeasureRest") - ) - - NoteColumn = #`( - (interfaces . (axis-group-interface note-column-interface)) - (axes 0 1) - (name . "NoteColumn") - ) - - NoteHead = #`( - (interfaces . (note-head-interface rhythmic-head-interface)) - (style . default) - (molecule-callback . ,Note_head::brew_molecule) - (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) - (name . "NoteHead") - ) - - NoteName = #`( - (molecule-callback . ,Text_item::brew_molecule) - (name . "NoteName") - ) - - OctavateEight = #`( - (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)) - (Y-offset-callbacks . (,Side_position::aligned_side)) - (molecule-callback . ,Text_item::brew_molecule) - (font-shape . "italic") - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (name . "OctavateEight") - ) - - PaperColumn = #`( - (interfaces . (paper-column-interface axis-group-interface)) - (axes 0) - (before-musical-spacing-factor . 0.4) - (name . "PaperColumn") - ) - NonMusicalPaperColumn = #`( - (interfaces . (paper-column-interface axis-group-interface)) - (axes 0) - (before-musical-spacing-factor . 1.0) - (name . "PaperColumn") - ) - - Rest = #`( - (interfaces . (rest-interface rhythmic-head-interface)) - (after-line-breaking-callback . ,Rest::after_line_breaking) - (molecule-callback . ,Rest::brew_molecule) - (minimum-beam-collision-distance . 1.5) - (name . "Rest") - ) - - RestCollision = #`( - (interfaces . (rest-collision-interface)) - (minimum-distance . 0.75) - (name . "RestCollision") - ) - - Script = #`( - (molecule-callback . ,Script::brew_molecule) - (interfaces . (script-interface side-position-interface)) - (X-offset-callbacks . (,Side_position::centered_on_parent)) - (name . "Script") - ) - - ScriptColumn = #`( - (before-line-breaking-callback . ,Script_column::before_line_breaking) - (name . "ScriptColumn") - ) - Slur = #`( - (interfaces . (slur-interface)) - (molecule-callback . ,Slur::brew_molecule) - (thickness . 1.2) - (spacing-procedure . ,Slur::set_spacing_rods) - (minimum-length . 1.5) - (after-line-breaking-callback . ,Slur::after_line_breaking) - (extremity-rules . ,default-slur-extremity-rules) - (extremity-offset-alist . ,default-slur-extremity-offset-alist) - (de-uglify-parameters . ( 1.5 0.8 -2.0)) - (details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5))) - (beautiful . 0.5) - (y-free . 0.75) - (slope-limit . 0.8) - (attachment-offset . ((0 . 0) . (0 . 0))) - (name . "Slur") - ) - - SpacingSpanner =#`( - (spacing-procedure . ,Spacing_spanner::set_springs) - - ;; assume that notes at least this long are present. - (maximum-duration-for-spacing . ,(make-moment 1 8)) - (name . "SpacingSpanner") - ) - SpanBar = #`( - (interfaces . (bar-interface span-bar-interface)) - (break-align-symbol . Staff_bar) - (barsize-procedure . ,Span_bar::get_bar_size) - (molecule-callback . ,Bar::brew_molecule) - (visibility-lambda . ,begin-of-line-invisible) - (X-extent-callback . ,Span_bar::width_callback) - (Y-offset-callbacks . (,Span_bar::center_on_spanned_callback)) - - (breakable . #t) - (glyph . "|") - (before-line-breaking-callback . ,Span_bar::before_line_breaking) - ;; ugh duplication! - - ;; - ;; Ross. page 151 lists other values, we opt for a leaner look - ;; - (kern . 3.0) - (thin-kern . 3.0) - (hair-thickness . 1.6) - (thick-thickness . 6.0) - (name . "SpanBar") - ) - - StanzaNumber = #`( - (breakable . #t) - (molecule-callback . ,Text_item::brew_molecule) - (break-align-symbol . Clef_item) - (visibility-lambda . ,begin-of-line-visible) - (name . "StanzaNumber") - ) - - StaffSymbol = #`( - (interfaces . (staff-symbol-interface )) - (molecule-callback . ,Staff_symbol::brew_molecule) - (staff-space . 1.0) - (line-count . 5 ) - (name . "StaffSymbol") - ) - - SystemStartDelimiter = #`( - (molecule-callback . ,System_start_delimiter::brew_molecule) - (after-line-breaking-callback . ,System_start_delimiter::after_line_breaking) - (collapse-height . 1.0) - (thickness . 1.6) - (arch-height . 1.5) - (arch-angle . 50.0) - (arch-thick . 0.25) - (arch-width . 1.5) - (bracket-thick . 0.25) - (bracket-width . 2.0) - (name . "SystemStartDelimiter") - ) - - TextScript = #`( - (molecule-callback . ,Text_item::brew_molecule) - (no-spacing-rods . #t) - (interfaces . (text-script-interface text-item-interface side-position-interface)) - (padding . 0.5) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (name . "TextScript") - ) - TextSpanner = #`( - (interfaces . (text-spanner-interface)) - (molecule-callback . ,Text_spanner::brew_molecule) - (type . "line") - (direction . 1) - (font-shape . "italic") - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (name . "TextSpanner") - ) - Tie = #`( - (interfaces . (tie-interface)) - (molecule-callback . ,Tie::brew_molecule) - (spacing-procedure . ,Tie::set_spacing_rods) - (staffline-clearance . 0.24) - (details . ((ratio . 0.333) (height-limit . 1.0))) - (thickness . 1.2) - (x-gap . 0.2) - (minimum-length . 2.5) - (name . "Tie") - ) - - TieColumn = #`( - (after-line-breaking-callback . ,Tie_column::after_line_breaking) - (interfaces . (tie-column-interface)) - (name . "TieColumn") - ) - - TimeSignature = #`( - (interfaces . (time-signature-interface)) - (molecule-callback . ,Time_signature::brew_molecule) - (break-align-symbol . Time_signature) - (visibility-lambda . ,all-visible) - (breakable . #t) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (font-style . timesig) - (name . "TimeSignature") - ) - - TupletBracket = #`( - (interfaces . (tuplet-spanner-interface)) - (number-gap . 2.0) - (delta-y . 0) - (thick . 1.0) - (after-line-breaking-callback . ,Tuplet_spanner::after_line_breaking) - (molecule-callback . ,Tuplet_spanner::brew_molecule) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (font-shape . "italic") - (name . "TupletBracket") - ) - - SostenutoPedal = #`( - (molecule-callback . ,Text_item::brew_molecule) - (X-offset-callbacks . (,Side_position::aligned_on_self)) - (Y-offset-callbacks . - (,Side_position::aligned_side - ,Side_position::centered_on_parent)) - - (font-shape . "italic") - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (no-spacing-rods . #t) - (self-alignment-X . 0) - (name . "SostenutoPedal") - - ) - - Stem = #`( - (interfaces . (stem-interface)) - (before-line-breaking-callback . ,Stem::before_line_breaking) - (molecule-callback . ,Stem::brew_molecule) - (thickness . 0.8) - (beamed-lengths . (0.0 2.5 2.0 1.5)) - (beamed-minimum-lengths . (0.0 1.5 1.25 1.0)) - -;; Stems in unnatural (forced) direction should be shortened, -;; according to [Roush & Gourlay]. Their suggestion to knock off -;; a whole staffspace seems a bit drastical: we'll do half. - - (lengths . (3.5 3.5 3.5 4.5 5.0)) - (stem-shorten . (0.5)) - ; if stem is on middle line, choose this direction. - (default-neutral-direction . 1) - (X-offset-callbacks . (,Stem::off_callback)) - (name . "Stem") - ) - - StemTremolo = #`( - (molecule-callback . ,Stem_tremolo::brew_molecule) - (beam-width . 2.0) ; staff-space - (beam-thickness . 0.42) ; staff-space - (beam-space-function . ,default-beam-space-function) - (name . "StemTremolo") - ) - - SeparationItem = #`( - (interfaces . (separation-item-interface)) - (name . "SeparationItem") - ) - - SeparatingGroupSpanner = #`( - (interfaces . (separation-spanner-interface)) - (spacing-procedure . ,Separating_group_spanner::set_spacing_rods) - (name . "SeparatingGroupSpanner") - ) - - SustainPedal = #`( - (interfaces . (sustain-pedal-interface side-position-interface)) - (no-spacing-rods . #t) - (molecule-callback . ,Sustain_pedal::brew_molecule) - (self-alignment-X . 0) - (X-offset-callbacks . (,Side_position::aligned_on_self)) - (Y-offset-callbacks . - (,Side_position::aligned_side - ,Side_position::centered_on_parent)) - - (name . "SustainPedal") - ) - UnaChordaPdeal = #`( - (molecule-callback . ,Text_item::brew_molecule) - (font-shape . "italic") - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (no-spacing-rods . #t) - (self-alignment-X . 0) - (X-offset-callbacks . (,Side_position::aligned_on_self)) - (Y-offset-callbacks . - (,Side_position::aligned_side - ,Side_position::centered_on_parent)) - - (name . "UnaChordaPedal") - ) - - VoltaBracket = #`( - (molecule-callback . ,Volta_spanner::brew_molecule) - (interfaces . (volta-spanner-interface side-position-interface)) - (direction . 1) - (padding . 5) - (thickness . 1.6) ; stafflinethickness - (height . 2.0) ; staffspace; - (minimum-space . 25) - (properties-to-font-name . ,properties-to-font-name) - (style-to-font-name . ,style-to-font-name) - (markup-to-properties . ,markup-to-properties) - (font-style . volta) - (name . "VoltaBracket") - ) - - VerticalAlignment = #`( - (axes 1) - (interfaces . (align-interface axis-group-interface)) - (Y-extent-callback . ,Axis_group_interface::group_extent_callback) - (X-extent-callback . #f) - (stacking-dir . -1) - (name . "VerticalAlignment") - ) - - VerticalAxisGroup = #`( - (axes 1) - (interfaces . (axis-group-interface)) - (name . "VerticalAxisGroup") - ) \include "auto-beam-settings.ly"; diff --git a/ly/generate-documentation.ly b/ly/generate-documentation.ly new file mode 100644 index 0000000000..03399af21a --- /dev/null +++ b/ly/generate-documentation.ly @@ -0,0 +1,2 @@ + +#(eval-string (ly-gulp-file "generate-documentation.scm")) diff --git a/scm/basic-properties.scm b/scm/basic-properties.scm index d5f5d1a947..ff3204e8e2 100644 --- a/scm/basic-properties.scm +++ b/scm/basic-properties.scm @@ -142,7 +142,6 @@ ; (define basic-beam-properties `( - (interfaces . (beam-interface)) (molecule-callback . ,Beam::brew_molecule) (thickness . 0.42) ; in staff-space, should use stafflinethick? (before-line-breaking-callback . ,Beam::before_line_breaking) @@ -157,7 +156,7 @@ (flag-width-function . ,default-beam-flag-width-function) (space-function . ,default-beam-space-function) (damping . 1) - (name . "beam") + (meta . ,(element-description "Beam" general-element-interface beam-interface)) ) ) diff --git a/scm/chord-names.scm b/scm/chord-names.scm index ed54054cee..99400b03ab 100644 --- a/scm/chord-names.scm +++ b/scm/chord-names.scm @@ -10,23 +10,12 @@ (ice-9 regex) ) -;; The regex module may not be available, or may be broken. -(define chord-use-regex - (let ((os (string-downcase (vector-ref (uname) 0)))) - (not (equal? "cygwin" (substring os 0 (min 6 (string-length os))))))) - -;; If you have trouble with regex, define #f -(define chord-use-regex #t) -;;(define chord-use-regex #f) - ;; ;; (octave notename accidental) ;; ;; -;; text: list of word -;; word: string + optional list of property -;; property: size, style, font, super, offset +;; text: scm markup text -- see font.scm and input/test/markup.ly ;; ;; TODO @@ -50,7 +39,7 @@ ; C iso C.no5 (((0 . 0) (2 . 0)) . #f) ; Cm iso Cm.no5 - (((0 . 0) (2 . -1)) . (("m"))) + (((0 . 0) (2 . -1)) . ("m")) ; C2 iso C2.no3 (((0 . 0) (1 . 0) (4 . 0)) . (super "2")) ; C4 iso C4.no3 @@ -87,21 +76,21 @@ (((0 . 0) (2 . -1)) . ("m")) (((0 . 0) (3 . 0) (4 . 0)) . ("sus")) (((0 . 0) (2 . -1) (4 . -1)) . ("dim")) -;Alternate: (((0 . 0) (2 . -1) (4 . -1)) . (("o" (type . "super")))) +;Alternate: (((0 . 0) (2 . -1) (4 . -1)) . ((super "o"))) (((0 . 0) (2 . 0) (4 . 1)) . ("aug")) ;Alternate: (((0 . 0) (2 . 0) (4 . 1)) . ("+")) (((0 . 0) (1 . 0) (4 . 0)) . ("2")) ;; Common seventh chords - (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (("o" (type . "super")) "7")) + (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (rows (super "o") "7")) (((0 . 0) (2 . 0) (4 . 0) (6 . 0)) . ("maj7")) (((0 . 0) (2 . -1) (4 . 0) (6 . -1)) . ("m7")) (((0 . 0) (2 . 0) (4 . 0) (6 . -1)) . ("7")) (((0 . 0) (2 . -1) (4 . 0) (6 . 0)) . ("m(maj7)")) ;jazz: the delta, see jazz-chords.ly - ;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (("N" (type . "super") (style . "msam") (size . -3)))) - (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (("o" (type . "super")) ("/" (size . -2) (offset . (-0.58 . 0.5))) "7")) ; slashed o + ;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((family . "math") "N")) + (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows (super "o") ((kern . -0.5) ((size . "-3") "/")) "7")) ; slashed o (((0 . 0) (2 . 0) (4 . 1) (6 . -1)) . ("aug7")) - (((0 . 0) (2 . 0) (4 . -1) (6 . 0)) . (("maj7") ("accidentals--1" (font . "feta") (type . "super")) ("5"))) + (((0 . 0) (2 . 0) (4 . -1) (6 . 0)) . (rows "maj7" (music (named ("accidentals--1"))) "5")) (((0 . 0) (3 . 0) (4 . 0) (6 . -1)) . ("7sus4")) ;; Common ninth chords (((0 . 0) (2 . 0) (4 . 0) (5 . 0) (1 . 0)) . ("6/9")) ;; we don't want the '/no7' @@ -126,10 +115,14 @@ (make-string 1 (integer->char (+ (modulo (+ (cadr pitch) 2) 7) 65))) (if (= (caddr pitch) 0) '() - (list (list (string-append "accidentals-" - (number->string (caddr pitch))) - ;; Keep accidentals from being too large - '(font . "feta") '(type . "super") ))))) + (list + (append '(music) + (list + (append '(named) + (list + (string-append "accidentals-" + (number->string (caddr pitch))))))))))) + (define (step->text pitch) (string-append @@ -265,51 +258,52 @@ ;; additions, subtractions and base or inversion to chord name ;; (define (chord::inner-name-banter tonic user-name additions subtractions base-and-inversion) - (apply append (pitch->text-banter tonic) - (if user-name user-name '()) - ;; why does list->string not work, format seems only hope... - (if (and chord-use-regex - (string-match "super" (format "~s" user-name)) - (or (pair? additions) - (pair? subtractions))) - '(("/" (type . "super"))) - '()) - (let loop ((from additions) (to '())) - (if (pair? from) + (apply append + '(rows) + (pitch->text-banter tonic) + (if user-name user-name '()) + ;; why does list->string not work, format seems only hope... + (if (and (string-match "super" (format "~s" user-name)) + (or (pair? additions) + (pair? subtractions))) + '((super "/")) + '()) + (let loop ((from additions) (to '())) + (if (pair? from) + (let ((p (car from))) + (loop (cdr from) + (append to + (cons + (list 'super (step->text-banter p)) + (if (or (pair? (cdr from)) + (pair? subtractions)) + '((super "/")) + '()))))) + to)) + (let loop ((from subtractions) (to '())) + (if (pair? from) (let ((p (car from))) (loop (cdr from) (append to - (cons - (cons (step->text-banter p) '((type . "super"))) - (if (or (pair? (cdr from)) - (pair? subtractions)) - '(("/" (type . "super"))) - '()))))) + (cons '(super "no") + (cons + (list 'super (step->text-banter p)) + (if (pair? (cdr from)) + '((super "/")) + '())))))) to)) - (let loop ((from subtractions) (to '())) - (if (pair? from) - (let ((p (car from))) - (loop (cdr from) - (append to - (cons '("no" (type . "super")) - (cons - (cons (step->text-banter p) '((type . "super"))) - (if (pair? (cdr from)) - '(("/" (type . "super"))) - '())))))) - to)) - (if (and (pair? base-and-inversion) - (or (car base-and-inversion) - (cdr base-and-inversion))) - (cons "/" (append - (if (car base-and-inversion) - (pitch->text - (car base-and-inversion)) - (pitch->text - (cdr base-and-inversion))) - '())) - '()) - '())) + (if (and (pair? base-and-inversion) + (or (car base-and-inversion) + (cdr base-and-inversion))) + (cons "/" (append + (if (car base-and-inversion) + (pitch->text + (car base-and-inversion)) + (pitch->text + (cdr base-and-inversion))) + '())) + '()) + '())) (define (chord::name-banter tonic user-name pitches base-and-inversion) (let ((additions (chord::additions pitches)) @@ -367,3 +361,4 @@ transposed))) (name-func (car pitches) user-name completed base-and-inversion)))))) + diff --git a/scm/element-descriptions.scm b/scm/element-descriptions.scm new file mode 100644 index 0000000000..25784adfe8 --- /dev/null +++ b/scm/element-descriptions.scm @@ -0,0 +1,569 @@ + +; distances are given in stafflinethickness (thicknesses) and +; staffspace (distances) + +(define all-element-descriptions + `((Arpeggio . ( + (X-extent-callback . ,Arpeggio::width_callback) + (molecule-callback . ,Arpeggio::brew_molecule) + (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) + (X-offset-callbacks . (,Side_position::aligned_side)) + (direction . -1) + (staff-position . 0.0) + (meta . ,(element-description "Arpeggio" arpeggio-interface side-position-interface)) + )) + + (BarLine . ( + (break-align-symbol . Staff_bar) + (glyph . "|") + (break-glyph-function . ,default-break-barline) + (barsize-procedure . ,Bar::get_staff_bar_size) + (molecule-callback . ,Bar::brew_molecule) + (visibility-lambda . ,all-visible) + (breakable . #t) + (before-line-breaking-callback . ,Bar::before_line_breaking) + ;; + ;; Ross. page 151 lists other values, we opt for a leaner look + ;; + (kern . 3.0) + (thin-kern . 3.0) + (hair-thickness . 1.6) + (thick-thickness . 6.0) + (meta . ,(element-description "BarLine" bar-line-interface general-element-interface)) + )) + + (BarNumber . ( + (molecule-callback . ,Text_item::brew_molecule) + (breakable . #t) + (visibility-lambda . ,begin-of-line-visible) + (padding . 1.0) + (direction . 1) + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (font-family . roman) + (meta . ,(element-description "BarNumber" + text-interface general-element-interface break-aligned-interface)) + )) + + (Beam . ,basic-beam-properties) + + (BreakAlignment . ( + (breakable . #t) + (stacking-dir . 1) + (axes 0) + (X-offset-callbacks . (,Break_align_interface::self_align_callback)) + (space-alist . ,default-break-align-space-alist) + (meta . ,(element-description "BreakAlignment" + axis-group-interface align-interface + ) + ) + )) + + (BreakAlignGroup . ( + (axes . (0)) + (X-offset-callbacks . (,Break_align_interface::alignment_callback)) + + (meta . ,(element-description "BreakAlignGroup" axis-group-interface)) + )) + + (BreathingSign . ( + (break-align-symbol . Breathing_sign) + (breakable . #t ) + (molecule-callback . ,Breathing_sign::brew_molecule) + (Y-offset-callbacks . (,Breathing_sign::offset_callback)) + (visibility-lambda . ,begin-of-line-invisible) + (meta . ,(element-description "BreathingSign" general-element-interface break-aligned-interface)) + )) + + (Clef . ( + (molecule-callback . ,Score_element::brew_molecule) + (before-line-breaking-callback . ,Clef::before_line_breaking) + (breakable . #t) + (break-align-symbol . Clef_item) + (visibility-lambda . ,begin-of-line-visible) + (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) + (meta . ,(element-description "Clef" clef-interface break-aligned-interface general-element-interface)) + )) + + (ChordNames . ( + (molecule-callback . ,Chord_name::brew_molecule) + (after-line-breaking-callback . ,Chord_name::after_line_breaking) + (chord-name-function . ,default-chord-name-function) + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (font-size . "0") ;; Hmm, 0 should be the default, maybe?? + (font-family . "roman") + (meta . ,(element-description "ChordNames" chord-name-interface)) + )) + + (NoteCollision . ( + (axes 0 1) + (note-width . 1.65) + (meta . ,(element-description "NoteCollision" + general-element-interface note-collision-interface axis-group-interface + )) + )) + + (Crescendo . ( + (molecule-callback . ,Crescendo::brew_molecule) + (thickness . 1.0) + (shorten-for-letter . 4.0) + (height . 0.6666) + (dash-thickness . 1.2) + (dash-length . 4.0) + (self-alignment-Y . 0) + (Y-offset-callbacks . (,Side_position::aligned_on_self)) + (meta . ,(element-description "Crescendo" hairpin-interface)) + )) + + (DotColumn . ( + (axes 0 ) + (meta . ,(element-description "DotColumn" dot-column-interface general-element-interface axis-group-interface)) + )) + + (Dots . ( + (molecule-callback . ,Dots::brew_molecule) + (dot-count . 1) + (staff-position . 0.0) + (Y-offset-callbacks . (,Dots::quantised_position_callback ,Staff_symbol_referencer::callback)) + (meta . ,(element-description "Dots" dot-interface general-element-interface)) + )) + + (DynamicText . ( + (Y-offset-callbacks . (,Side_position::aligned_on_self)) + (molecule-callback . ,Text_item::brew_molecule) + (script-priority . 100) + (font-style . dynamic) + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (self-alignment-Y . 0) + + (meta . ,(element-description "DynamicText" text-interface general-element-interface)) + )) + + (DynamicLineSpanner . ( + (axes . ( 1)) + (padding . 3) + (minimum-space . 6) + (meta . ,(element-description "DynamicLineSpanner" dynamic-interface axis-group-interface side-position-interface)) + )) + + (LeftEdge . ( + (break-align-symbol . Left_edge_item) + (breakable . #t) + (meta . ,(element-description "LeftEdge" break-aligned-interface)) + )) + + (Fingering . ( + (molecule-callback . ,Text_item::brew_molecule) + (padding . 3.0) + (self-alignment-X . 0) + (font-style . dynamic) + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + + (meta . ,(element-description "Fingering" finger-interface text-script-interface text-interface side-position-interface)) + )) + + (GraceAlignment . ( + (axes . (0)) + (horizontal-space . 1.2) + (padding . 1.0) + (before-line-breaking-callback . ,Grace_align_item::before_line_breaking) + (meta . ,(element-description "GraceAlignment" axis-group-interface align-interface grace-alignment-interface)) + )) + + (HaraKiriVerticalGroup . ( + (Y-offset-callbacks . (,Hara_kiri_group_spanner::force_hara_kiri_callback)) + (Y-extent-callback . ,Hara_kiri_group_spanner::y_extent) + (axes 1) + (meta . ,(element-description "HaraKiriVerticalGroup" axis-group-interface hara-kiri-group-interface)) + )) + + (LyricHyphen . ( + (thickness . 1.0) + (height . 0.4) + (minimum-length . 0.5) + (molecule-callback . ,Hyphen_spanner::brew_molecule) + (Y-extent-callback . ,Score_element::point_dimension_callback) + (meta . ,(element-description "LyricHyphen" lyric-hyphen-interface general-element-interface)) + )) + + (InstrumentName . ( + (breakable . #t) + (Y-offset-callbacks . (,Side_position::centered_on_parent)) + (molecule-callback . ,Text_item::brew_molecule) + (break-align-symbol . Instrument_name) + (visibility-lambda . ,begin-of-line-visible) + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (font-family . roman) + (meta . ,(element-description "InstrumentName" general-element-interface text-interface break-aligned-interface)) + )) + + (KeySignature . ( + (molecule-callback . ,Key_item::brew_molecule) + (break-align-symbol . Key_item) + (visibility-lambda . ,begin-of-line-visible) + (breakable . #t) + (meta . ,(element-description "KeySignature" key-signature-interface general-element-interface break-aligned-interface)) + )) + + (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) + (meta . ,(element-description "Accidentals" general-element-interface accidentals-interface)) + )) + + (LineOfScore . ( + (axes . (0 1)) + (meta . ,(element-description "LineOfScore" general-element-interface axis-group-interface)) + )) + + (LyricExtender . ( + (molecule-callback . ,Lyric_extender::brew_molecule) + (height . 0.8) ; stafflinethickness; + (right-trim-amount . 0.5) + (Y-extent-callback . ,Score_element::point_dimension_callback) + (meta . ,(element-description "LyricExtender" general-element-interface lyric-extender-interface)) + )) + + (LyricText . ( + (molecule-callback . ,Text_item::brew_molecule) + (X-offset-callbacks . (,Side_position::aligned_on_self)) + (self-alignment-X . 0) + (non-rhythmic . #t) + (word-space . 0.6) + + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (font-family . roman) + + (meta . ,(element-description "LyricText" lyric-syllable-interface text-interface)) + )) + + (RehearsalMark . ( + (molecule-callback . ,Text_item::brew_molecule) + (breakable . #t) + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (font-style . mark) + (visibility-lambda . ,end-of-line-invisible) + (padding . 4.0) + (meta . ,(element-description "RehearsalMark" general-element-interface mark-interface side-position-interface)) + )) + + (MultiMeasureRest . ( + (spacing-procedure . ,Multi_measure_rest::set_spacing_rods) + (molecule-callback . ,Multi_measure_rest::brew_molecule) + (staff-position . 0) + (expand-limit . 10) + (padding . 2.0) ; staffspace + (minimum-width . 12.5) ; staffspace + (meta . ,(element-description "MultiMeasureRest" multi-measure-rest-interface general-element-interface)) + )) + + (NoteColumn . ( + (axes . (0 1)) + (meta . ,(element-description "NoteColumn" general-element-interface axis-group-interface note-column-interface)) + )) + + (NoteHead . ( + (style . default) + (molecule-callback . ,Note_head::brew_molecule) + (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) + (meta . ,(element-description "NoteHead" + rhythmic-head-interface + note-head-interface general-element-interface)) + )) + + (OctavateEight . ( + (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)) + (Y-offset-callbacks . (,Side_position::aligned_side)) + (molecule-callback . ,Text_item::brew_molecule) + (font-shape . "italic") + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + + (meta . ,(element-description "OctavateEight" text-interface general-element-interface)) + )) + + (PaperColumn . ( + (axes 0) + (before-musical-spacing-factor . 0.4) + (meta . ,(element-description "PaperColumn" paper-column-interface axis-group-interface spaceable-element-interface)) + )) + (NonMusicalPaperColumn . ( + (axes 0) + (before-musical-spacing-factor . 1.0) + (meta . ,(element-description "NonMusicalPaperColumn" paper-column-interface axis-group-interface spaceable-element-interface)) + )) + + (Rest . ( + (after-line-breaking-callback . ,Rest::after_line_breaking) + (molecule-callback . ,Rest::brew_molecule) + (minimum-beam-collision-distance . 1.5) + (meta . ,(element-description "Rest" + rhythmic-head-interface + rest-interface general-element-interface)) + )) + (RestCollision . ( + (minimum-distance . 0.75) + (meta . ,(element-description "RestCollision" rest-collision-interface general-element-interface)) + )) + + (Script . ( + (molecule-callback . ,Script::brew_molecule) + (X-offset-callbacks . (,Side_position::centered_on_parent)) + (meta . ,(element-description "Script" script-interface side-position-interface)) + )) + + (ScriptColumn . ( + (before-line-breaking-callback . ,Script_column::before_line_breaking) + (meta . ,(element-description "ScriptColumn" script-column-interface)) + )) + + (Slur . ,default-basic-slur-properties) + (SpacingSpanner . ( + (spacing-procedure . ,Spacing_spanner::set_springs) + + ;; assume that notes at least this long are present. + (maximum-duration-for-spacing . ,(make-moment 1 8)) + (meta . ,(element-description "SpacingSpanner" general-element-interface spacing-spanner-interface)) + )) + (SpanBar . ( + + (break-align-symbol . Staff_bar) + (barsize-procedure . ,Span_bar::get_bar_size) + (molecule-callback . ,Bar::brew_molecule) + (visibility-lambda . ,begin-of-line-invisible) + (X-extent-callback . ,Span_bar::width_callback) + (Y-offset-callbacks . (,Span_bar::center_on_spanned_callback)) + + (breakable . #t) + (glyph . "|") + (before-line-breaking-callback . ,Span_bar::before_line_breaking) + ;; ugh duplication! + + ;; + ;; Ross. page 151 lists other values, we opt for a leaner look + ;; + (kern . 3.0) + (thin-kern . 3.0) + (hair-thickness . 1.6) + (thick-thickness . 6.0) + (meta . ,(element-description "SpanBar" span-bar-interface bar-line-interface general-element-interface)) + )) + + (StanzaNumber . ( + (breakable . #t) + (molecule-callback . ,Text_item::brew_molecule) + (break-align-symbol . Clef_item) + (visibility-lambda . ,begin-of-line-visible) + (meta . ,(element-description "StanzaNumber" break-aligned-interface text-interface)) + )) + + (StaffSymbol . ( + (molecule-callback . ,Staff_symbol::brew_molecule) + (staff-space . 1.0) + (line-count . 5 ) + (meta . ,(element-description "StaffSymbol" staff-symbol-interface general-element-interface)) + )) + (SostenutoPedal . ( + (molecule-callback . ,Text_item::brew_molecule) + (X-offset-callbacks . (,Side_position::aligned_on_self)) + (Y-offset-callbacks . + (,Side_position::aligned_side + ,Side_position::centered_on_parent)) + (no-spacing-rods . #t) + (font-shape . "italic") + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + + (self-alignment-X . 0) + (meta . ,(element-description "SostenutoPedal" text-interface general-element-interface)) + )) + + (Stem . ( + (before-line-breaking-callback . ,Stem::before_line_breaking) + (molecule-callback . ,Stem::brew_molecule) + (thickness . 0.8) + (beamed-lengths . (0.0 2.5 2.0 1.5)) + (beamed-minimum-lengths . (0.0 1.5 1.25 1.0)) + +;; Stems in unnatural (forced) direction should be shortened, +;; according to [Roush & Gourlay]. Their suggestion to knock off +;; a whole staffspace seems a bit drastical: we'll do half. + + (lengths . (3.5 3.5 3.5 4.5 5.0)) + (stem-shorten . (0.5)) + ; if stem is on middle line, choose this direction. + (default-neutral-direction . 1) + (X-offset-callbacks . (,Stem::off_callback)) + (meta . ,(element-description "Stem" stem-interface general-element-interface)) + )) + + (StemTremolo . ( + (molecule-callback . ,Stem_tremolo::brew_molecule) + (beam-width . 2.0) ; staff-space + (beam-thickness . 0.42) ; staff-space + (beam-space-function . ,default-beam-space-function) + (meta . ,(element-description "StemTremolo" stem-tremolo-interface general-element-interface)) + )) + + (SeparationItem . ( + (meta . ,(element-description "SeparationItem" separation-item-interface general-element-interface)) + )) + (SeparatingGroupSpanner . ( + (spacing-procedure . ,Separating_group_spanner::set_spacing_rods) + (meta . ,(element-description "SeparatingGroupSpanner" separation-spanner-interface)) + )) + + (SustainPedal . ( + (no-spacing-rods . #t) + (molecule-callback . ,Sustain_pedal::brew_molecule) + (self-alignment-X . 0) + (X-offset-callbacks . (,Side_position::aligned_on_self)) + (Y-offset-callbacks . + (,Side_position::aligned_side + ,Side_position::centered_on_parent)) + + (meta . ,(element-description "SustainPedal" sustain-pedal-interface side-position-interface)) + )) + + (SystemStartDelimiter . ( + (molecule-callback . ,System_start_delimiter::brew_molecule) + (after-line-breaking-callback . ,System_start_delimiter::after_line_breaking) + (collapse-height . 1.0) + (thickness . 1.6) + (arch-height . 1.5) + (arch-angle . 50.0) + (arch-thick . 0.25) + (arch-width . 1.5) + (bracket-thick . 0.25) + (bracket-width . 2.0) + (meta . ,(element-description "SystemStartDelimiter" system-start-delimiter general-element-interface)) + )) + + (TextScript . ( + (molecule-callback . ,Text_item::brew_molecule) + (no-spacing-rods . #t) + (padding . 0.5) + (meta . ,(element-description "TextScript" text-script-interface text-interface side-position-interface general-element-interface)) + )) + (TextSpanner . ( + (molecule-callback . ,Text_spanner::brew_molecule) + (font-shape . "italic") + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (type . "line") + (direction . 1) + (meta . ,(element-description "TextSpanner" text-spanner-interface general-element-interface)) + )) + (Tie . ( + (molecule-callback . ,Tie::brew_molecule) + (spacing-procedure . ,Tie::set_spacing_rods) + (staffline-clearance . 0.24) + (details . ((ratio . 0.333) (height-limit . 1.0))) + (thickness . 1.2) + (x-gap . 0.2) + (minimum-length . 2.5) + (meta . ,(element-description "Tie" tie-interface general-element-interface)) + )) + + (TieColumn . ( + (after-line-breaking-callback . ,Tie_column::after_line_breaking) + (meta . ,(element-description "TieColumn" tie-column-interface general-element-interface)) + )) + + (TimeSignature . ( + (molecule-callback . ,Time_signature::brew_molecule) + (break-align-symbol . Time_signature) + (visibility-lambda . ,all-visible) + (breakable . #t) + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (font-style . timesig) + + (meta . ,(element-description "TimeSignature" time-signature-interface general-element-interface)) + )) + + (TupletBracket . ( + (number-gap . 2.0) + (delta-y . 0) + (thick . 1.0) + (after-line-breaking-callback . ,Tuplet_spanner::after_line_breaking) + (molecule-callback . ,Tuplet_spanner::brew_molecule) + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (font-shape . "italic") + (meta . ,(element-description "TupletBracket" + general-element-interface tuplet-bracket-interface)) + )) + + (UnaChordaPdeal . ( + (molecule-callback . ,Text_item::brew_molecule) + (font-shape . "italic") + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (no-spacing-rods . #t) + (self-alignment-X . 0) + (X-offset-callbacks . (,Side_position::aligned_on_self)) + (Y-offset-callbacks . + (,Side_position::aligned_side + ,Side_position::centered_on_parent)) + (meta . ,(element-description "UnaChordaPedal" text-interface general-element-interface)) + )) + + (VoltaBracket . ( + (molecule-callback . ,Volta_spanner::brew_molecule) + (direction . 1) + (padding . 5) + (properties-to-font-name . ,properties-to-font-name) + (style-to-font-name . ,style-to-font-name) + (markup-to-properties . ,markup-to-properties) + (font-style . volta) + + (thickness . 1.6) ; stafflinethickness + (height . 2.0) ; staffspace; + (minimum-space . 25) + (meta . ,(element-description "VoltaBracket" volta-bracket-interface side-position-interface)) + )) + + (VerticalAlignment . ( + (axes 1) + (Y-extent-callback . ,Axis_group_interface::group_extent_callback) + (X-extent-callback . #f) + (stacking-dir . -1) + (meta . ,(element-description "VerticalAlignment" align-interface axis-group-interface)) + )) + + (VerticalAxisGroup . ( + (axes 1) + (meta . ,(element-description "VerticalAxisGroup" axis-group-interface)) + )) +)) + + + +; (display (map pair? all-element-descriptions)) + diff --git a/scm/font.scm b/scm/font.scm index a0df641b4d..1c641c854e 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -50,6 +50,9 @@ (("bold upright roman cmbx 12" . 1) . "cmbx12") (("medium italic roman cmbx 10" . 0) . "cmbx10") (("medium italic roman cmbx 12" . 1) . "cmbx12") + (("medium upright math msam 10" . -2) . "msam10") + (("medium upright math msam 10" . -1) . "msam10") + (("medium upright math msam 10" . 0) . "msam10") )) (define (style-sheet-template-entry-compile entry size) @@ -104,6 +107,7 @@ (name . font-name) (size . font-size) (point . font-point) + (kern . kern) )) (define markup-abbrev-to-properties-alist @@ -117,7 +121,8 @@ (italic . (font-shape . "italic")) (named . (lookup . name)) (text . (lookup . value)) - (super . (font-size . -1))) + ;; super needs some work + (super . (font-size . "-1"))) (map (lambda (x) (cons (car x) (cons 'font-style (car x)))) style-to-font-alist))) diff --git a/scm/generate-documentation.scm b/scm/generate-documentation.scm new file mode 100644 index 0000000000..345e4da4ed --- /dev/null +++ b/scm/generate-documentation.scm @@ -0,0 +1,111 @@ + + +(define (uniqued-alist alist acc) + (if (null? alist) acc + (if (assoc (caar alist) acc) + (uniqued-alist (cdr alist) acc) + (uniqued-alist (cdr alist) (cons (car alist) acc) + )))) + + +;;; TODO + +(define (wordwrap string) + "" + ) + + +(define (self-evaluating? x) + (or (number? x) (string? x)) + ) + +(define (type-name predicate) + (cond + ((eq? predicate dir?) "direction") + ((eq? predicate ly-element?) "graphic element") + ((eq? predicate pair?) "pair") + ((eq? predicate integer?) "integer") + ((eq? predicate list?) "list") + ((eq? predicate symbol?) "symbol") + ((eq? predicate string?) "string") + ((eq? predicate boolean?) "string") + ((eq? predicate number?) "number") + ((eq? predicate procedure?) "procedure") + (else "(unknown)") + )) + +(define (scm->string val) + (string-append + (if (self-evaluating? val) "" "'") + (call-with-output-string (lambda (port) (display val port))) + )) + +(define (document-property prop desc) + (let ((handle (assoc (car prop) desc))) + (string-append + "\n" (symbol->string (car prop)) " (" (type-name (cadr prop)) ") -- " + (caddr prop) + "\ndefault value: " + (if (pair? handle) + (scm->string (cdr handle)) + "not set" + ) + "\n" + ) + )) + +;; +;; todo: setup ifaces differently. +;; +(define (document-element description) + (let* ((metah (assoc 'meta description)) + (meta (if (pair? metah) + (cdr metah) + '((properties . ()) (name . "huh?")) + )) + + (name (cdr (assoc 'name meta))) +; (iface-descs (cdr (assoc 'interface-descriptions meta))) + (propdesc (cdr (assoc 'properties meta))) + (docs (map (lambda (x) (document-property x description)) + (uniqued-alist propdesc '()))) + ) + + (string-append + "\n-------------------------\n" + name "\n" + "-------------------------\n" + "INTERFACES\n" + "(todo)\n" + ; (apply string-append iface-descs) + "-------------------------\n" + "PROPERTIES:\n" + (apply string-append docs) + ) + )) + + +(define (document-elements elts) + (string-append + (map (lambda (x) (display (car x)) (document-element (cdr x))) + elts + ) + )) + +(define (test-module ) + (display + (list + (scm->string '(1 2 abc)) + (scm->string +) + (type-name number?) + (uniqued-alist '((a . 1 ) (a . 1)) '() ) + ))) + + +; (define b (cdr (assoc 'Beam all-element-descriptions))) +;(display b) + +; (display (document-element b)) + +(display (document-elements all-element-descriptions)) + diff --git a/scm/interface.scm b/scm/interface.scm new file mode 100644 index 0000000000..24459840d1 --- /dev/null +++ b/scm/interface.scm @@ -0,0 +1,606 @@ + +; should include default value? + +;;; ::::::: should generate documentation for score elements from here. + +(define (property-description symbol type? description) + (list symbol type? description)) + +(define (lily-interface symbol description props) + (list (list symbol) + (list description) + props + ) + ) + +(define (merge-interfaces ifs) + (list + (apply append (map car ifs)) + (apply append (map cadr ifs)) + (apply append (map caddr ifs)) + )) + +(define (element-description name . interfaces) + (let ((merged (merge-interfaces interfaces))) + (list (cons 'separator "\n\n\n") ;easy printing. + (cons 'name name) + (cons 'interfaces (car merged)) + ; (cons 'interface-descriptions (cadr merged)) + ;; description of the element itself? + (cons 'properties (caddr merged)) + ))) + +;;;;;;;;;;;;;;;;; + +(define general-element-interface + (lily-interface + 'general-element-interface + "All elements support this" + (list (property-description 'X-offset-callbacks list? "") + (property-description 'Y-offset-callbacks list? "") + (property-description 'X-extent-callback procedure? "") + (property-description 'Y-extent-callback procedure? "") + (property-description 'font-size integer? "") + )) +) + +(define beam-interface + (lily-interface + 'beam-interface + "A beam. " + (list + (property-description 'y-position number? "position of left edge") + (property-description 'height number? "dy") + (property-description 'flag-width-function procedure? "") + (property-description 'damping integer? "amount of beam slope damping should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams ") + (property-description 'default-neutral-direction dir? "which +direction to choose if we're in the middle of the staff ") + (property-description 'thickness number? "weight of beams, in staffspace") + (property-description 'space-function procedure? "function of type multiplicity -> real (in staffspace)") + (property-description 'beamed-stem-shorten number? "") + (property-description 'height-quants number? "") + (property-description 'vertical-position-quant-function procedure? "") + (property-description 'dir-function procedure? "") + (property-description 'damping number? "damping factor.") + (property-description 'outer-stem-length-limit number? "catch +suspect beam slopes, set slope to zero if outer stem is lengthened +more than this (in staffspace)") + (property-description 'slope-limit number? "set slope to zero if slope is running away steeper than this.") + ) +)) + + + +;;;;;;;;;;;;;;;;;;;; + +(define clef-interface + (lily-interface + 'clef-interface + "A clef sign" + (list + (property-description 'non-default boolean? "not set because of existence of a bar?") + (property-description 'change boolean? "is this a change clef (smaller size)?") + (property-description 'glyph string? "a string determining what glyph is typeset") + )) + ) + +(define axis-group-interface + (lily-interface + 'axis-group-interface + "a group of coupled elements" + (list + (property-description 'axes list? "list of axis (number) in which this group works") + ))) + +(define note-column-interface + (lily-interface + 'note-column-interface + "Stem and noteheads combined" + (list + (property-description 'horizontal-shift integer? "integer that identifies ranking of note-column for horizontal shifting.") + (property-description 'force-hshift number? "amount of collision_note_width that overides automatic collision settings.") + (property-description 'merge-differently-dotted boolean? "merge black noteheads with differing dot count.") + )) + ) + +(define stem-interface + (lily-interface + 'stem-interface + "A stem" + (list + (property-description 'thickness number? "") + (property-description 'beamed-lengths list? "") + (property-description 'beamed-minimum-lengths list? "") + (property-description 'lengths list? "") + (property-description 'stem-shorten list? "") + (property-description 'default-neutral-direction dir? "") + (property-description 'direction dir? "") + (property-description 'stem-length number? "") + (property-description 'style string? "") ; symbol!? + (property-description 'flag-style string? "") ; symbol!? + (property-description 'X-offset-callbacks list? "") + ))) + + +(define slur-interface + (lily-interface + 'slur-interface + "A slur" + (list + (property-description 'de-uglify-parameters list? "list of 3 real constants. They define the valid areas for the middle control points. Used in de_uglyfy. They are a bit empirical.") + (property-description 'details list? "alist containing contaning a few magic constants.") + (property-description 'attachment pair? "cons of symbols, '(LEFT-TYPE . RIGHT-TYPE), where both types may be alongside-stem, stem, head or loose-end") + (property-description 'direction dir? "up or down?") + (property-description 'y-free number? "? ") + (property-description 'control-points list? "") + (property-description 'extremity-rules list? "") + (property-description 'extremity-offset-alist list? "") + (property-description 'thickness list? "") + (property-description 'dash number? "number representing the length of the dashes.") + ) + ) + ) + +(define side-position-interface + (lily-interface + 'side-position-interface + "put an element next to another one." + (list + (property-description 'direction dir? "where to put the victim object (left or right?)") + (property-description 'side-relative-direction dir? "if set: get the direction from a different object, and multiply by this.") + (property-description 'minimum-space number? "minimum distance that the victim should move (after padding)") + (property-description 'padding number? "add this much extra space between victim and support") + (property-description 'self-alignment-X number? "real number: -1 = left aligned, 0 = center, 1 right-aligned in X direction. Set to an element pointer, if you want that element to be the center. ") + (property-description 'self-alignment-Y number? "like self-alignment-X but for Y axis") + + ) + )) + +(define accidentals-interface + (lily-interface + 'accidentals-interface + "Accidentals" + (list + (property-description 'left-padding number? "space left of accs") + (property-description 'right-padding number? "space right of accs") + ) + )) + +(define note-head-interface + (lily-interface + 'note-head-interface + "Note head" + (list + (property-description 'style symbol? "symbol that sets note head style") + ) + )) + + +(define rhythmic-head-interface + (lily-interface + 'rhythmic-head-interface + "Note head or rest" + (list + (property-description 'dot ly-element? "reference to Dots object.") + (property-description 'stem ly-element? "pointer to Stem object") + (property-description 'duration-log integer? "2-log of the notehead duration") + ))) + +(define rest-interface + (lily-interface + 'rest-interface + "a rest" + (list + (property-description 'style string? "string specifying glyph style")))) + +(define tuplet-bracket-interface + (lily-interface + 'tuplet-bracket-interface + "A bracket with a number in the middle" + (list + (property-description 'beams list? "list of beam ptrs.") + (property-description 'columns list? " list of note-columns.") + (property-description 'number-gap number? "") + (property-description 'delta-y number? "") + (property-description 'thick number? "") + ) +)) + + +(define align-interface + (lily-interface + 'align-interface + " Order elements top to bottom/left to right/right to left etc." + (list + (property-description 'stacking-dir dir? "stack contents of elements in which direction ?") + (property-description 'align-dir dir? "Which side to align? -1: left side, 0: centered around center-element if not nil, or around center of width), 1: right side") + (property-description 'threshold pair? "(cons MIN MAX), where MIN and MAX are dimensions in staffspace") + (property-description 'alignment-done boolean? "boolean to administrate whether we've done the alignment already (to ensure that the process is done only once)") + (property-description 'center-element ly-element? "element which will be at the +center of the group after aligning (when using +Align_interface::center_on_element). The center element should have +this object as a reference point.") + (property-description 'elements list? "to be aligned elements ") + (property-description 'axes list? "list of axis numbers. Should contain only one number.") + ))) + +(define aligned-interface + (lily-interface + 'aligned-interface + "read by align-interface" + (list + (property-description 'minimum-space pair? "(cons LEFT RIGHT)") + (property-description 'extra-space pair? "(cons LEFT RIGHT)") + ))) + +(define break-aligned-interface + (lily-interface + 'break-aligned-interface + "Items that are aligned in prefatory matter" + (list + (property-description 'break-align-symbol symbol? "the index in the spacing table (symbol) of the to be aligned item.") + (property-description 'visibility-lambda procedure? "") + (property-description 'breakable boolean? "") + ))) + +(define chord-name-interface + (lily-interface + 'chord-name-interface + "" + (list + ))) +(define time-signature-interface + (lily-interface + 'time-signature-interface + "A time signature, in different styles" + (list + (property-description 'fraction pair? "") + (property-description 'style string? "") + ))) + +(define bar-line-interface + (lily-interface + 'bar-line-interface + "Bar line" + (list + (property-description 'barsize-procedure procedure? "") + (property-description 'kern number? "") + (property-description 'thin-kern number? "") + (property-description 'hair-thickness number? "") + (property-description 'thick-thickness number? "") + (property-description 'glyph string? "") + (property-description 'bar-size number? "") + (property-description 'break-glyph-function procedure? "") + ))) + + + + +(define text-spanner-interface + (lily-interface + 'text-spanner-interface + "generic text spanner" + (list + (property-description 'dash-period number? "") + (property-description 'dash-length number? "") + (property-description 'line-thickness number? "") + (property-description 'edge-height pair? "(leftheight . rightheight)") + (property-description 'edge-text pair? "(lefttext . righttext)") + (property-description 'text-style string? "") ; SYMBOL!!? + (property-description 'type string? "line, dashed-line or dotted-line") ; SYMBOL!!? + ) +)) + +(define hairpin-interface + (lily-interface + 'hairpin-interface + "hairpin crescendo" + (list + (property-description 'grow-direction dir? "") + (property-description 'thickness number? "") + (property-description 'height number? "") + ))) + + +(define arpeggio-interface + (lily-interface + 'arpeggio-interface + "arpeggio " + (list + (property-description 'stems list? "list of stem objects, corresponding to the notes that the arp has to be before.") + ) + ) + ) + +(define note-collision-interface + (lily-interface + 'note-collision-interface + "note collision" + (list + (property-description 'note-width 'number? "unit for horizontal translation, measured in staff-space.") + ) ) ) +(define dot-interface + (lily-interface + 'dots-interface + "The dots to go with a notehead/rest. A separate interface, since they + are a party in collision resolution." + (list + (property-description 'dot-count integer? "number of dots") + ))) + +(define text-interface + (lily-interface + 'text-interface + "A text" + (list + (property-description 'text string? "") + (property-description 'style string? "") + ))) + + +(define dot-column-interface + (lily-interface + 'dot-column-interface + "" + (list + ))) + +(define dynamic-interface + (lily-interface + 'dynamic-interface + "Any kind of loudness sign" + '() + )) + + +(define finger-interface + (lily-interface + 'finger-interface + "Any kind of loudness sign" + '() + )) + +(define separation-spanner-interface + (lily-interface + 'separation-spanner-interface + "" + '() + )) +(define text-script-interface + (lily-interface + 'text-script-interface + "Any text script" + '() + )) + +(define grace-alignment-interface + (lily-interface + 'grace-alignment-interface + "put grace notes in line" + (list + (property-description 'horizontal-space number? "amount of space to add after a note (in staff-space)") + ) + )) + +(define hara-kiri-group-interface + (lily-interface + 'hara-kiri-group-interface + "seppuku" + '())) + +(define lyric-hyphen-interface + (lily-interface + 'lyric-hyphen-interface + "A centred hyphen is a simple line between lyrics used to divide +syllables. The length of the hyphen line should stretch based on the + size of the gap between syllables." + (list + + (property-description 'thickness number? "thickness of line (in stafflinethickness)") + (property-description 'height number? "vertical offset (in staffspace)") + + (property-description 'minimum-length number? "try to make the hyphens at least this long. Also works as a scaling parameter for the length") + (property-description 'word-space number? "elongate left by this much (FIXME: cumbersome semantics)") + ))) + +(define key-signature-interface + (lily-interface + 'key-signature-interface + "A group of accidentals." + (list + (property-description 'c0-position integer? "integer indicating the position of central C?") + (property-description 'old-accidentals list? "list of (pitch, accidental) pairs") + (property-description 'new-accidentals list? "list of (pitch, accidental) pairs") + ))) + +(define lyric-extender-interface + (lily-interface + 'lyric-extender-interface + "The extender is a simple line at the baseline of the lyric + that helps show the length of a melissima (tied/slurred note)." + (list + (property-description 'word-space number? "") + (property-description 'height number? "in stafflinethickness") + (property-description 'right-trim-amount number? "") + ))) + + +(define lyric-syllable-interface + (lily-interface + 'lyric-syllable-interface + "" + (list + (property-description 'word-space number? "") + ))) + + +(define mark-interface + (lily-interface + 'mark-interface + "" + (list + ))) + +(define multi-measure-rest-interface + (lily-interface + 'multi-measure-rest-interface + "" + (list + + (property-description 'columns list? "list of paper-columns") + (property-description 'expand-limit integer? "int : max number of measures expanded in church rests") + (property-description 'minimum-width number? "Real in staffspace") + (property-description 'padding number? "staffspace") + ))) + +(define paper-column-interface + (lily-interface + 'paper-column-interface + "" + (list + (property-description 'dir-list list? "list of stem directions") + (property-description 'shortest-playing-duration moment? "duration of the shortest playing in that column.") + (property-description 'shortest-starter-duration moment? "duration of the shortest notes that starts exactly in this column.") + (property-description 'contains-grace boolean? "Used to widen entries for grace notes.") + (property-description 'extra-space pair? "pair of distances") + (property-description 'stretch-distance pair? "pair of distances") + ))) + +(define spaceable-element-interface + (lily-interface + 'spaceable-element-interface + "" + (list + (property-description 'minimum-distances list? "list of rods (ie. (OBJ . DIST) pairs)") + (property-description 'ideal-distances list? "(OBJ . (DIST . STRENGTH)) pairs") + (property-description 'dir-list list? "list of stem directions.") + ))) + +(define rest-collision-interface + (lily-interface + 'rest-collision-interface + "" + (list + (property-description 'maximum-rest-count integer? "") + (property-description 'minimum-distance number? "") + ))) + +(define script-interface + (lily-interface + 'script-interface + "" + (list + (property-description 'script-priority number? "") + ))) + +(define script-column-interface + (lily-interface + 'script-column-interface + "" + (list ))) + + +(define spacing-spanner-interface + (lily-interface + 'spacing-spanner-interface + "" + (list + (property-description 'maximum-duration-for-spacing moment? "space as if a duration of this type is available in this measure.") + ))) + +(define staff-symbol-interface + (lily-interface + 'staff-symbol-interface + "This spanner draws the lines of a staff. The middle line is +position 0." + (list + (property-description 'staff-space number? "") + (property-description 'line-count integer? "") + ))) + +(define stem-tremolo-interface + (lily-interface + 'stem-tremolo-interface + "" + (list + (property-description 'stem ly-element? "pointer to the stem object.") + (property-description 'beam-width number? "") + (property-description 'beam-thickness number? "") + (property-description 'beam-space-function procedure? "") + ))) + +(define separation-item-interface + (lily-interface + 'separation-item-interface + "" + (list + ))) + +(define sustain-pedal-interface + (lily-interface + 'sustain-pedal-interface + "" + (list + ))) +(define system-start-delimiter + (lily-interface + 'system-start-delimiter + "" + (list + (property-description 'collapse-height number? "") + (property-description 'thickness number? "") + (property-description 'arch-height number? "") + (property-description 'arch-angle number? "") + (property-description 'arch-thick number? "") + (property-description 'arch-width number? "") + (property-description 'bracket-thick number? "") + (property-description 'bracket-width number? "") + ))) + +(define text-script-interface + (lily-interface + 'text-script-interface + "" + (list + + ))) + +(define tie-interface + (lily-interface + 'tie-interface + "" + (list + (property-description 'staffline-clearance number? "") + (property-description 'heads pair? "pair of element pointers, pointing to the two heads of the tie. ") + (property-description 'details list? "") + (property-description 'thickness number? "") + (property-description 'x-gap number? "") + (property-description 'minimum-length number? "") + ))) + + + +(define tie-column-interface + (lily-interface + 'tie-column-interface + "" + (list + ))) + +(define volta-bracket-interface + (lily-interface + 'volta-bracket-interface + "Volta bracket with number" + (list + (property-description 'bars list? "list of barline ptrs.") + (property-description 'thickness number? "in stafflinethickness") + (property-description 'height number? "in staffspace ") + ))) + +(define span-bar-interface + (lily-interface + 'span-bar-interface + "" + (list + ))) + diff --git a/scm/lily.scm b/scm/lily.scm index a18f3fec56..d7f25a10af 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -11,6 +11,9 @@ ; +; We should repartition the entire scm side of lily in a +; more sane way, using namesspaces/modules? + ;(debug-enable 'backtrace) ;;; library funtions @@ -71,15 +74,12 @@ (string-append (number->string (car c)) " " (number->string (cdr c)) " ")) - (define (font i) (string-append "font" (make-string 1 (integer->char (+ (char->integer #\A) i))) )) - - (define (scm-scm action-name) 1) @@ -349,8 +349,8 @@ (string-append "\\special{src:" (number->string line) ":" (number->string col) " " file "}" ;; arg, the clueless take over the mailing list... - "\\special{-****-These-warnings-are-harmless-***}" - "\\special{-****-PLEASE-read-http://appel.lilypond.org/wiki/index.php3?PostProcessing-****}" +; "\\special{-****-These-warnings-are-harmless-***}" +; "\\special{-****-PLEASE-read-http://appel.lilypond.org/wiki/index.php3?PostProcessing-****}" ) ; line numbers only: @@ -926,3 +926,13 @@ (6 . 0) ) ) + +(begin + (eval-string (ly-gulp-file "interface.scm")) + (eval-string (ly-gulp-file "slur.scm")) + (eval-string (ly-gulp-file "font.scm")) + (eval-string (ly-gulp-file "generic-property.scm")) + (eval-string (ly-gulp-file "basic-properties.scm")) + (eval-string (ly-gulp-file "chord-names.scm")) + (eval-string (ly-gulp-file "element-descriptions.scm")) + ) diff --git a/scm/slur.scm b/scm/slur.scm index 046d86ddcf..2c10991f07 100644 --- a/scm/slur.scm +++ b/scm/slur.scm @@ -100,4 +100,21 @@ )) - +(define default-basic-slur-properties + `( + (molecule-callback . ,Slur::brew_molecule) + (thickness . 1.2) + (spacing-procedure . ,Slur::set_spacing_rods) + (minimum-length . 1.5) + (after-line-breaking-callback . ,Slur::after_line_breaking) + (extremity-rules . ,default-slur-extremity-rules) + (extremity-offset-alist . ,default-slur-extremity-offset-alist) + (de-uglify-parameters . ( 1.5 0.8 -2.0)) + (details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5))) + (beautiful . 0.5) + (y-free . 0.75) + (attachment-offset . ((0 . 0) . (0 . 0))) + (slope-limit . 0.8) + (meta . ,(element-description "Slur" general-element-interface slur-interface)) + ) + ) diff --git a/scripts/etf2ly.py b/scripts/etf2ly.py index 44ca2adec6..563e0308dc 100644 --- a/scripts/etf2ly.py +++ b/scripts/etf2ly.py @@ -501,14 +501,17 @@ class Staff: gap = (0,1) for m in self.measures[1:]: if not m or not m.valid: + sys.stderr.write ("Skipping non-existant measure") continue fr = None try: fr = m.frames[x] except IndexError: - pass - + + sys.stderr.write ("Skipping nonexistent frame") + laystr = laystr + "% FOOBAR ! \n" + print laystr if fr: first_frame = fr if gap <> (0,1): @@ -1043,6 +1046,7 @@ for opt in options: identify() +e = None for f in files: if f == '-': f = '' diff --git a/scripts/mudela-book.py b/scripts/mudela-book.py index 587a514b06..fa2ec8706e 100644 --- a/scripts/mudela-book.py +++ b/scripts/mudela-book.py @@ -1,25 +1,8 @@ #!@PYTHON@ # vim: set noexpandtab: # TODO: -# * Figure out clean set of options. +# * Figure out clean set of options. Hmm, isn't it pretty ok now? # * 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: @@ -368,15 +351,11 @@ output_dict= { } } -def output_verbatim (body):#ugh .format +def output_verbatim (body): 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}]*))', @@ -407,13 +386,11 @@ re_dict = { 'landscape': no_match, 'verbatim': r"""(?s)(?P@example\s.*?@end example\s)""", 'verb': r"""(?P@code{.*?})""", - 'mudela-file': '(?P@mudelafile(\[(?P.*?)\])?{(?P[^}]+)})', + 'mudela-file': '(?m)^(?!@c)(?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, @@ -574,16 +551,24 @@ 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': - #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' + scan_texi_preamble(chunks) else: assert __main__.format == 'latex' scan_latex_preamble(chunks) @@ -679,17 +664,6 @@ 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): @@ -767,11 +741,7 @@ def schedule_mudela_block (chunk): TODO has format [basename, extension, extension, ... ] """ - if len(chunk) == 3: - (type, body, opts) = chunk - complete_body = None - else:# mbverbatim - (type, body, opts, complete_body) = chunk + (type, body, opts) = chunk assert type == 'mudela' file_body = compose_full_body (body, opts) basename = `abs(hash (file_body))` @@ -784,7 +754,6 @@ 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'] @@ -795,18 +764,24 @@ 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) - 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 = [] - + 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') 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