+2003-04-30 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * lily/parser.yy (Simple_music): add \applyoutput, syntax
+ \applyoutput PROCEDURE
+
+ * lily/my-lily-lexer.cc: add \applyoutput.
+
+ * scm/music-types.scm (music-descriptions): add ApplyOutputEvent.
+
+ * lily/text-item.cc: clean text-interface description
+
2003-04-27 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* input/{regression,test}/: use postfix for slur endings and beam
<tr><td><font size="-1">
<a href="@TOP@index.html">Home</a><br>
<a href="@TOP@examples.html">Examples</a><br>
- <a href="@TOP@input/template/out-www/template.html">Templates</a><br>
+ <a href="@TOP@input/template/out-www/collated-files.html">Templates</a><br>
</font></td></tr>
<tr><td bgcolor="#e8e8ff">
<b>Download </b>
@itemize @bullet
@item @uref{../user/out-www/lilypond/Tutorial.html,Learn} how to use LilyPond.
@item
- @uref{../../input/template/out-www/template.html, Templates}, for
+ @uref{../../input/template/out-www/collated-files.html, Templates}, for
different music styles. Add notes, and done!
@end itemize
document.
@item
- @uref{../../input/template/out-www/template.html, Templates}, for
+ @uref{../../input/template/out-www/collated-files.html, Templates}, for
different music styles. Add notes, and done!
-@item All of the @uref{../../input/test/out-www/test.html,tips-and-tricks}
+@item All of the @uref{../../input/test/out-www/collated-files.html,tips-and-tricks}
input snippets, with the corresponding
output shown. Also available in
@uref{../../input/test/out-www/test.ps.gz,PostScript} and
@itemize @bullet
@item The @uref{ChangeLog.html, ChangeLog} lists things recently done.
@item The
-@uref{../../input/regression/out-www/regression.html,Regression Tests}
+@uref{../../input/regression/out-www/collated-files.html,Regression Tests}
are lot of snippets that test all basic features. Also available in
@uref{../../input/regression/out-www/regression.ps.gz,PostScript} and
@uref{../../input/regression/out-www/regression.pdf,PDF} formats.
@menu
* Tuning objects ::
+* Applyoutput::
* Outputproperty::
* Font selection::
* Text markup::
LilyPond may crash.
+@node Applyoutput
+@subsection Applyoutput
+
+The most versatile way of tuning object is @code{\applyoutput}. Its
+syntax is
+@example
+\applyoutput @var{proc}
+@end example
+where @var{proc} is a Scheme function, taking four arguments.
+
+When interpreted, the function @var{proc} is called for every grob found
+in the context, with the following arguments:
+@itemize @bullet
+@item the grob itself
+@item the context where the grob was created
+@item the context where @code{\applyoutput} is processed.
+@end itemize
+
+The cause of the grob, i.e. the music expression or object that was
+responsible for creating the object, is in the object property
+@code{cause}. For example, for a note head, this is a
+@internalsref{NoteHead} event, and for a @internalsref{Stem} object,
+this is a @internalsref{NoteHead} object.
+
+
@node Outputproperty
@subsection Outputproperty
@cindex \outputproperty
-A second way of tuning objects is the more arcane @code{\outputproperty}
+Another way of tuning objects is the more arcane @code{\outputproperty}
feature. The syntax is as follows:
@example
\outputproperty @var{predicate} @var{symbol} = @var{value}
SUBDIRS=test regression tutorial no-notation ascii-art template mutopia
# nereides is tweaked a lot, can't do (read webpage)
-examples= size13 size26
+examples= # size13 size26
#examples+=size11 size13 size16 size20 size23 size26
LOCALSTEPMAKE_TEMPLATES=ly mutopia
ADD_INTERFACE(Item,
"item-interface",
- "
-
-Grobs can be distinguished in their role in the horizontal spacing.
-Many grobs define constraints on the spacing by their sizes. For
-example, note heads, clefs, stems, and all other symbols with a fixed
-shape. These grobs form a subtype called @code{Item}.
-
-",
+ "\n"
+ "\n"
+ "Grobs can be distinguished in their role in the horizontal spacing.\n"
+ "Many grobs define constraints on the spacing by their sizes. For\n"
+ "example, note heads, clefs, stems, and all other symbols with a fixed\n"
+ "shape. These grobs form a subtype called @code{Item}.\n"
+ "\n"
+ "\n"
+ "Some items need special treatment for line breaking. For example, a\n"
+ "clef is normally only printed at the start of a line (i.e. after a\n"
+ "line break). To model this, `breakable' items (clef, key signature,\n"
+ "bar lines, etc.) are copied twice. Then we have three versions of each\n"
+ "breakable item: one version if there is no line break, one version\n"
+ "that is printed before the line break (at the end of a system), one\n"
+ "version that is printed after the line break.\n"
+ "\n"
+ "Whether these versions are visible and take up space, is determined by\n"
+ "the outcome of the @code{break-visibility}. This grob property is a\n"
+ "function taking a direction (-1, 0 or 1) as argument. It returns a\n"
+ "cons of booleans, signifying whether this grob should be transparent\n"
+ "and have no extent.\n",
"no-spacing-rods break-visibility breakable")
{"alias", ALIAS},
{"apply", APPLY},
{"applycontext", APPLYCONTEXT},
+ {"applyoutput", APPLYOUTPUT},
{"autochange", AUTOCHANGE},
{"simultaneous", SIMULTANEOUS},
{"sequential", SEQUENTIAL},
#include "engraver.hh"
#include "grob.hh"
#include "output-property-music-iterator.hh"
+#include "translator-group.hh"
class Output_property_engraver : public Engraver
{
TRANSLATOR_DECLARATIONS(Output_property_engraver);
protected:
-
- /*
- should do this with \once and \push ?
-
-
- \property Voice.outputProperties \push #pred = #modifier
-
- where both MODIFIER and PRED are functions taking a
- grob.
-
- */
-
-
Link_array<Music> props_;
virtual void stop_translation_timestep ();
{
Music * o = props_[i];
SCM pred = o->get_mus_property ("predicate");
-
- /*
- should typecheck pred.
- */
- SCM result=gh_apply (pred,
- scm_list_n (inf.grob_->self_scm (), SCM_UNDEFINED));
- if (to_boolean (result))
+
+
+
+ if (gh_procedure_p (pred))
{
- SCM sym = o->get_mus_property ("grob-property");
- SCM val = o->get_mus_property ("grob-value");
- inf.grob_->internal_set_grob_property (sym, val);
+ /*
+ should typecheck pred.
+ */
+ SCM result=scm_call_1 (pred, inf.grob_->self_scm ());
+ if (to_boolean (result))
+ {
+ SCM sym = o->get_mus_property ("grob-property");
+ SCM val = o->get_mus_property ("grob-value");
+ inf.grob_->internal_set_grob_property (sym, val);
+ }
+ }
+ else
+ {
+ Translator_group * d =
+ dynamic_cast<Translator_group*> (inf.origin_trans_);
+
+ if (!d)
+ d = dynamic_cast<Translator_group*> (inf.origin_trans_->daddy_trans_);
+
+ SCM proc = o->get_mus_property ("procedure");
+ scm_call_3 (proc,
+ inf.grob_->self_scm(),
+ d->self_scm(),
+ daddy_trans_->self_scm());
}
}
}
#include "music-list.hh"
#include "output-property-music-iterator.hh"
+
+/*
+ Huh.
+
+ Why do we need this?
+
+ */
void
Output_property_music_iterator::process (Moment m)
{
/* tokens which are not keywords */
%token AUTOCHANGE
%token ALIAS
-%token APPLYCONTEXT
+%token APPLYCONTEXT
+%token APPLYOUTPUT
%token APPLY
%token ACCEPTS
%token ALTERNATIVE
Simple_music:
event_chord { $$ = $1; }
+ | APPLYOUTPUT embedded_scm {
+ if (!gh_procedure_p ($2))
+ THIS->parser_error (_ ("\applycontext takes function argument"));
+ $$ = MY_MAKE_MUSIC ("ApplyOutputEvent");
+ $$->set_mus_property ("procedure", $2);
+ $$->set_spot (THIS->here_input());
+ }
| APPLYCONTEXT embedded_scm {
if (!gh_procedure_p ($2))
THIS->parser_error (_ ("\applycontext takes function argument"));
ADD_INTERFACE (Text_item,"text-interface",
- "A scheme markup text",
- "text axis baseline-skip extent lookup raise kern word-space");
+ "A scheme markup text, see @ref{Markup functions}.",
+ "text baseline-skip word-space");
/*
OrchestralScoreContext= \translator {
\ScoreContext
}
+
EasyNotation = \translator {
\ScoreContext
NoteHead \override #'molecule-callback = #Note_head::brew_ez_molecule
(grob-property-description 'adjust-if-on-staffline boolean? "If this grob is on a staff line, adjust its appearance, so that it better fits into the staff. E.g., if set true on stem grobs, flares of mensural flags will always be aligned with the staff lines, regardless if the associated note head is printed on a staff line or inbetween.")
(grob-property-description 'after-line-breaking-callback procedure? "Procedure taking a grob as argument.
This procedure is called (using dependency resolution) after line breaking. Return value is ignored.")
-(grob-property-description 'axis number? "the alignment of the text, 0 is horizontal, 1 is vertical.")
(grob-property-description 'align-dir ly:dir? "Which side to align? -1: left side, 0: around center of width, 1: right side.")
(grob-property-description 'alignment-done boolean? "boolean to administrate whether we've done the alignment already (to ensure that the process is done only once).")
(grob-property-description 'all-elements grob-list? "list of all grobs in this line. Needed for protecting grobs from GC.")
(grob-property-description 'expand-limit integer? "maximum number of measures expanded in church rests.")
(grob-property-description 'extra-X-extent number-pair? "enlarge in X dimension by this much, measured in staff space.")
(grob-property-description 'extra-Y-extent number-pair? "see @code{extra-Y-extent}.")
-(grob-property-description 'extent number-pair? "the extent of the text: (WIDTH . HEIGHT)")
(grob-property-description 'X-extent number-pair? "Store extent. internal use only. ")
(grob-property-description 'Y-extent number-pair? "Store extent. internal use only. ")
(grob-property-description 'extra-offset number-pair? "pair of reals
(grob-property-description 'inversion list? " musical-pitch, optional.")
(grob-property-description 'items-worth-living grob-list? "list of interesting items. If empty in a particular system, clear that system.")
(grob-property-description 'join-heads boolean? "Whether to join the noteheads of an ambitus grob with a vertical line.")
-(grob-property-description 'kern ly:dimension? "amount of extra white space to add.
-
-For text, this is `relative'(?) to the current alignment.
-
-For barline, space after a thick line.")
+(grob-property-description 'kern ly:dimension? "amount of extra white
+space to add. For barline, space after a thick line.")
(grob-property-description 'knee boolean? "Is this beam a knee?")
(grob-property-description 'knee-spacing-correction number? "optical correction amount for knees. 0: no correction; 1: full correction.")
(grob-property-description 'layer number? "The output layer [0..2]. The default is 1.")
work: @code{\override} is processed after the StaffSymbol is created,
and will have no effect.
")
-(grob-property-description 'lookup symbol? "lookup method: 'value for plain text, 'name for character-name.")
(grob-property-description 'maximum-length ly:dimension? "don't make Grob longer than this")
(grob-property-description 'maximum-rest-count integer? "kill off rests so we don't more than this number left.")
(grob-property-description 'measure-length ly:moment? "Length of a
(grob-property-description 'quilisma boolean? "is this neume a quilisma?.")
(grob-property-description 'positions pair? "cons of staff positions (LEFT . RIGHT")
(grob-property-description 'prefix-set number? "DOCME")
-
-(grob-property-description 'raise ly:dimension? "height for text to be raised (a negative value lowers the text.")
(grob-property-description 'ratio number? "Slur parameter. See height-limit.")
(grob-property-description 'right-padding ly:dimension? "space right of accs.")
(grob-property-description 'right-trim-amount ly:dimension? "shortening of the lyric extender on the right.")
")
-(grob-property-description 'break-visibility procedure? "a function that takes the break direction and returns a cons of booleans containing (TRANSPARENT . EMPTY).
-
-Some items need special treatment for line breaking. For example, a
-clef is normally only printed at the start of a line (i.e. after a
-line break). To model this, `breakable' items (clef, key signature,
-bar lines, etc.) are copied twice. Then we have three versions of each
-breakable item: one version if there is no line break, one version
-that is printed before the line break (at the end of a system), one
-version that is printed after the line break.
-
-Whether these versions are visible and take up space, is determined by
-the outcome of the @code{break-visibility}. This grob property is a
-function taking a direction (-1, 0 or 1) as argument. It returns a
-cons of booleans, signifying whether this grob should be transparent
-and have no extent.")
+(grob-property-description 'break-visibility procedure? "a function
+that takes the break direction and returns a cons of booleans
+containing (TRANSPARENT . EMPTY).
+")
(grob-property-description 'virga boolean? "is this neume a virga?.")
(grob-property-description 'when ly:moment? "when does this column happen?.")
(types . (general-music apply-context))
(iterator-ctor . ,Apply_context_iterator::constructor)
))
+ (ApplyOutputEvent
+ . (
+ (description . "
+Call the argument with all current grobs during interpreting phase.
+
+SYNTAX
+
+\applyoutput FUNC
+
+arguments to func are 1. the grob, 2. the originating context,
+3. context where FUNC is called.
+
+")
+ (internal-class-name . "Event")
+ (iterator-ctor . ,Output_property_music_iterator::constructor)
+ (types . (general-music layout-instruction))
+ ))
(ArpeggioEvent
. (
(description . "Make an arpeggio on this note. Syntax:
(internal-class-name . "Key_change_ev")
(types . (general-music key-change-event event))
- ))
+ ))
+
(LigatureEvent
. (
(description . "(docme).")
(OverrideProperty
. (
- (description . "Extend the definition of a graphical object")
+ (description . "Extend the definition of a graphical object.
+
+SYNTAX
+
+@code{\\propery Foo.Bar \\override} @var{SYMBOL} = @var{VALUE}
+
+")
(internal-class-name . "Music")
(types . (general-music layout-instruction))
(SimultaneousMusic
. (
- (description . "Music playing together. Syntax: \\simultaneous @{ .. @} or < .. >.")
+ (description . "Music playing together.
+
+SYNTAX
+
+@code{ \\simultaneous @{ .. @}} or < .. >.")
(internal-class-name . "Simultaneous_music")
(iterator-ctor . ,Simultaneous_music_iterator::constructor)
(fs (cdr (chain-assoc 'font-relative-size props)))
(entry (cons 'font-relative-size (- fs 1)))
)
- (interpret-markup
- grob (cons (list entry) props)
- (car rest))
-
- ))
+ (interpret-markup
+ grob (cons (list entry) props)
+ (car rest))
+ ))
(define-public (bigger-markup grob props . rest)
"Syntax: \\bigger MARKUP"