@itemize @bullet
@item @uref{../user/out-www/lilypond.html,LilyPond reference manual}
also available in @uref{../user/out-www/lilypond.ps.gz,Postscript}
+@item @uref{../user/out-www/backend.html,LilyPond backend reference}
@item @uref{../user/out-www/glossary.html,A glossary of musical
terms}, includes translations. Also available in @uref{../user/out-www/glossary.ps.gz,Postscript})
@item @uref{../user/out-www/mudela-book.html,mudela-book}, a tool for
ps: $(PS_FILES)
# urg
-default:
+default:
-local-WWW: $(HTML_FILES) $(datafiles) $(PS_GZ_FILES)
- $(PYTHON) $(step-bindir)/ls-latex.py --title 'User documentation' \
- $(DOC_FILES) $(TEX_FILES) $(TELY_FILES) \
- | sed "s!$(outdir)/!!g" > $(outdir)/index.html
+local-WWW: $(HTML_FILES) $(datafiles) $(PS_GZ_FILES) backdoc
+ true
+
+# $(PYTHON) $(step-bindir)/ls-latex.py --title 'User documentation' \
+# $(DOC_FILES) $(TEX_FILES) $(TELY_FILES) \
+# | sed "s!$(outdir)/!!g" > $(outdir)/index.html
$(outdir)/%.bib: %.bib
ln -f $< $@
localclean:
rm -f fonts.aux fonts.log feta*.tfm feta*.*pk
+
+#ugh. out/ hardcoded.
+backdoc:
+ (cd $(outdir); $(topdir)/lily/out/lilypond $(depth)/../ly/generate-documentation)
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.]}
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}
- Improved robustness: Lily almost never crashes.
-* Piano pedal support
+* Piano pedal support, Arpeggios
* MIDI: dynamics, tempo changes
--- /dev/null
+cpp -P -traditional -o l-fake.ly -DFAKE_GRACE les-nereides.ly
\ No newline at end of file
#(define (grace-beam-space-function multiplicity)
(* (if (<= multiplicity 3) 0.816 0.844) 0.8))
+%% cpp: don't start on first column
+ #(define (make-text-checker text)
+ (lambda (elt)
+ ;; huh, string-match undefined?
+ ;; (string-match text (ly-get-elt-property elt 'text))
+ (equal? text (ly-get-elt-property elt 'text))
+ ))
+
+
global = \notes{
\partial 2;
\key a \major;
\property Voice.NoteColumn \push #'horizontal-shift = #0
\outputproperty #(make-type-checker 'text-item-interface)
#'extra-offset = #'(-6 . 2)
+ %% *Style* = Large??
+ \property Voice.TextScript \push #'style = #"Large"
r2^"Allegretto scherzando"
+ \property Voice.TextScript \pop #'style
%2
\property Voice.Stem \pop #'direction
\property Voice.Stem \push #'direction = #1
r4 <cis\arpeggio eis a cis> r2
%3
r4 <cis\arpeggio fis a cis> r8.
+ % Huh, urg? Implicit \context Staff lifts us up to Staff context???
\translator Staff=bass
+ % Get back
+ \context Voice
+ \outputproperty #(make-text-checker "m.d.")
+ #'extra-offset = #'(-3 . -4)
+ % currently, this can't be (small) italic, because in the paperblock
+ % we set italic_magnifictation to get large italics.
cis,16^2^"m.d."( <fis8 fis,> <e! e,!>
%4
<)dis,4 a' dis>
+ % Urg, this lifts us up to staff context
\translator Staff=treble
+ % Get back
+ \context Voice
\property Voice.Slur \pop #'direction
\property Voice.Slur \push #'direction = #1
\property PianoStaff.connectArpeggios = ##t
\property Voice.TextSpanner \pop #'type
+
+ %% Ghostview is ok, but xdvi shows a solid line
+ \property Voice.TextSpanner \push #'line-thickness = #2
+ \property Voice.TextSpanner \push #'dash-period = #0.5
+
\property Voice.TextSpanner \push #'type = #"dotted-line"
\property Voice.TextSpanner \push #'edge-height = #'(0 . 1.5)
- \property Voice.TextSpanner \push #'edge-text = #'("8va " . "")
+ \property Voice.TextSpanner \push #'edge-text = #'("8 " . "")
+ % Huh, urg? Implicit \context Staff lifts us up to Staff context???
\property Staff."c0-position" = #-13
+ % Get back
+ \context Voice
+ \outputproperty #(make-text-checker "m.g.")
+ #'extra-offset = #'(-3 . -2)
+ % currently, this can't be (small) italic, because in the paperblock
+ % we set italic_magnifictation to get large italics.
cis''''4^"m.g."\arpeggio \spanrequest \start "text" (
#ifndef FAKE_GRACE
#else % FAKE_GRACE
+ \property Score.PaperColumn \push #'space-factor = #0.6
+ \property Score.PaperColumn \push #'to-musical-spacing-factor = #0.04
\property Voice.NoteHead \push #'font-size = #-1
\property Voice.Stem \push #'font-size = #-1
+ \property Voice.Stem \push #'length = #6
+ \property Voice.Stem \push #'beamed-lengths =
+ #(map (lambda (x) (* 1.25 x)) '(0.0 2.5 2.0 1.5))
+ \property Voice.Stem \push #'beamed-minimum-lengths =
+ #(map (lambda (x) (* 1.25 x)) '(0.0 1.5 1.25 1.0))
+
\property Voice.Beam \push #'font-size = #-1
\property Voice.TextScript \push #'font-size = #-1
+ \property Voice.Fingering \push #'font-size = #-1
\property Voice.Slur \push #'font-size = #-1
- \property Voice.LocalKey \push #'font-size = #-1
+ \property Staff.Accidentals \push #'font-size = #-1
\property Voice.Beam \push #'space-function = #grace-beam-space-function
)cis16
\property Voice.NoteHead \pop #'font-size
\property Voice.Stem \pop #'font-size
+ \property Voice.Stem \pop #'length
+ \property Voice.Stem \pop #'beamed-lengths
+ \property Voice.Stem \pop #'beamed-minimum-lengths
\property Voice.Beam \pop #'font-size
\property Voice.TextScript \pop #'font-size
+ \property Voice.Fingering \pop #'font-size
\property Voice.Slur \pop #'font-size
- \property Voice.LocalKey \pop #'font-size
+ \property Staff.Accidentals \pop #'font-size
\property Voice.Beam \pop #'space-function
-
+ \property Score.PaperColumn \pop #'space-factor
+ \property Score.PaperColumn \pop #'to-musical-spacing-factor
#endif % FAKE_GRACE
}
trebleTwo = \context Voice=trebleTwo \notes\relative c''{
- % Broken?
\property Voice.NoteColumn \push #'horizontal-shift = #1
s2
s1*2
s4
\property Voice.Stem \pop #'direction
\property Voice.Stem \push #'direction = #-1
- <cis4\arpeggio a fis dis>
+ <cis'4\arpeggio a fis dis>
#ifdef FAKE_GRACE
s32*16
#endif
\property Voice.NoteColumn \push #'force-hshift = #-0.2
- <e2 gis, e d>
- %r8 cis4. d4 [<cis8-5-4( e,-1> <b-3 d,-1> |
- r8 cis4. d4
+ <e,2 gis, e d!>
+ % Hmm s/r?
+ %r8 cis4. d4
+ s8 cis4. d4
\property Voice.NoteColumn \pop #'force-hshift
[<cis8( e,> <b-3 d,-1> |
\property Voice.NoteColumn \push #'force-hshift = #-0.2
}
bass = \context Voice=bass \notes\relative c{
- \property Voice.Slur \pop #'details
- \property Voice.Slur \push #'details =
-% #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 1.0))
- #'((height-limit . 6.0) (ratio . 0.333) (force-blowfit . 1.0) (beautiful . 0.1))
- \property Voice.Slur \pop #'de-uglify-parameters
- \property Voice.Slur \push #'de-uglify-parameters =
-% #'(1.5 0.8 -2.0)
- #'(2.4 0.8 4.0)
+ % Allow ugly slurs
+ \property Voice.Slur \push #'beautiful = #5.0
+ \property Voice.Slur \push #'attachment-offset = #'((0 . -3) . (0 . -6))
\property Voice.Stem \pop #'direction
\property Voice.Slur \push #'direction = #-1
% huh, auto-beamer?
r8. e,16-2( [<a8 a,> <b b,>] <cis4 cis,> |
%2
+ % Huh, urg? Implicit \context Staff lifts us up to Staff context???
\translator Staff=treble
+ % Get back
+ \context Voice
\property Voice.Stem \pop #'direction
\property Voice.Stem \push #'direction = #-1
\property Voice.slurEndAttachment = #'stem
<)a''4\arpeggio eis cis>
%\stemboth
\property Voice.slurEndAttachment = ##f
+ % Huh, urg? Implicit \context Staff lifts us up to Staff context???
\translator Staff=bass
+ % Get back
+ \context Voice
\property Voice.Stem \pop #'direction
\property Voice.Slur \pop #'y-free
\property Voice.Slur \push #'y-free = #0.1
+ \property Voice.Slur \pop #'attachment-offset
+ \property Voice.Slur \push #'attachment-offset = #'((0 . -3) . (0 . -8))
r8. cis,,16( <fis8 fis,> <gis gis,>
%3
\property Voice.Stem \pop #'length
\property Voice.Stem \push #'length = #5
<a4 a,>
+ % Huh, urg? Implicit \context Staff lifts us up to Staff context???
\translator Staff=treble
+ % Get back
+ \context Voice
\property Voice.Stem \pop #'length
\property Voice.Stem \pop #'direction
\property Voice.Stem \push #'direction = #-1
<)a'\arpeggio fis cis>
+ % Huh, urg? Implicit \context Staff lifts us up to Staff context???
\translator Staff=bass
+ % Get back
+ \context Voice
\property Voice.Stem \pop #'direction
r2
%4
- \property Voice.Slur \pop #'details
- \property Voice.Slur \push #'details =
- #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 0.5))
+ \property Voice.Slur \pop #'beautiful
+ \property Voice.Slur \pop #'attachment-offset
\property Voice.Stem \pop #'direction
\property Voice.Stem \push #'direction = #-1
<b,,4 b,>
%Hmm
%\grace { s16 s s s s32 s s s s \clef bass; s }
\clef bass;
+ \grace { <e,,,32( e,> } <)gis'2 e>
#else
- s4 s8 s32 s s \clef bass; s
-#endif
+ s4 s8 s32 s s \clef bass;
+ \property Score.PaperColumn \push #'space-factor = #0.6
+ \property Score.PaperColumn \push #'to-musical-spacing-factor = #0.1
+ \property Voice.NoteHead \push #'font-size = #-1
+ \property Voice.Stem \push #'font-size = #-1
+ \property Voice.Stem \push #'length = #6
+ \property Voice.Slur \push #'font-size = #-1
+ \property Voice.Slur \push #'attachment-offset = #'((-0.5 . 0) . (0.5 . 0))
+ <e,,,32( e,>
- \grace { <e,,,32( e,> } <)gis'2 e>
- %5%
+ \property Voice.NoteHead \pop #'font-size
+ \property Voice.Stem \pop #'font-size
+ \property Voice.Stem \pop #'length
+ \property Voice.Slur \pop #'font-size
+ \property Score.PaperColumn \pop #'space-factor
+ \property Score.PaperColumn \pop #'to-musical-spacing-factor
+ <)gis'2 e>
+ \property Voice.Slur \pop #'attachment-offset
+#endif
+ %5
\property Voice.Slur \pop #'direction
\property Voice.Slur \push #'direction = #1
a,8 [e'-5(<)a-2 cis-3>]
s8 s4
\outputproperty #(make-type-checker 'dynamic-interface)
- #'extra-offset = #'(0 . 3.5)
- s1\mf-"a tempo"
- s8
+ #'extra-offset = #'(0 . 4)
+ %s1\mf-"a tempo"
+ s2\mf-"a tempo" s4
+ \outputproperty #(make-type-checker 'crescendo-interface)
+ #'extra-offset = #'(0.5 . -1)
+ s\> \!s8
\outputproperty #(make-type-checker 'dynamic-interface)
- #'extra-offset = #'(-1 . 3.5)
+ #'extra-offset = #'(-1 . 4)
s8\mf s4 s4 s8\> s32 s s \!s
}
>
>
\paper {
+ %%BURP
+ magnification_italic = 1.;
\translator {
\ScoreContext
TimeSignature \push #'style = #"C"
+ SpacingSpanner \push #'maximum-duration-for-spacing = #(make-moment 1 4)
+
+ \remove Bar_number_engraver;
}
\translator {
\type "Engraver_group_engraver";
\name Dynamics;
\consists "Output_property_engraver";
Generic_property_list = #generic-voice-properties
- %Generic_property_list = #generic-lyrics-properties
\consists "Property_engraver";
DynamicsMinimumVerticalExtent = #(cons -3 -3)
- %VerticalAlignment \push #'threshold = #'(8 . 8)
- %VerticalAlignment \push #'threshold = #'(10 . 10)
VerticalAlignment \push #'threshold = #'(9 . 9)
startSustain = #"Ped."
stopStartSustain = #"*Ped."
startUnaChorda = #"una chorda"
stopUnaChorda = #"tre chorde"
- % should make separate lists for stopsustain and startsustain
\consists "Piano_pedal_engraver";
\consists "Script_engraver";
\consists "Text_engraver";
%GURGURGU, text is initialised using TextScript
TextScript \push #'style = #"italic"
- TextScript \push #'font-size = #2
+ %%% TextScript \push #'font-size = #2
\consists "Skip_req_swallow_translator";
\consistsend "Axis_group_engraver";
}
- \translator {
- \VoiceContext
- %TextScript \push #'style = #"italic"
- %TextScript \push #'font-size = #3
- TextScript \push #'size = #"Large"
- TextScript \push #'font-size = #"Large"
- }
\translator {
\PianoStaffContext
\accepts Dynamics;
- %VerticalAlignment \push #'threshold = #'(8 . 8)
- %VerticalAlignment \push #'threshold = #'(6 . 6)
VerticalAlignment \push #'threshold = #'(7 . 7)
}
\translator {
--- /dev/null
+%
+% Test new font selection and scm text markup
+%
+
+\score{
+ \notes\relative c''{
+ \stemUp
+ a-"text"
+ b-\textscript #"texta"
+ c-\textscript #'(bold "textb")
+
+ d-\textscript #'(lines "one" "two" "three")
+ e-\textscript #'(lines (bold "one")
+ (rows "and" "there" "is" ((family . "number") "2"))
+ (italic "three"))
+ f-\textscript #'(finger "3")
+ g-\textscript #'(music (named "noteheads-2"))
+ }
+ \paper{
+ linewidth = -1.\mm;
+ \translator{
+ \ScoreContext
+ TextScript \push #'font-family = #'roman
+ TextScript \pop #'no-spacing-rods
+ TextScript \push #'direction = #1
+ }
+ }
+}
STEPMAKE_TEMPLATES= c++ executable po help2man
include $(depth)/make/stepmake.make
+
+default:
+
+
# force these: Make can't know these have to be generated in advance
$(outdir)/my-lily-parser.o: $(outdir)/parser.hh
$(outdir)/my-lily-lexer.o: $(outdir)/parser.hh
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);
/*
We have to do a callback, because brew_molecule () triggers a
vertical alignment if it is cross-staff.
+ This callback also adds padding.
*/
MAKE_SCHEME_CALLBACK(Arpeggio, width_callback,2);
SCM
assert (a == X_AXIS);
Molecule arpeggio = me->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio");
- return ly_interval2scm (arpeggio.extent (X_AXIS));
+ return ly_interval2scm (arpeggio.extent (X_AXIS) * 1.5);
}
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"));
}
#include "score-element.hh"
#include "paper-column.hh"
#include "line-of-score.hh"
-
-/*
- TODO: move text lookup out of Chord_name
- */
-
-/*
- word is roman text or property-styled text:
- "text"
- ("text" . property-alist)
- */
-Molecule
-Chord_name::ly_word2molecule (Score_element * me, SCM word, Real* x)
-{
- *x = 0;
-
- SCM options_alist = SCM_EOL;
- if (gh_pair_p (word))
- {
- options_alist = gh_cdr (word);
- word = gh_car (word);
- }
-
- if (gh_string_p (word))
- {
- /*
- UGH. Should read from font metric structure.
- */
- Real ex = me->lookup_l ()->text ("", "x",
- me->paper_l ()).extent (Y_AXIS).length ();
- Real em = me->lookup_l ()->text ("", "m",
- me->paper_l ()).extent (X_AXIS).length ();
-
- String w = ly_scm2string (word);
-
- String style;
- SCM s = scm_assoc (ly_symbol2scm ("style"), options_alist);
- if (s != SCM_BOOL_F)
- {
- style = ly_scm2string (gh_cdr (s));
- }
-
- Offset offset;
- int size = 0;
- /*
- urg, `type'
- */
- s = scm_assoc (ly_symbol2scm ("type"), options_alist);
- if (s != SCM_BOOL_F && ly_scm2string (gh_cdr (s)) == "super")
- {
- Real super_y = ex / 2;
- offset = Offset (0, super_y);
- if (!size)
- size = -2;
- }
-
- s = scm_assoc (ly_symbol2scm ("size"), options_alist);
- if (s != SCM_BOOL_F)
- {
- size = gh_scm2int (gh_cdr (s));
- }
-
- s = scm_assoc (ly_symbol2scm ("offset"), options_alist);
- if (s != SCM_BOOL_F)
- {
- // hmm
- SCM o = gh_cdr (s);
- if (gh_pair_p (o))
- offset = Offset (0, gh_scm2double (gh_cdr (o))) * ex;
- *x = gh_scm2double (gh_car (o)) * em;
- }
-
- Molecule mol;
- s = scm_assoc (ly_symbol2scm ("font"), options_alist);
- if (s != SCM_BOOL_F && ly_scm2string (gh_cdr (s)) == "feta")
- mol = me->paper_l ()->lookup_l (size)->afm_find (w);
- else
- mol = me->paper_l ()->lookup_l (size)->text (style, w, me->paper_l ());
-
- mol.translate (offset);
- return mol;
- }
- return Molecule ();
-}
-
-/*
- ;; text: list of word
- ;; word: string + optional list of property
- ;; property: align, kern, font (?), size
- */
-Molecule
-Chord_name::ly_text2molecule (Score_element * me, SCM text)
-{
- Molecule mol;
- if (gh_list_p (text))
- {
- while (gh_cdr (text) != SCM_EOL)
- {
- Real x;
- Molecule m = ly_word2molecule (me, gh_car (text), &x);
- if (!m.empty_b ())
- mol.add_at_edge (X_AXIS, RIGHT, m, x);
- text = gh_cdr (text);
- }
- text = gh_car (text);
- }
- Real x;
- Molecule m = ly_word2molecule (me,text, &x);
- if (!m.empty_b ())
- mol.add_at_edge (X_AXIS, RIGHT, m, x);
- return mol;
-}
+#include "staff-symbol-referencer.hh"
+#include "text-item.hh"
MAKE_SCHEME_CALLBACK (Chord_name,after_line_breaking,1);
SCM
SCM func = me->get_elt_property (ly_symbol2scm ("chord-name-function"));
SCM text = gh_call3 (func, style, pitches, gh_cons (inversion, bass));
- return ly_text2molecule (me, text).create_scheme ();
+ SCM properties = gh_append2 (me->immutable_property_alist_,
+ me->mutable_property_alist_);
+ Molecule mol = Text_item::text2molecule (me, text, properties);
+
+ SCM space = me->get_elt_property ("word-space");
+ if (gh_number_p (space))
+ {
+ Molecule m;
+ m.set_empty (false);
+ mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)*
+ Staff_symbol_referencer::staff_space (me));
+ }
+
+ return mol.create_scheme ();
}
#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);
#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:
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
{
-/** 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:
#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:
{
public:
DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
- static Molecule ly_word2molecule (Score_element*, SCM scm, Real* x) ;
- static Molecule ly_text2molecule (Score_element*, SCM scm) ;
DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
};
#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 ));
* 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
{
#include "lily-guile.hh"
/**
- The hairpin symbol. (cresc)
-
- (normal spanner?)
+ The hairpin symbol.
*/
struct Crescendo
{
-/**
- 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));
#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:
#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:
#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
{
static Molecule dashed_slur (Bezier, Real thick, Real dash) ;
static Molecule blank (Box b) ;
static Molecule filledbox (Box b) ;
- static Molecule text (String style, String text, Paper_def*) ;
};
Lookup* unsmob_lookup (SCM);
#endif // LOOKUP_HH
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)
#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 () \
{ \
#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.
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_;
#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:
NoteHead is a kind of RhythmicHead, see there.
Read-only:
-
- style -- symbol that sets note head style
*/
class Note_head
#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:
#include "lily-guile.hh"
-/**
- A pause.
-
- See also Rhythmic_head, Staff_symbol_referencer.
-
- Read-only properties:
-
- style -- string specifying glyph style
- */
class Rest
{
public:
#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:
#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
{
#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
{
public:
- static void add_column (Score_element*me,Score_element*col);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ static void add_column (Score_element *me, Score_element *col);
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
static void set_interface (Score_element*);
static bool has_interface (Score_element*);
- static Array<Offset> get_encompass_offset_arr (Score_element*me) ;
- static Bezier get_curve (Score_element*me) ;
- static Direction get_default_dir (Score_element*me) ;
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
- DECLARE_SCHEME_CALLBACK(set_spacing_rods, (SCM ));
+ static Array<Offset> get_encompass_offset_arr (Score_element *me);
+ static Bezier get_curve (Score_element *me);
+ static Direction get_default_dir (Score_element *me);
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+ DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
+
private:
static Real get_first_notecolumn_y (Score_element *me, Direction dir);
static Offset broken_trend_offset (Score_element *me, Direction dir);
- static Offset get_attachment (Score_element*me,Direction dir, Score_element**common) ;
- static void de_uglyfy (Score_element*me,Slur_bezier_bow* bb, Real default_height);
- static void set_extremities (Score_element*me);
- static void set_control_points (Score_element*me);
- static Offset encompass_offset (Score_element*me,Score_element *col,Score_element**common);
+ static Offset get_attachment (Score_element *me,Direction dir, Score_element **common);
+ static void de_uglyfy (Score_element *me,Slur_bezier_bow* bb, Real default_height);
+ static void set_extremities (Score_element *me);
+ static void set_control_points (Score_element *me);
+ static void check_slope (Score_element *me);
+ static Offset encompass_offset (Score_element *me, Score_element *col, Score_element **common);
};
#endif // SLUR_HH
public: \
static SCM equal_p (SCM a, SCM b);\
static CL * unsmob (SCM);\
+ static SCM smob_p (SCM);\
static void init_smobs(); \
private:
#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
#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:
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
{
#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
#include "lily-proto.hh"
#include "lily-guile.hh"
-/*
- stem -- pointer to the stem object.
- */
class Stem_tremolo
{
public:
--- /dev/null
+/*
+ text-item.hh -- declare Text_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Jan Nieuwenhuizen <janneke@gnu.org>
+ */
+
+#ifndef TEXT_ITEM
+#define TEXT_ITEM
+
+#include "lily-guile.hh"
+#include "molecule.hh"
+
+class Text_item
+{
+public:
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+ static Molecule text2molecule (Score_element *me, SCM text, SCM properties);
+ static Molecule string2molecule (Score_element *me, SCM text, SCM properties);
+ static Molecule markup_sentence2molecule (Score_element *me, SCM markup_sentence, SCM properties);
+ static Molecule lookup_character (Score_element *me, SCM font_name, SCM text);
+ static Molecule lookup_text (Score_element *me, SCM font_name, SCM char_name);
+};
+
+#endif /* TEXT_ITEM */
#include "lily-proto.hh"
-/*
- heads -- pair of element pointers, pointing to the two heads of the
- tie. */
class Tie
{
public:
#include "spanner.hh"
-/** Volta bracket with number
-
-properties:
-
-bars -- list of barline ptrs.
-
-thickness -- in stafflinethickness
-
-height -- in staffspace
-
+/**
*/
class Volta_spanner
}
-/*
- TODO: THIS IS UGLY.
- Since the user has direct access to TeX marcos,
- that currently provide the only way to do
- font selection, accents etc,
- we try some halfbaked attempt to detect this TeX trickery.
- */
-String
-sanitise_TeX_string (String text)
-{
- int brace_count =0;
- for (int i= 0; i < text.length_i (); i++)
- {
- if (text[i] == '\\')
- continue;
-
- if (text[i] == '{')
- brace_count ++;
- else if (text[i] == '}')
- brace_count --;
- }
-
- if(brace_count)
- {
- warning (_f ("Non-matching braces in text `%s', adding braces", text.ch_C()));
-
- if (brace_count < 0)
- {
- text = to_str ('{', -brace_count) + text;
- }
- else
- {
- text = text + to_str ('}', brace_count);
- }
- }
-
- return text;
-}
-
-/**
- TODO!
- */
-String
-sanitise_PS_string (String t)
-{
- return t;
-}
-
-/**
-TODO: move into Text_item. UGH: paper_l argument shoudl be junked.
-*/
-Molecule
-Lookup::text (String style, String text, Paper_def *paper_l)
-{
- if (style.empty_b ())
- style = "roman";
-
- int font_mag = 0;
- Real font_h = paper_l->get_var ("font_normal");
- if (paper_l->scope_p_->elem_b ("font_" + style))
- {
- font_h = paper_l->get_var ("font_" + style);
- }
-
-
- if (paper_l->scope_p_->elem_b ("magnification_" + style))
- {
- font_mag = (int)paper_l->get_var ("magnification_" + style);
- }
-
- /*
- FIXME !
- */
-
- SCM l = scm_assoc (ly_str02scm (style.ch_C()),
- scm_eval2 (ly_symbol2scm ("cmr-alist"), SCM_EOL));
-
- if (l != SCM_BOOL_F)
- {
- style = ly_scm2string (gh_cdr(l)) +to_str ((int)font_h);
- }
-
- Font_metric* metric_l = 0;
-
- if (font_mag)
- metric_l = all_fonts_global_p->find_scaled (style, font_mag);
- else
- metric_l = all_fonts_global_p->find_font (style);
-
-
-
-
- int i = text.index_i ("\\n");
- while (i >=0 )
- {
- text = text.left_str (i) + "\n" + text.right_str (text.length_i () - i - 2);
- i = text.index_i ("\\n");
- }
-
- Array<String> lines = String_convert::split_arr (text, '\n');
-
- Real kern = paper_l->get_var ("line_kern");
-
- for (int i=0; i < lines.size (); i++)
- {
- String str (lines[i]);
- if (output_global_ch == "tex")
- str = sanitise_TeX_string (str);
- else if (output_global_ch == "ps")
- str = sanitise_PS_string (str);
- lines[i] = str;
- }
-
- if (!lines.size())
- return Molecule();
-
- SCM first = gh_list (ly_symbol2scm ("text"),
- ly_str02scm (lines[0].ch_C()),
- SCM_UNDEFINED);
- first = fontify_atom (metric_l, first);
-
-
-
- Molecule mol (metric_l->text_dimension (lines[0]), first);
-
- for (i = 1; i < lines.size (); i++)
- {
- SCM line = (gh_list (ly_symbol2scm ("text"),
- ly_str02scm (lines[i].ch_C ()),
- SCM_UNDEFINED));
- line = fontify_atom (metric_l, line);
- mol.add_at_edge (Y_AXIS, DOWN,
- Molecule (metric_l->text_dimension (lines[i]), line),
- kern);
- }
-
- return mol;
-}
-
-
-
/*
Make a smooth curve along the points
*/
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 ();
else if (Audio_time_signature* i = dynamic_cast<Audio_time_signature*> (a))
return new Midi_time_signature (i);
else if (Audio_text* i = dynamic_cast<Audio_text*> (a))
- return i->text_str_.length_i () ? new Midi_text (i) : 0;
+ //return i->text_str_.length_i () ? new Midi_text (i) : 0;
+ return new Midi_text (i);
else
assert (0);
audio_l_ = a;
}
-#if 0
-Midi_text::Midi_text (Midi_text::Type type, String text_str)
- : Audio_text ()
-{
- text_str_ = text_str;
- type_ = type;
-}
-#endif
-
String
Midi_text::str () const
{
IMPLEMENT_UNSMOB(Moment,moment);
IMPLEMENT_SIMPLE_SMOBS(Moment);
-
+IMPLEMENT_TYPE_P (Moment, "moment?");
SCM
Moment::mark_smob (SCM)
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);
#include "group-interface.hh"
#include "spanner.hh"
#include "staff-symbol-referencer.hh"
+#include "text-item.hh"
void
Multi_measure_rest::set_interface (Score_element*me)
if (measures > 1)
{
- Molecule s (me->lookup_l ()->text ("number", to_str (measures), me->paper_l ()));
+ SCM properties = gh_append2 (me->immutable_property_alist_,
+ me->mutable_property_alist_);
+ Molecule s =
+ Text_item::text2molecule (me,
+ ly_str02scm (to_str (measures).ch_C ()),
+ properties);
s.align_to (X_AXIS, CENTER);
s.translate_axis (3.0 * staff_space, Y_AXIS);
mol.add_molecule (s);
{"context", CONTEXT},
{"denies", DENIES},
{"duration", DURATION},
+ {"dynamicscript", DYNAMICSCRIPT},
+ {"elementdescriptions", ELEMENTDESCRIPTIONS},
{"font", FONT},
{"grace", GRACE},
{"header", HEADER},
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));
}
else
return ext;
+ if (!gh_pair_p (d->dimension_))
+ return ext;
+
ext = ly_scm2interval (d->dimension_);
SCM extra = get_elt_property (a == X_AXIS
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
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);
ADD_SCM_INIT_FUNC(scoreelt, init_functions);
-
+IMPLEMENT_TYPE_P(Score_element, "ly-element?");
{
Global_translator::prepare (w);
- SCM props = get_property (ly_symbol2scm ("PaperColumn"));
- set_columns (new Paper_column (props), new Paper_column (props));
+ set_columns (new Paper_column (get_property (ly_symbol2scm ("NonMusicalPaperColumn"))),
+ new Paper_column (get_property (ly_symbol2scm ("PaperColumn"))));
command_column_l_->set_elt_property ("when", w.make_scm());
musical_column_l_->set_elt_property ("when", w.make_scm());
[TODO]
* fix broken interstaff slurs
* begin and end should be treated as a/acknowledge Scripts.
- * broken slur should have uniform trend
* smart changing of endings
* smart changing of (Y-?)offsets to avoid ugly beziers
(along-side-stem)
return SCM_UNSPECIFIED;
}
+
void
-Slur::set_extremities (Score_element*me)
+Slur::check_slope (Score_element *me)
+{
+ /*
+ Avoid too steep slurs.
+ */
+ SCM s = me->get_elt_property ("slope-limit");
+ if (gh_number_p (s))
+ {
+ Array<Offset> encompass = get_encompass_offset_arr (me);
+ Drul_array<Offset> attachment;
+ attachment[LEFT] = encompass[0];
+ attachment[RIGHT] = encompass.top ();
+
+ Real dx = attachment[RIGHT][X_AXIS] - attachment[LEFT][X_AXIS];
+ Real dy = attachment[RIGHT][Y_AXIS] - attachment[LEFT][Y_AXIS];
+ if (!dx)
+ return;
+
+ Real slope = slope = abs (dy / dx);
+
+ Real limit = gh_scm2double (s);
+
+ if (slope > limit)
+ {
+ Real staff_space = Staff_symbol_referencer::staff_space ((Score_element*)me);
+ Direction dir = (Direction)gh_scm2int (me->get_elt_property ("direction"));
+ Direction d = (Direction)(- dir * (sign (dy)));
+ SCM a = me->get_elt_property ("attachment-offset");
+ Drul_array<Offset> o;
+ o[LEFT] = ly_scm2offset (index_cell (a, LEFT));
+ o[RIGHT] = ly_scm2offset (index_cell (a, RIGHT));
+ o[d][Y_AXIS] -= (limit - slope) * dx * dir / staff_space;
+ //o[d][Y_AXIS] = attachment[-d][Y_AXIS] + (dx * limit * dir / staff_space);
+ me->set_elt_property ("attachment-offset",
+ gh_cons (ly_offset2scm (o[LEFT]),
+ ly_offset2scm (o[RIGHT])));
+ }
+ }
+}
+
+void
+Slur::set_extremities (Score_element *me)
{
if (!Directional_element_interface::get (me))
- Directional_element_interface ::set (me,get_default_dir (me));
+ Directional_element_interface::set (me, get_default_dir (me));
Direction dir = LEFT;
do
}
}
while (flip (&dir) != LEFT);
+
+ check_slope (me);
}
+
Real
Slur::get_first_notecolumn_y (Score_element *me, Direction dir)
{
me->get_elt_property ("direction"));
Real neighbour_y = get_first_notecolumn_y (neighbour, dir);
Real y = get_first_notecolumn_y (me, -dir);
- o = Offset (0, (y + neighbour_y) / 2);
+ int neighbour_cols = scm_ilength (neighbour->get_elt_property ("note-columns"));
+ int cols = scm_ilength (me->get_elt_property ("note-columns"));
+ o = Offset (0, (y*neighbour_cols + neighbour_y*cols) /
+ (cols + neighbour_cols));
break;
}
}
}
Offset
-Slur::get_attachment (Score_element*me,Direction dir,
+Slur::get_attachment (Score_element *me, Direction dir,
Score_element **common)
{
SCM s = me->get_elt_property ("attachment");
SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s);
Spanner*sp = dynamic_cast<Spanner*>(me);
String str = ly_symbol2string (a);
- Real ss = Staff_symbol_referencer::staff_space ((Score_element*)me);
- Real hs = ss / 2.0;
+ Real staff_space = Staff_symbol_referencer::staff_space ((Score_element*)me);
+ Real hs = staff_space / 2.0;
Offset o;
Score_element *stem = 0;
Default position is centered in X, on outer side of head Y
*/
o += Offset (0.5 * n->extent (n,X_AXIS).length (),
- 0.5 * ss * Directional_element_interface::get (me));
+ 0.5 * staff_space
+ * Directional_element_interface::get (me));
}
else if (str == "alongside-stem")
{
*/
o += Offset (n->extent (n,X_AXIS).length ()
* (1 + Stem::get_direction (stem)),
- 0.5 * ss * Directional_element_interface::get (me));
+ 0.5 * staff_space
+ * Directional_element_interface::get (me));
}
else if (str == "stem")
{
if (l != SCM_BOOL_F)
{
- o += ly_scm2offset (gh_cdr (l)) * ss * dir;
+ o += ly_scm2offset (gh_cdr (l)) * staff_space * dir;
}
/*
- me->relative_coordinate (common[Y_AXIS], Y_AXIS);
}
+ o += ly_scm2offset (index_cell (me->get_elt_property ("attachment-offset"),
+ dir)) * staff_space;
return o;
}
}
Array<Offset>
-Slur::get_encompass_offset_arr (Score_element*me)
+Slur::get_encompass_offset_arr (Score_element *me)
{
Spanner*sp = dynamic_cast<Spanner*>(me);
SCM eltlist = me->get_elt_property ("note-columns");
- Score_element *common[] = {me->common_refpoint (eltlist,X_AXIS),
- me->common_refpoint (eltlist,Y_AXIS)};
+ Score_element *common[] = {me->common_refpoint (eltlist, X_AXIS),
+ me->common_refpoint (eltlist, Y_AXIS)};
common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
Real length = bb.curve_.control_[3][X_AXIS];
Real default_height = slur_height (length, h_inf, r_0);
- SCM ssb = scm_assq (ly_symbol2scm ("beautiful"), details);
- Real sb =gh_scm2double (gh_cdr (ssb));
+ SCM ssb = me->get_elt_property ("beautiful");
+ Real sb = 0;
+ if (gh_number_p (ssb))
+ sb = gh_scm2double (ssb);
bb.minimise_enclosed_area (me->paper_l(), sb);
SCM sbf = scm_assq (ly_symbol2scm ("force-blowfit"), details);
void
Spaceable_element::set_interface (Score_element*me)
{
+ me->set_interface (ly_symbol2scm ("spaceable-element-interface"));
}
Item* combinations[4][2]={{l,r}, {lb,r}, {l,rb},{lb,rb}};
+
+ /*
+ left refers to the space that is associated with items of the left column, so you have
+
+ LC <- left_space -><- right_space -> RC
+ <- total space ->
+
+
+ typically, right_space is non-zero when there are
+ accidentals in RC
+
+ */
for (int j=0; j < 4; j++)
{
Paper_column * lc = dynamic_cast<Paper_column*> (combinations[j][0]);
We want the space before barline to be like the note
spacing in the measure.
*/
+ SCM sfac =lc->get_elt_property ("space-factor");
if (Item::breakable_b (lc) || lc->original_l_)
- s.strength_f_ = non_musical_space_strength;
- else if (!lc->musical_b ())
- left_distance *= me->paper_l ()->get_var ("decrease_nonmus_spacing_factor");
+ s.strength_f_ = non_musical_space_strength;
+ else if (gh_number_p (sfac))
+ left_distance *= gh_scm2double (sfac);
Real right_dist = 0.0;
/*
don't want to create too much extra space for accidentals
*/
- if (lc->musical_b () && rc->musical_b ())
- {
- if (!to_boolean (rc->get_elt_property ("contains-grace")))
- right_dist *= me->paper_l ()->get_var ("musical_to_musical_left_spacing_factor");
- }
+ if (rc->musical_b ())
+ {
+ if (to_boolean (rc->get_elt_property ("contains-grace")))
+ right_dist *= me->paper_l ()->get_var ("before_grace_spacing_factor"); // fixme.
+ else
+ right_dist *= gh_scm2double (lc->get_elt_property ("before-musical-spacing-factor"));
+ }
- if (rc->musical_b () && to_boolean (rc->get_elt_property ("contains-grace")))
- right_dist *= me->paper_l ()->get_var ("before_grace_spacing_factor");
-
s.distance_f_ = left_distance + right_dist;
Real stretch_dist = 0.;
#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"
source file of the GNU LilyPond music typesetter
- (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
+ (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "debug.hh"
-#include "molecule.hh"
+#include "text-item.hh"
#include "paper-def.hh"
#include "lookup.hh"
#include "staff-symbol-referencer.hh"
+#include "staff-symbol-referencer.hh"
+#include "main.hh"
+#include "all-font-metrics.hh"
+#include "afm.hh"
+
+/*
+ text: string | (markup sentence)
+ markup: markup-symbol | (markup-symbol . parameter)
+ sentence: text | sentence text
+
+
+ Properties:
+
+ * Font:
+ ---* Type:
+ ------* Series: medium, bold
+ ------* Shape: upright, italic, slanted
+ ------* Family: roman, music, orator, typewriter
+
+ ---* Size:
+ ------* size: ...,-2,-1,0,1,2,... (style-sheet -> cmrXX, fetaXX)
+ ------* points: 11,13,16,20,23,26 (for feta)
+ ------* magnification: UNSIGNED
+
+ * Typesetting:
+ ---* kern: INT (staff-space)
+ ---* align: horizontal/vertical / lines / rows
+ */
+Molecule
+Text_item::text2molecule (Score_element *me, SCM text, SCM properties)
+{
+ if (gh_string_p (text))
+ return string2molecule (me, text, properties);
+ else if (gh_list_p (text))
+ {
+ if (!gh_pair_p (gh_car (text)) && gh_string_p (gh_car (text)))
+ return string2molecule (me, gh_car (text), properties);
+ else
+ return markup_sentence2molecule (me, text, properties);
+ }
+ return Molecule ();
+}
+
+static
+SCM
+get_elt_property (Score_element *me, char const *name)
+{
+ SCM s = me->get_elt_property (name);
+ if (s == SCM_EOL)
+ error (_f ("No `%s' defined for %s", name, me->name ()));
+ return s;
+}
+
+Molecule
+Text_item::string2molecule (Score_element *me, SCM text, SCM properties)
+{
+ SCM style = scm_assoc (ly_symbol2scm ("font-style"), properties);
+ SCM paper = me->get_elt_property ("style-sheet");
+ if (paper == SCM_EOL)
+ paper = scm_string_to_symbol (me->paper_l ()->get_scmvar ("style_sheet"));
+
+ SCM font_name;
+ if (gh_pair_p (style))
+ {
+ SCM f = get_elt_property (me, "style-to-font-name");
+ font_name = gh_call2 (f, paper, gh_cdr (style));
+ }
+ else
+ {
+ SCM f = get_elt_property (me, "properties-to-font-name");
+ font_name = gh_call2 (f, paper, properties);
+ }
+
+ // should move fallback to scm
+ if (!gh_string_p (font_name))
+ font_name = ly_str02scm ("cmr10");
+
+ SCM lookup = scm_assoc (ly_symbol2scm ("lookup"), properties);
+
+ Molecule mol;
+ if (gh_pair_p (lookup) && ly_symbol2string (gh_cdr (lookup)) == "name")
+ mol = lookup_character (me, font_name, text);
+ else
+ mol = lookup_text (me, font_name, text);
+
+ return mol;
+}
-struct Text_item
+/*
+ caching / use some form of Lookup without 'paper'?
+*/
+Molecule
+Text_item::lookup_character (Score_element *me, SCM font_name, SCM char_name)
{
- DECLARE_SCHEME_CALLBACK( brew_molecule, (SCM));
-};
+ Adobe_font_metric *afm = all_fonts_global_p->find_afm (ly_scm2string (font_name));
+ if (!afm)
+ {
+ warning (_f ("can't find font: `%s'", ly_scm2string (font_name)));
+ warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
+ error (_ ("Aborting"));
+ }
+
+ AFM_CharMetricInfo const *metric =
+ afm->find_char_metric (ly_scm2string (char_name), true);
-MAKE_SCHEME_CALLBACK(Text_item,brew_molecule,1);
+ if (!metric)
+ {
+ Molecule m;
+ m.set_empty (false);
+ return m;
+ }
+
+ SCM list = gh_list (ly_symbol2scm ("char"),
+ gh_int2scm (metric->code),
+ SCM_UNDEFINED);
+
+ list = fontify_atom (afm, list);
+ return Molecule (afm_bbox_to_box (metric->charBBox), list);
+}
+Molecule
+Text_item::lookup_text (Score_element *me, SCM font_name, SCM text)
+{
+ SCM magnification = me->get_elt_property ("font-magnification");
+ Font_metric* metric = 0;
+ if (gh_number_p (magnification))
+ metric = all_fonts_global_p->find_scaled (ly_scm2string (font_name),
+ gh_scm2int (magnification));
+ else
+ metric = all_fonts_global_p->find_font (ly_scm2string (font_name));
+
+ SCM list = gh_list (ly_symbol2scm ("text"), text, SCM_UNDEFINED);
+ list = fontify_atom (metric, list);
+
+ return Molecule (metric->text_dimension (ly_scm2string (text)), list);
+}
+
+Molecule
+Text_item::markup_sentence2molecule (Score_element *me, SCM markup_sentence,
+ SCM properties)
+{
+ SCM markup = gh_car (markup_sentence);
+ SCM sentence = gh_cdr (markup_sentence);
+ SCM f = get_elt_property (me, "markup-to-properties");
+ SCM p = gh_cons (gh_call1 (f, markup), properties);
+
+ Axis align = X_AXIS;
+ SCM a = scm_assoc (ly_symbol2scm ("align"), p);
+ if (gh_pair_p (a) && gh_number_p (gh_cdr (a)))
+ align = (Axis)gh_scm2int (gh_cdr (a));
+
+ Molecule mol;
+ while (gh_pair_p (sentence))
+ {
+ Molecule m = text2molecule (me, gh_car (sentence), p);
+ if (!m.empty_b ())
+ mol.add_at_edge (align, align == X_AXIS ? RIGHT : DOWN, m, 0);
+ sentence = gh_cdr (sentence);
+ }
+ return mol;
+}
+
+MAKE_SCHEME_CALLBACK (Text_item, brew_molecule, 1);
SCM
-Text_item::brew_molecule (SCM sm)
+Text_item::brew_molecule (SCM smob)
{
- Score_element * s = unsmob_element (sm);
+ Score_element *me = unsmob_element (smob);
- SCM style = s->get_elt_property ("style");
- String st = gh_string_p (style) ? ly_scm2string (style) : "";
- SCM txt = s-> get_elt_property ("text");
- String t = gh_string_p (txt) ? ly_scm2string (txt) : "";
+ SCM text = me->get_elt_property ("text");
+
+ SCM properties = gh_append2 (me->immutable_property_alist_,
+ me->mutable_property_alist_);
- Molecule mol = s->paper_l ()->lookup_l(0)->text (st, t, s->paper_l ());
+ Molecule mol = Text_item::text2molecule (me, text, properties);
- SCM space = s->get_elt_property ("word-space");
+ SCM space = me->get_elt_property ("word-space");
if (gh_number_p (space))
{
Molecule m;
m.set_empty (false);
- mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)*
- Staff_symbol_referencer::staff_space (s));
+ mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)
+ * Staff_symbol_referencer::staff_space (me));
}
return mol.create_scheme ();
}
-
*/
#include "molecule.hh"
+#include "text-item.hh"
#include "text-spanner.hh"
#include "spanner.hh"
#include "lookup.hh"
#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
}
while (flip (&d) != LEFT);
+#if 0
SCM s = me->get_elt_property ("text-style");
+
String text_style = "italic";
if (gh_string_p (s))
text_style = ly_scm2string (s);
-
+#endif
+
+ SCM properties = gh_append2 (me->immutable_property_alist_,
+ me->mutable_property_alist_);
SCM edge_text = me->get_elt_property ("edge-text");
Drul_array<Molecule> edge;
if (gh_pair_p (edge_text))
Direction d = LEFT;
do
{
- String text = ly_scm2string (index_cell (edge_text, d));
- edge[d] = me->lookup_l ()->text (text_style, text, me->paper_l ());
+ SCM text = index_cell (edge_text, d);
+ edge[d] = Text_item::text2molecule (me, text, properties);
if (!edge[d].empty_b ())
edge[d].align_to (Y_AXIS, CENTER);
}
shorten[LEFT] = 0;
shorten[RIGHT] = 0;
- s = me->get_elt_property ("shorten");
+ SCM s = me->get_elt_property ("shorten");
if (gh_pair_p (s))
{
shorten[LEFT] = gh_scm2double (gh_car (s)) * staff_space;
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;
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) ;
}
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
#include "molecule.hh"
+#include "text-item.hh"
#include "time-signature.hh"
#include "paper-def.hh"
#include "lookup.hh"
Molecule
Time_signature::time_signature (Score_element*me,int num, int den)
{
- String sty = "timesig";
-
/*
UGH: need to look at fontsize.
+ TODO: specify using scm markup.
*/
- Molecule n (me->lookup_l ()->text (sty, to_str (num), me->paper_l ()));
- Molecule d (me->lookup_l ()->text (sty, to_str (den), me->paper_l ()));
+ SCM properties = gh_append2 (me->immutable_property_alist_,
+ me->mutable_property_alist_);
+ Molecule n = Text_item::text2molecule (me,
+ ly_str02scm (to_str (num).ch_C ()),
+ properties);
+ Molecule d = Text_item::text2molecule (me,
+ ly_str02scm (to_str (den).ch_C ()),
+ properties);
n.align_to (X_AXIS, CENTER);
d.align_to (X_AXIS, CENTER);
Molecule m;
*/
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
{
#include "molecule.hh"
#include "paper-column.hh"
#include "paper-def.hh"
+#include "text-item.hh"
#include "tuplet-spanner.hh"
#include "stem.hh"
#include "note-column.hh"
SCM number = me->get_elt_property ("text");
if (gh_string_p (number) && number_visibility)
{
- Molecule
- num (me->lookup_l ()->text ("italic",
- ly_scm2string (number), me->paper_l ()));
+ SCM properties = gh_append2 (me->immutable_property_alist_,
+ me->mutable_property_alist_);
+ Molecule num = Text_item::text2molecule (me, number, properties);
num.align_to (X_AXIS, CENTER);
num.translate_axis (w/2, X_AXIS);
num.align_to (Y_AXIS, CENTER);
#include "molecule.hh"
#include "paper-column.hh"
#include "paper-def.hh"
+#include "text-item.hh"
#include "volta-spanner.hh"
#include "group-interface.hh"
#include "side-position-interface.hh"
SCM_UNDEFINED));
Box b (Interval (0, w), Interval (0, h));
- Molecule mol (b, at);
- Molecule num (me->lookup_l ()->text ("volta",
- ly_scm2string (me->get_elt_property("text")),
- me->paper_l ()));
+ Molecule mol (b, at);
+ SCM text = me->get_elt_property("text");
+ SCM properties = gh_append2 (me->immutable_property_alist_,
+ me->mutable_property_alist_);
+ Molecule num = Text_item::text2molecule (me, text, properties);
mol.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length ()
- staff_space);
-%{
- chord modifiers
-%}
-
-% UGR
-#(eval-string (ly-gulp-file "chord-names.scm"))
-
% urg!
%
% ugh
\include "midi.ly"
-\include "textscripts.ly"
+\include "dynamic-scripts.ly"
\include "spanners.ly"
\include "property.ly"
longa = \duration #'( -2 0 )
maxima = \duration #'( -3 0 )
-
-#(begin
- (eval-string (ly-gulp-file "slur.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
stop = 1
smaller = -1
bigger = 1
-
center=0
break = \penalty -1000000;
melisma = \property Staff.melismaBusy = ##t
melismaEnd = \property Staff.melismaBusy = ##f
-
-
-
papersize = "a4"
+
\include "engraver.ly"
\include "generic-paper.ly"
\include "paper20.ly"
% ugh
\include "midi.ly"
-\include "textscripts.ly"
+\include "dynamic-scripts.ly"
\include "spanners.ly"
\include "property.ly"
-
unusedEntry = \notes { c4 } % reset default duration
% music = "\melodic\relative c"
--- /dev/null
+
+%
+% declare the standard dynamic identifiers.
+%
+
+ppp = \dynamicscript #"ppp"
+pp = \dynamicscript #"pp"
+p = \dynamicscript #"p"
+mp = \dynamicscript #"mp"
+mf = \dynamicscript #"mf"
+f = \dynamicscript #"e" % see feta-din layout
+ff = \dynamicscript #"ff"
+fff = \dynamicscript #"fff"
+fp = \dynamicscript #"fp"
+
+sf = \dynamicscript #"sf"
+sfp = \dynamicscript #"sfp"
+sff = \dynamicscript #"sff"
+sfz = \dynamicscript #"sfz"
+fz = \dynamicscript #"fz"
+sp = \dynamicscript #"sp"
+spp = \dynamicscript #"spp"
+rfz = \dynamicscript #"rfz"
+
--- /dev/null
+
+#(eval-string (ly-gulp-file "generate-documentation.scm"))
;
(define (default-beam-flag-width-function type)
(cond
- ((eq? type 1) 1.98)
- ((eq? type 1) 1.65)
+ ((eq? type 1) 1.98)
+ ((eq? type 1) 1.65) ;; FIXME: check what this should be and why
(else 1.32)
))
;
(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)
(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))
)
)
--- /dev/null
+
+;;;;
+;
+; This file generates documentation for the backend of lilypond.
+;
+;;;;
+
+
+(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) (procedure? 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 char?) "char")
+ ((eq? predicate input-port?) "input port")
+ ((eq? predicate output-port?) "output port")
+ ((eq? predicate vector?) "vector")
+ ((eq? predicate procedure?) "procedure")
+ (else "(unknown)")
+ ))
+
+(define (htmlfy x)
+ (let*
+ ((x1 (regexp-substitute/global #f ">" x 'pre ">" 'post))
+ (x2 (regexp-substitute/global #f "<" x1 'pre "<" 'post))
+ )
+ x2))
+
+(define (scm->string val)
+ (string-append
+ (if (self-evaluating? val) "" "'")
+ (htmlfy
+ (call-with-output-string (lambda (port) (display val port))))
+ ))
+
+(define (document-property prop desc)
+ (let ((handle (assoc (car prop) desc)))
+ (string-append
+ "\n<li><code>" (symbol->string (car prop)) "</code> (" (type-name (cadr prop)) ") -- "
+ (caddr prop)
+ "<br>default value: <code>"
+ (if (pair? handle)
+ (scm->string (cdr handle))
+ "not set"
+ )
+ "</code>\n"
+ )
+ ))
+
+(define (document-interface interface elt-description)
+ (let* ((name (car interface))
+ (desc (cadr interface))
+ (props (caddr interface))
+ (docs (map (lambda (x) (document-property x elt-description))
+ props))
+ )
+
+ (string-append
+ "<hr>"
+ "<h2>Interface: " (symbol->string name) "</h2>\n"
+ desc
+ "<hr>\n<ul>"
+ (apply string-append docs)
+ "</ul>"
+ )
+ ))
+
+;
+; generate HTML, return filename.
+;
+(define (document-element description)
+ (let* ((metah (assoc 'meta description))
+ (meta (if (pair? metah)
+ (cdr metah)
+ '((properties . ()) (name . "huh?"))
+ ))
+
+ (name (cdr (assoc 'name meta)))
+ (ifaces (cdr (assoc 'interface-descriptions meta)))
+ (ifacedoc (map (lambda (x) (document-interface x description))
+ ifaces))
+ (outname (string-append name ".html"))
+ (out (open-output-file outname))
+ )
+ (display (string-append "Writing " outname " ... \n") (current-error-port))
+ (display
+ (string-append "<title>LilyPond Element " name " </title>"
+ "<h1>" name "</h1>"
+ (apply string-append ifacedoc))
+ out)
+ outname
+ )
+ )
+
+(define (document-elements elts)
+ (let* ((files (map (lambda (x) (document-element (cdr x)))
+ elts))
+ (outname (string-append "backend.html"))
+ (out (open-output-file outname))
+ (l (map (lambda (x) (string-append
+ "<li><a href=" x ">" x "</a>\n"))
+ files))
+ )
+
+ (display
+ (string-append
+ "<title>LilyPond backend documentation</title>"
+ "<h1>LilyPond backend documentation</h1>"
+ "<ul>"
+ (apply string-append l)
+ "</ul>"
+ )
+ out
+ )
+ ))
+
+; (display (document-interface stem-interface '()))
+; (define b (cdr (assoc 'Beam all-element-descriptions)))
+;(display b)
+
+;(document-element b)
+
+(document-elements all-element-descriptions)
+
;
+; We should repartition the entire scm side of lily in a
+; more sane way, using namesspaces/modules?
+
;(debug-enable 'backtrace)
;;; library funtions
(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)
(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:
(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"))
+ )
(define default-basic-slur-properties
`(
- (interfaces . (slur-interface))
(molecule-callback . ,Slur::brew_molecule)
(thickness . 1.2)
(spacing-procedure . ,Slur::set_spacing_rods)
(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)))
+ (details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5)))
+ (beautiful . 0.5)
(y-free . 0.75)
- (name . "Slur")
+ (attachment-offset . ((0 . 0) . (0 . 0)))
+ (slope-limit . 0.8)
+ (meta . ,(element-description "Slur" general-element-interface slur-interface))
)
)
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):
identify()
+e = None
for f in files:
if f == '-':
f = ''
#!@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:
}
}
-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<match>\\mbinput{?([^}\t \n}]*))',
'landscape': no_match,
'verbatim': r"""(?s)(?P<code>@example\s.*?@end example\s)""",
'verb': r"""(?P<code>@code{.*?})""",
- 'mudela-file': '(?P<match>@mudelafile(\[(?P<options>.*?)\])?{(?P<filename>[^}]+)})',
+ 'mudela-file': '(?m)^(?!@c)(?P<match>@mudelafile(\[(?P<options>.*?)\])?{(?P<filename>[^}]+)})',
'mudela' : '(?m)^(?!@c)(?P<match>@mudela(\[(?P<options>.*?)\])?{(?P<code>.*?)})',
- #ugh add check for @c
'mudela-block': r"""(?m)^(?!@c)(?P<match>(?s)(?P<match>@mudela(\[(?P<options>.*?)\])?\s(?P<code>.*?)@end mudela\s))""",
'option-sep' : ', *',
'intertext': r',?\s*intertext=\".*?\"',
- #ugh fix
'multiline-comment': r"(?sm)^\s*(?!@c\s+)(?P<code>@ignore\s.*?@end ignore)\s",
'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>@c.*$\n+))",
'numcols': no_match,
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)
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):
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))`
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']
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)