From: fred Date: Wed, 27 Mar 2002 00:01:27 +0000 (+0000) Subject: lilypond-1.3.97 X-Git-Tag: release/1.5.59~1206 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7e7e6be046cfd1e4164351126c17225c30e8a7d3;p=lilypond.git lilypond-1.3.97 --- diff --git a/Documentation/index.texi b/Documentation/index.texi index 3b1f3e2258..6ed47693cf 100644 --- a/Documentation/index.texi +++ b/Documentation/index.texi @@ -22,6 +22,7 @@ @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 diff --git a/Documentation/user/GNUmakefile b/Documentation/user/GNUmakefile index 6b7186af4b..98e71f00e6 100644 --- a/Documentation/user/GNUmakefile +++ b/Documentation/user/GNUmakefile @@ -28,12 +28,14 @@ dvi: $(DVI_FILES) 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 $< $@ @@ -42,3 +44,7 @@ $(outdir)/%.bib: %.bib 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) 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/input/emacs-lily.fly b/input/emacs-lily.fly new file mode 100644 index 0000000000..1fda480437 --- /dev/null +++ b/input/emacs-lily.fly @@ -0,0 +1 @@ +cpp -P -traditional -o l-fake.ly -DFAKE_GRACE les-nereides.ly \ No newline at end of file diff --git a/input/les-nereides.ly b/input/les-nereides.ly index 79a08e0f8e..36eeadb3c2 100644 --- a/input/les-nereides.ly +++ b/input/les-nereides.ly @@ -19,6 +19,15 @@ cpp -P -traditional -o l-fake.ly -DFAKE_GRACE les-nereides.ly #(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; @@ -40,26 +49,51 @@ treble = \context Voice=treble \notes\relative c''{ \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 r2 %3 r4 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."( %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 @@ -84,12 +118,21 @@ treble = \context Voice=treble \notes\relative c''{ #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 @@ -103,12 +146,17 @@ treble = \context Voice=treble \notes\relative c''{ \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 @@ -121,23 +169,23 @@ treble = \context Voice=treble \notes\relative c''{ } 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 - + #ifdef FAKE_GRACE s32*16 #endif \property Voice.NoteColumn \push #'force-hshift = #-0.2 - - %r8 cis4. d4 [ | - r8 cis4. d4 + + % Hmm s/r? + %r8 cis4. d4 + s8 cis4. d4 \property Voice.NoteColumn \pop #'force-hshift [ | \property Voice.NoteColumn \push #'force-hshift = #-0.2 @@ -148,47 +196,55 @@ trebleTwo = \context Voice=trebleTwo \notes\relative c''{ } 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( [ ] | %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( %3 \property Voice.Stem \pop #'length \property Voice.Stem \push #'length = #5 + % 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 @@ -205,12 +261,28 @@ bass = \context Voice=bass \notes\relative c{ %Hmm %\grace { s16 s s s s32 s s s s \clef bass; s } \clef bass; + \grace { } <)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)) + - \grace { } <)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>] @@ -266,11 +338,14 @@ middleDynamics = \context Dynamics=middle \notes{ 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 } @@ -335,20 +410,22 @@ lowerDynamics = \context Dynamics=lower \notes{ > > \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." @@ -356,7 +433,6 @@ lowerDynamics = \context Dynamics=lower \notes{ stopStartSustain = #"*Ped." startUnaChorda = #"una chorda" stopUnaChorda = #"tre chorde" - % should make separate lists for stopsustain and startsustain \consists "Piano_pedal_engraver"; \consists "Script_engraver"; @@ -364,25 +440,16 @@ lowerDynamics = \context Dynamics=lower \notes{ \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 { diff --git a/input/test/markup.ly b/input/test/markup.ly new file mode 100644 index 0000000000..ccd03f18a9 --- /dev/null +++ b/input/test/markup.ly @@ -0,0 +1,28 @@ +% +% 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 + } + } +} diff --git a/lily/GNUmakefile b/lily/GNUmakefile index 254cf67f78..d81ea7813c 100644 --- a/lily/GNUmakefile +++ b/lily/GNUmakefile @@ -14,6 +14,10 @@ HELP2MAN_EXECS = lilypond 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 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/arpeggio.cc b/lily/arpeggio.cc index 7f889715db..68226226ab 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -84,6 +84,7 @@ Arpeggio::brew_molecule (SCM smob) /* 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 @@ -94,5 +95,5 @@ Arpeggio::width_callback (SCM smob, SCM axis) 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); } 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/chord-name.cc b/lily/chord-name.cc index 19650961e2..523de92f6b 100644 --- a/lily/chord-name.cc +++ b/lily/chord-name.cc @@ -13,117 +13,8 @@ #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 @@ -169,5 +60,18 @@ Chord_name::brew_molecule (SCM smob) 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 (); } 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/chord-name.hh b/lily/include/chord-name.hh index b4825593ba..d0f620a2c4 100644 --- a/lily/include/chord-name.hh +++ b/lily/include/chord-name.hh @@ -22,8 +22,6 @@ class Chord_name { 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 )); }; 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/lookup.hh b/lily/include/lookup.hh index 88f48b2603..80e47c21ac 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -42,7 +42,6 @@ public: 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 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/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 797bdc321b..c788b68e0f 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -12,57 +12,29 @@ #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 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 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 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/text-item.hh b/lily/include/text-item.hh new file mode 100644 index 0000000000..507627b5a2 --- /dev/null +++ b/lily/include/text-item.hh @@ -0,0 +1,27 @@ +/* + text-item.hh -- declare Text_item + + source file of the GNU LilyPond music typesetter + + (c) 1998--2000 Han-Wen Nienhuys + Jan Nieuwenhuizen + */ + +#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 */ 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/lookup.cc b/lily/lookup.cc index 62ad7fbb91..bdfbd7c158 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -196,147 +196,6 @@ Lookup::frame (Box b, Real thick) } -/* - 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 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 */ 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/midi-item.cc b/lily/midi-item.cc index 9806910b55..bf1bef9b96 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -35,7 +35,8 @@ Midi_item::midi_p (Audio_item* a) else if (Audio_time_signature* i = dynamic_cast (a)) return new Midi_time_signature (i); else if (Audio_text* i = dynamic_cast (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); @@ -535,15 +536,6 @@ Midi_text::Midi_text (Audio_text* a) 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 { 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/multi-measure-rest.cc b/lily/multi-measure-rest.cc index fbe8996a31..b572aa9b14 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -18,6 +18,7 @@ #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) @@ -130,7 +131,12 @@ Multi_measure_rest::brew_molecule (SCM smob) 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); diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index c85b0a398e..1f0033f86f 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -43,6 +43,8 @@ static Keyword_ent the_key_tab[]={ {"context", CONTEXT}, {"denies", DENIES}, {"duration", DURATION}, + {"dynamicscript", DYNAMICSCRIPT}, + {"elementdescriptions", ELEMENTDESCRIPTIONS}, {"font", FONT}, {"grace", GRACE}, {"header", HEADER}, 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/score-engraver.cc b/lily/score-engraver.cc index cb3577a163..187f1b689a 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -32,8 +32,8 @@ Score_engraver::prepare (Moment w) { 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()); diff --git a/lily/slur.cc b/lily/slur.cc index 38d163fde7..1ac4b5cf79 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -11,7 +11,6 @@ [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) @@ -122,11 +121,53 @@ Slur::after_line_breaking (SCM smob) 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 encompass = get_encompass_offset_arr (me); + Drul_array 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 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 @@ -148,8 +189,11 @@ Slur::set_extremities (Score_element*me) } } while (flip (&dir) != LEFT); + + check_slope (me); } + Real Slur::get_first_notecolumn_y (Score_element *me, Direction dir) { @@ -199,7 +243,10 @@ Slur::broken_trend_offset (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; } } @@ -208,7 +255,7 @@ Slur::broken_trend_offset (Score_element *me, Direction dir) } 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"); @@ -220,8 +267,8 @@ Slur::get_attachment (Score_element*me,Direction dir, SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s); Spanner*sp = dynamic_cast(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; @@ -239,7 +286,8 @@ Slur::get_attachment (Score_element*me,Direction dir, Default position is centered in X, on outer side of head Y */ o += Offset (0.5 * n->extent (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") { @@ -249,7 +297,8 @@ Slur::get_attachment (Score_element*me,Direction dir, */ 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") { @@ -295,7 +344,7 @@ int stemdir = stem ? Stem::get_direction (stem) : 1; if (l != SCM_BOOL_F) { - o += ly_scm2offset (gh_cdr (l)) * ss * dir; + o += ly_scm2offset (gh_cdr (l)) * staff_space * dir; } /* @@ -308,6 +357,8 @@ int stemdir = stem ? Stem::get_direction (stem) : 1; - me->relative_coordinate (common[Y_AXIS], Y_AXIS); } + o += ly_scm2offset (index_cell (me->get_elt_property ("attachment-offset"), + dir)) * staff_space; return o; } @@ -356,12 +407,12 @@ Slur::encompass_offset (Score_element*me, } Array -Slur::get_encompass_offset_arr (Score_element*me) +Slur::get_encompass_offset_arr (Score_element *me) { Spanner*sp = dynamic_cast(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); @@ -498,8 +549,10 @@ Slur::set_control_points (Score_element*me) 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); 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/spacing-spanner.cc b/lily/spacing-spanner.cc index a1f329fc37..c5b306092a 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -75,6 +75,18 @@ Spacing_spanner::do_measure (Score_element*me, Link_array cols) 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 (combinations[j][0]); @@ -115,10 +127,11 @@ Spacing_spanner::do_measure (Score_element*me, Link_array cols) 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; @@ -135,15 +148,14 @@ Spacing_spanner::do_measure (Score_element*me, Link_array cols) /* 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.; 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-item.cc b/lily/text-item.cc index feca94f884..2d8f9bbe22 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -3,45 +3,199 @@ source file of the GNU LilyPond music typesetter - (c) 1998--2000 Han-Wen Nienhuys - + (c) 1998--2000 Han-Wen Nienhuys + Jan Nieuwenhuizen */ #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 (); } - diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 4b658b0a5b..cfd1bd292f 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -7,6 +7,7 @@ */ #include "molecule.hh" +#include "text-item.hh" #include "text-spanner.hh" #include "spanner.hh" #include "lookup.hh" @@ -17,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 @@ -63,11 +47,16 @@ Text_spanner::brew_molecule (SCM smob) } 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 edge; if (gh_pair_p (edge_text)) @@ -75,8 +64,8 @@ Text_spanner::brew_molecule (SCM smob) 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); } @@ -87,7 +76,7 @@ Text_spanner::brew_molecule (SCM smob) 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; @@ -161,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/time-signature.cc b/lily/time-signature.cc index 2912f3b37a..503b24003d 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -9,6 +9,7 @@ #include "molecule.hh" +#include "text-item.hh" #include "time-signature.hh" #include "paper-def.hh" #include "lookup.hh" @@ -69,13 +70,18 @@ Time_signature::special_time_signature (Score_element*me, String s, int n, int d 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; 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/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index b35fb98b65..14d905fa39 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -14,6 +14,7 @@ #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" @@ -75,9 +76,9 @@ Tuplet_spanner::brew_molecule (SCM smob) 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); diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index b2b42ac4f5..dbd0cb7ffa 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -13,6 +13,7 @@ #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" @@ -88,10 +89,11 @@ Volta_spanner::brew_molecule (SCM smob) 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); 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-as.ly b/ly/declarations-as.ly index d0caa74ac3..ac43481fab 100644 --- a/ly/declarations-as.ly +++ b/ly/declarations-as.ly @@ -53,7 +53,7 @@ melismaEnd = \property Staff.melismaBusy = ##f % ugh \include "midi.ly" -\include "textscripts.ly" +\include "dynamic-scripts.ly" \include "spanners.ly" \include "property.ly" diff --git a/ly/declarations.ly b/ly/declarations.ly index 452bc2b2ca..b2781c3dd2 100644 --- a/ly/declarations.ly +++ b/ly/declarations.ly @@ -2,19 +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 "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 @@ -24,7 +15,6 @@ start = -1 stop = 1 smaller = -1 bigger = 1 - center=0 break = \penalty -1000000; @@ -33,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" @@ -44,13 +32,12 @@ papersize = "a4" % 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" diff --git a/ly/dynamic-scripts.ly b/ly/dynamic-scripts.ly new file mode 100644 index 0000000000..7ccd8d8e64 --- /dev/null +++ b/ly/dynamic-scripts.ly @@ -0,0 +1,24 @@ + +% +% 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" + 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 37fe4c1944..ff3204e8e2 100644 --- a/scm/basic-properties.scm +++ b/scm/basic-properties.scm @@ -26,8 +26,8 @@ ; (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) )) @@ -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/generate-documentation.scm b/scm/generate-documentation.scm new file mode 100644 index 0000000000..9f33bdf1e7 --- /dev/null +++ b/scm/generate-documentation.scm @@ -0,0 +1,147 @@ + +;;;; +; +; 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
  • " (symbol->string (car prop)) " (" (type-name (cadr prop)) ") -- " + (caddr prop) + "
    default value: " + (if (pair? handle) + (scm->string (cdr handle)) + "not set" + ) + "\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 + "
    " + "

    Interface: " (symbol->string name) "

    \n" + desc + "
    \n
      " + (apply string-append docs) + "
    " + ) + )) + +; +; 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 "LilyPond Element " name " " + "

    " name "

    " + (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 + "
  • " x "\n")) + files)) + ) + + (display + (string-append + "LilyPond backend documentation" + "

    LilyPond backend documentation

    " + "
      " + (apply string-append l) + "
    " + ) + out + ) + )) + +; (display (document-interface stem-interface '())) +; (define b (cdr (assoc 'Beam all-element-descriptions))) +;(display b) + +;(document-element b) + +(document-elements all-element-descriptions) + 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 41150ef8d6..2c10991f07 100644 --- a/scm/slur.scm +++ b/scm/slur.scm @@ -102,7 +102,6 @@ (define default-basic-slur-properties `( - (interfaces . (slur-interface)) (molecule-callback . ,Slur::brew_molecule) (thickness . 1.2) (spacing-procedure . ,Slur::set_spacing_rods) @@ -111,8 +110,11 @@ (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)) ) ) 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)