PDF_FILES = $(TEXINFO_MANUALS:%=$(outdir)/%.pdf)
TOPDIR_HTML_MANUALS =
-UNSPLITTED_HTML_MANUALS =
-SPLITTED_HTML_MANUALS = $(foreach manual, $(TEXINFO_MANUALS),\
- $(if $(findstring $(manual), $(UNSPLITTED_HTML_MANUALS)),,$(manual)))
-NOT_TOPDIR_HTML_MANUALS = $(foreach manual, $(SPLITTED_HTML_MANUALS),\
+UNSPLIT_HTML_MANUALS =
+SPLIT_HTML_MANUALS = $(foreach manual, $(TEXINFO_MANUALS),\
+ $(if $(findstring $(manual), $(UNSPLIT_HTML_MANUALS)),,$(manual)))
+NOT_TOPDIR_HTML_MANUALS = $(foreach manual, $(SPLIT_HTML_MANUALS),\
$(if $(findstring $(manual), $(TOPDIR_HTML_MANUALS)),,$(manual)))
-OUT_HTML_FILES = $(UNSPLITTED_HTML_MANUALS:%=$(outdir)/%.html)\
- $(SPLITTED_HTML_MANUALS:%=$(outdir)/%-big-page.html)
+OUT_HTML_FILES = $(UNSPLIT_HTML_MANUALS:%=$(outdir)/%.html)\
+ $(SPLIT_HTML_MANUALS:%=$(outdir)/%-big-page.html)
DEEP_HTML_FILES = $(NOT_TOPDIR_HTML_MANUALS:%=$(outdir)/%/index.html)
# Symlinks to refer to external source documents from split and non-split HTML
source-links = $(outdir)/source\
- $(foreach manual, $(SPLITTED_HTML_MANUALS), $(outdir)/$(manual)/source)
+ $(foreach manual, $(SPLIT_HTML_MANUALS), $(outdir)/$(manual)/source)
# Other out files
@finalout
@node Top
-@top New features in 2.14 since 2.12
+@top New features in 2.16 since 2.14
@allowcodebreaks false
-@itemize @bullet
+@itemize
@ignore
@end ignore
@item
-Lilypond now helps beams avoid collisions with other grobs! This feature
-works completely with manual beams. It also works for all automatic beams
-that do not end right before a change in staff. For this special case, please
-use manual beams.
-
-@item
-The Articulate script by Peter Chubb, which is GPLv3 licensed, is now
-a part of the distribution. It allows easy generation of improved
-MIDI files that perform non-legato by default, legato slurs, staccato,
-tempo markings, trills, etc.
-
-@example
-\include "articulate.ly"
-\articulate <<
- all the rest of the score...
->>
-@end example
-
-@item
-Single beat repeats for sixteenth or shorter notes and beat repeats for
-measures containing notes of varying durations are now supported.
-
-@lilypond[fragment,relative=2]
-\repeat percent 2 { c16 d }
-\repeat percent 2 { c32 e }
-\repeat percent 2 { c64 f }
-\repeat percent 2 { c128 g' }
-@end lilypond
-
-
-@item
-Lilypond now engraves woodwind fingering charts.
-
-@lilypond
-\relative c' {
- \textLengthOn
- des1^\markup {
- \woodwind-diagram #'bassoon #'((lh . (thumb-cis))
- (cc . (one two three five six))
- (rh . (f)))
- } _"bassoon"
- c1^\markup {
- \woodwind-diagram #'oboe #'((rh . (c))
- (lh . ())
- (cc . (one two three four five six)))
- } _"oboe"
-
-}
-@end lilypond
-
-@item
-MIDI output has been improved
-@itemize @bullet
-@item the option @code{\set Score.midiChannelMapping = #'voice} puts each voice on its own midi MIDI channel
-@item the option @code{\set Score.midiChannelMapping = #'instrument} puts identical instruments on the same MIDI channel. This means that e.g. for a full orchestral score there are always 16 (15 plus percussion) differently sounding instruments available, unrestricted by the number of staves or voices. (Some MIDI players will cut off notes, however, if two voices play the same pitch simultaneously on the same channel.) This option also stores each voice in a separate track in the MIDI file.
-@item the default, @code{\set Score.midiChannelMapping = #'staff}, assigns one MIDI channel per staff. This setting allows instrument changes (implemented as MIDI program changes) to re-use single MIDI channel.
-@item dynamics are now rendered as note velocities, no longer as midi volume. This improves the sound on [high end] midi renderers.
-@end itemize
-
-@item
-MIDI-import through Midi2ly is improved
-@itemize @bullet
-@item Midi2ly now also works on Windows systems
-@item MIDI-files with more than 32 tracks are now handled
-@item notes on certain simultaneous voices no longer ignored
-@item notes overrunning a bar line are no longer truncated
-@item initial key signature and time signature are respected
-@item a problem with octaves in subsequent tracks/voices is fixed
-@item initial support for multiple voices notated on one staff
-@item the instrumentName is set from track data
-@item new --skip option, rests are displayed by default
-@item rests overrunning a bar line are not truncated
-@item new --include-header option for setting titles
-@item new --preview option for big MIDI-files
-@end itemize
-The first feature was sponsored by Valentin Villenave,
-the other features were sponsored by Image-Line Software for FL Studio.
-
-@item
-A new @code{Completion_rest_engraver} is available for automatically
-converting long rests which overrun bar lines, matching the
-@code{Completion_heads_engraver} for notes
-@example
-\layout @{
- \context @{
- \Voice
- \remove "Note_heads_engraver"
- \consists "Completion_heads_engraver"
- \remove "Rest_engraver"
- \consists "Completion_rest_engraver"
- @}
-@}
-@end example
-This feature was sponsored by Image-Line Software for FL Studio.
-
-@item
-Dots can be added to the table of contents items using:
-@example
-\paper @{
- tocItemMarkup = \tocItemWithDotsMarkup
-@}
-@end example
-
-@item
-New markup commands @code{\pattern} and @code{\fill-with-pattern} are available.
-@lilypond
-\markup \column {
- \pattern #3 #Y #0.3 \flat
- \null
- \pattern #7 #X #2 \flat
- \override #'(line-width . 40) \fill-with-pattern #1 #CENTER . left right
-}
-@end lilypond
-
-@item
-A minimal composer toolkit of modal transformations is provided.
-A motif may be @notation{transposed}, @notation{inverted} and/or
-converted to its @notation{retrograde} within any scale.
-
-@lilypond
-pentatonicScale = \relative a' { a c d f g }
-motif = \relative c'' { d8 c f,4 <a f'> <a f'> }
-
-\new Staff <<
- {
- \partial 4
- \pentatonicScale
- \motif
- \modalTranspose c a, \pentatonicScale \motif
- \modalInversion d'' a' \pentatonicScale \motif
- \retrograde \motif
- }
- {
- \partial 4
- s4^"pentatonic scale"
- s1
- s1^"motif"
- s1^"transposition"
- s1^"inversion"
- s1^"retrograde"
- }
->>
-@end lilypond
-
-@item
-Added minimal support for black mensural notation.
-
-@item
-Enhanced support for obliqua shapes within white mensural ligatures.
-
-@lilypond
-\context MensuralStaff
-{
- \clef "petrucci-c3"
- \[
- \override NoteHead #'style = #'semipetrucci
- c'\maxima
- \override NoteHead #'style = #'blackpetrucci
- a\breve
- \revert NoteHead #'style
- \override NoteHead #'ligature-flexa = ##t
- \override NoteHead #'flexa-width = #3
- g
- g'
- \override NoteHead #'flexa-width = #5
- c'
- d'
- \revert NoteHead #'style
- c'\longa
- \]
-}
-@end lilypond
-
-@item
-New markup functions @code{\with-link} and @code{\page-link} that add
-hyperlinks to a given label or a given page number. This works in the PDF
-backend only. All entries to the table of contents now automatically add
-hyperlinks to the pages they are referring to.
-
-@item
-Compound time signatures are now supported by the @code{\compoundMeter} command,
-which can be used instead of @code{\time}:
-
-@lilypond
-\relative c'' {
- \compoundMeter #'(3 1 8)
- c8 c c c
- \compoundMeter #'((2 8) (5 8))
- c8 c c c c c c
- \compoundMeter #'((1 2 3 8) (1 4) (3 8))
- c8 c c c c c c4 c8 c c
-}
+@code{\set \once} now correctly resets the property value to the previous value.
+@lilypond[fragment,quote,relative=2]
+ \set fingeringOrientations = #'(left)
+ <e-1>4
+ \once \set fingeringOrientations = #'(right)
+ <e-1>
+ <e-1>-"left"
@end lilypond
-@item
-Lyrics above a staff must have their @code{staff-affinity} set to
-@code{DOWN} or must have their @code{alignAboveContext} property
-set in order to be properly aligned. For more information, see
-@ruser{Placing lyrics vertically}.
@item
-@code{stringTunings} property values have changed from a list of
-semitones above middle C to a list of LilyPond pitch values.
-convert-ly will handle the change automatically where the value
-of @code{stringTunings} is set to a Scheme constant value.
-
-New commands @code{makeStringTuning} and @code{contextStringTuning}
-allow the creation of string tunings in the form of a Lilypond
-chord construct.
-
-@item
-By using @code{\cueDuringWithClef}, cue notes can now also have their own
-clef, which is correctly reset at the end of the cue notes. At the begin
-of each line, the standard clef is still displayed, but the cue clef is
-shown after the time/key signature in smaller size.
-
-@lilypond
-vI = \relative c'' { \clef "treble" \repeat unfold 40 g4 }
-\addQuote vIQuote { \vI }
-
-Solo = \relative c {
- \clef "bass"
- \cueDuringWithClef #"vIQuote" #DOWN #"treble" { R1 } |
- c4 \cueDuringWithClef #"vIQuote" #DOWN #"treble" {
- r4 r2 |
- r4
- } c4 c2 |
- \cueDuringWithClef #"vIQuote" #DOWN "soprano" { R1*2 \break R1 } |
- c1
-}
-
-\score {
- <<
- \new Staff \new Voice \Solo
- >>
-}
+The alignment of dynamic spanners (hairpins, text crescendo, etc.) is now
+automatically broken if a different direction is explicitly given.
+@lilypond[fragment,quote,relative=2]
+c4_\< c c^\> c c1_\p
@end lilypond
@item
-Note names can be selected with a new
-@code{@bs{}language "italiano"} command, which
-can be used in safe mode. The old
-@code{@bs{}include "italiano.ly"} syntax is
-still supported for now, but will be deprecated
-in the future.
-
-@item
-autobeaming is now disabled by @code{\cadenzaOn} and enabled by
-@code{\cadenzaOff}. Beaming in cadenzas should be indicated manually.
-Also, if a cadenza is used in a piece with autobeaming disabled, it
-will need to be disabled again after the cadenza.
-
-@item
-The user is now able to specify the name of the predefined fretboard
-table. This allows the use of multiple tables, with switching between them
-based on user input.
-
-@item
-The part-combiner's decision to combine/not combine notes can now be customized
-
-@lilypond[quote,relative=2]
-\partcombine
-\relative c' { c2 \partcombineApart c | \partcombineChordsOnce e' e }
-\relative c' { c2 \partcombineApart c | c c }
-@end lilypond
-
-@item
-Tablature staves show fret numbers only by default. To get the
-former style, @code{\tabFullNotation} is provided.
-
-@item
-Funk-style and Walker-style shape notes have been added.
-
-@item
-Rests will no longer keep a staff alive if @code{\RemoveEmptyStaffContext}
-is used.
-
-@item
-New option @code{-dinclude-settings=INCLUDEFILE.ly}, which causes lilypond
-to include the given file before the score is processed. This allows the
-user to change global settings without the need to change the score itself.
-That way, several different editions/version (e.g. different page sizes)
-can be generated from a file without having to modify the score for each
-version.
-
-@item
-The autobeaming settings syntax has been changed. beatLength,
-beatGrouping, beamSettings, and measureGrouping have all been eliminated.
-Autobeaming is now controlled by baseMoment, beatStructure, and
-beamExceptions. Default settings for each of these properties can be
-stored for any time signature in time-signature-settings, so that
-when the time signature is changed, the autobeaming will automatically
-change. The new syntax should be much easier and require fewer
-overrides.
-
-@item
-The SVG backend has optional support for
-@uref{http://www.w3.org/Submission/WOFF, WOFF fonts}. Using the Scheme
-option @code{-d svg-woff} together with the SVG backend selection
-@code{-d backend=svg}, produces SVG output with CSS WOFF font selection.
-
-@item
-The LilyPond G clef has been rotated 1.5 degrees clockwise for improved
-balance. The old and new versions can be compared by looking at the
-documentation:
-@uref{http://lilypond.org/doc/v2.12/Documentation/user/lilypond/The-Feta-font.html#Clef-glyphs,
-old version},
-@uref{http://lilypond.org/doc/v2.14/Documentation/notation/the-feta-font.html#Clef-glyphs,
-new version}.
-
-
-@item
-Text crescendo spanners can now be added directly using @code{\cresc},
-@code{\dim} and @code{\decresc}.
-@lilypond[quote,relative=2]
-c4\cresc c c c\f |
-c4\dim c c c\!
-@end lilypond
-
-
-@item
-The documented syntax of @samp{lilypond} environments in the @LaTeX{}
-mode of @command{lilypond-book} has been changed to conform with
-standard @LaTeX{} syntax: options now come after the environment name:
-@example
-\begin@{lilypond@}[@var{options}] @dots{}
-@end example
-
-The previous syntax with options after @samp{\begin} is still accepted
-by @command{lilypond-book} but deprecated. Something like
-@example
-sed -i '/begin\[/s/begin\(\[[^]]*]\)\(@{lilypond@}\)/begin\2\1/'
-@end example
-
-might do the trick for conversion.
-
-@item
-Aesthetics of shape note heads have been enhanced. Variable line thicknesses
-have been implemented. All note widths have been made consistent.
-Minor shape note commands that use the relative major key for scale steps
-have been added.
-
-@item
-A variant of the Segno sign is provided:
-@lilypond[quote,relative=2]
-c4 d e f \bar "S"
-g4 f e d
-@end lilypond
-
-@item
-Context modifications (@code{\with} blocks) can be stored in variables and
-inserted into contexts or other @code{\with} blocks:
-@lilypond[quote,verbatim]
-coloredheads = \with { \override NoteHead #'color = #red }
-noclef = \with { \remove "Clef_engraver" }
-\score {
- \new Staff {
- \new Voice \with { \coloredheads } \relative c' { c4 e g c }
- }
- \layout {
- \context {
- \Staff
- \noclef
- }
- }
-}
-@end lilypond
-
-@item
-A half-open articulation was added:
-@lilypond[quote,relative=2]
-c4\halfopen
-@end lilypond
-This is sometimes used to indicate half-open hi-hats.
-
-@item
-The Unicode Bidirectional Algorithm is now fully supported for
-single-line markup due to enhanced integration with Pango.
-
-@item
-LilyPond is now licensed under the GNU GPL v3+.
-
-@item
-In tablature, frets can be indicated with labels other than numbers:
-
-@lilypond[verbatim,quote,relative=1]
-\new TabStaff
-\with {
- stringTunings = #`(,(ly:make-pitch 1 3 NATURAL)
- ,(ly:make-pitch 1 1 NATURAL)
- ,(ly:make-pitch 0 5 NATURAL)
- ,(ly:make-pitch 0 3 NATURAL)
- ,(ly:make-pitch 0 1 NATURAL)
- ,(ly:make-pitch -1 5 NATURAL))
- tablatureFormat = #fret-letter-tablature-format
-}
-\new TabVoice {
- \set fretLabels = #`(,(markup #:with-color red "a")
- "b"
- ,(markup #:italic #:smaller "c"))
- <f d>4. <bes>8 <g e>4
-}
-@end lilypond
-
-@item
-Layout objects can be printed over a white background, which whites-out objects
-in lower layers which lie beneath:
-
-@lilypond[verbatim,quote,relative=1]
-\time 3/4
-\override Staff.StaffSymbol #'layer = #4
-\once \override Tie #'layer = #2
-b'2.~
-\once \override Staff.TimeSignature #'whiteout = ##t
-\once \override Staff.TimeSignature #'layer = #3
-\time 5/4
-b4
-@end lilypond
-
-@item
-Chords can be repeated using the @code{q} shortcut:
-
-@lilypond[verbatim,quote,relative=2]
-<c e g>8.-^ q16 q4-^
-@end lilypond
-
-@item
-With two-sided mode, margins for odd and even pages can be set using
-@code{inner-margin} and @code{outer-margin}:
-
-@example
-\paper @{
- two-sided = ##t
- inner-margin = 10 \mm
- outer-margin = 20 \mm
-@}
-@end example
-
-@item
-Paper margin defaults, as specified in @file{ly/paper@/-defaults-init.ly}, apply
-to the default paper size (a4) and are automatically scaled according to the
-paper size chosen.
-
-@item
-All combinations of @code{left-margin}, @code{right-margin} and
-@code{line-width} work now. There is no more need to set @code{line-width}
-manually unless you explicitly want to.
-
-@item
-Support for using an alternative music font, such as Gonville, is now
-added.
-
-@item
-In addition to the existing @code{\hspace} markup command,
-a new @code{\vspace} command has been added to provide an easy
-and flexible way to add vertical space in markups.
-
-@item
-The direction of manual beams can be set with @code{^[} and @code{_[}.
-
-@item
-A version of the breve note head has been added with two vertical lines on each side.
-@lilypond[quote,relative=2]
-\time 4/2
-\override Staff.NoteHead #'style = #'altdefault
-c\breve | b\breve
-@end lilypond
-
-@item
-Instrument names and vocal names now take into account the extent of
-system start delimiters in other staves for their positioning,
-resulting in improved default alignment for left-, center- and
-right-aligned names.
-@lilypond[quote,indent=18\mm]
-<<
- \new StaffGroup <<
- \new GrandStaff <<
- \new Staff {
- \set Staff.instrumentName = #"Piccolo"
- c''1
- }
- \new Staff {
- \set Staff.instrumentName = #"Flute"
- c''1
- }
- >>
- \new Staff {
- \set Staff.instrumentName = #"Bassoon"
- \clef tenor
- c'1
- }
- >>
- \new PianoStaff <<
- \set PianoStaff.instrumentName = #"Piano"
- \context Staff = "up" {
- c'1
- }
- \context Staff = "down" {
- \clef bass
- c1
- }
- >>
->>
-@end lilypond
-
-@item
-Braces in markup can now be selected by point size using the markup commands
-@code{\left-brace} and @code{\right-brace}.
-@lilypond[quote]
-\markup {
- \left-brace #35
- \hspace #2
- \right-brace #45
-}
-@end lilypond
-
-@item
-Intermediate .ps files which are created by LilyPond
-during compilation are now deleted by default. To keep them,
-add the following line to your input files:
-@example
-#(ly:set-option 'delete-intermediate-files #f)
-@end example
-
-@item
-Dashed and dotted slurs, phrasing slurs, and ties
-have been made variable thickness, and
-partially dashed slurs are now available:
-@lilypond[quote,relative=2]
-\slurDashed
-c4( d e f) |
-\slurDotted
-g4( f e d) |
-\slurHalfDashed
-c4( d e f)
-@end lilypond
-
-@item
-An eyeglasses markup was added, indicating strongly to look at the
-conductor for instructions:
-@lilypond[quote,relative=2]
-\mark \markup { \eyeglasses }
-c4_\markup { \eyeglasses }
+Appoggiaturas and acciaccaturas now also work inside a slur, not only inside
+a phrasing slur. Also, a function @code{\slashedGrace} was added that does
+does not use a slur from the acciaccatura note.
+@lilypond[fragment,relative=2]
+c4( \appoggiatura e8 d4 \acciaccatura e8 d4 \slashedGrace e8 c4)
@end lilypond
-@item
-A snap-pizzicato (also known as Bartok-pizzicato) articulation was added:
-@lilypond[quote,relative=2]
-c4\snappizzicato
-@end lilypond
@item
-Tuplet number formatting functions are now available to print other fractions
-and to add notes to the number or fraction:
-@lilypond[quote,relative=2]
-\once \override TupletNumber #'text =
- #(tuplet-number::non-default-tuplet-denominator-text 7)
-\times 2/3 { c4. c4. c4. c4. }
-
-\once \override TupletNumber #'text =
- #(tuplet-number::non-default-tuplet-fraction-text 12 7)
-\times 2/3 { c4. c4. c4. c4. }
-\once \override TupletNumber #'text =
- #(tuplet-number::append-note-wrapper
- (tuplet-number::non-default-tuplet-fraction-text 12 7) "8")
-\times 2/3 { c4. c4. c4. c4. }
-
-\once \override TupletNumber #'text =
- #(tuplet-number::append-note-wrapper tuplet-number::calc-denominator-text "4")
-\times 2/3 { c8 c8 c8 c8 c8 c8 }
-\once \override TupletNumber #'text =
- #(tuplet-number::append-note-wrapper tuplet-number::calc-fraction-text "4")
-\times 2/3 { c8 c8 c8 c8 c8 c8 }
-
-\once \override TupletNumber #'text =
- #(tuplet-number::fraction-with-notes "4." "8")
-\times 2/3 { c4. c4. c4. c4. }
-\once \override TupletNumber #'text =
- #(tuplet-number::non-default-fraction-with-notes 12 "8" 4 "4")
-\times 2/3 { c4. c4. c4. c4. }
+To suppress the line on a crescendo text spanner (and other similar spanners),
+LilyPond now fully supports the @code{#'style = #'none} property.
+@lilypond[fragment,quote,relative=2]
+\override DynamicTextSpanner #'style = #'none
+c4\cresc c c g, c'\p
@end lilypond
-@item
-FretBoards now have a chordChanges property to keep repeated FretBoard objects
-from being typeset.
@item
-The vertical spacing engine has been drastically changed, making
-it more flexible and easier to control.
-The spacing between staves within a system can now change
-to better use the space on the page.
-User-defined contexts may participate in this flexible spacing,
-depending on how their @code{staff-affinity} is defined.
-Some page formatting variables (@code{page-top-space},
-@code{between-system-space -padding}, and
-@code{before- between- after-title-space}) have been replaced
-by flexible vertical dimensions.
+Glissandi can now span multiple lines.
@end itemize
-
-
@ifhtml
For older news, go to
+@uref{http://lilypond.org/doc/v2.14/Documentation/changes/},
@uref{http://lilypond.org/doc/v2.12/Documentation/topdocs/NEWS.html},
-@uref{http://lilypond.org/doc/v2.10/Documentation/topdocs/NEWS.html},
or @uref{../,go back} to the Documentation index.
@macro imageClickable{IMAGE-FILE, EXT, MORE-TEXT, CLICK-FILE, CLICK-EXT, POSITION}
@html
<div class="float-\POSITION\">
- <a class="clickable" href="../pictures/\CLICK-FILE\.\CLICK-EXT\">
- <img src="../pictures/\IMAGE-FILE\.\EXT\" alt="\IMAGE-FILE\">
+ <a class="clickable" href="pictures/\CLICK-FILE\.\CLICK-EXT\">
+ <img src="pictures/\IMAGE-FILE\.\EXT\" alt="\IMAGE-FILE\">
</a>
<p style="text-align: center">
\MORE-TEXT\
@macro imageFloat{IMAGE-FILE, EXT, POSITION}
@html
-<img class="float-\POSITION\" src="../pictures/\IMAGE-FILE\.\EXT\" alt="\IMAGE-FILE\">
+<img class="float-\POSITION\" src="pictures/\IMAGE-FILE\.\EXT\" alt="\IMAGE-FILE\">
@end html
@iftex
@image{pictures/\IMAGE-FILE\,,,\IMAGE-FILE\,\EXT\}
@macro imageId{ID, IMAGE-FILE, EXT, ALT}
@html
<div id="\ID\">
- <img src="../pictures/\IMAGE-FILE\.\EXT\" alt="\ALT\">
+ <img src="pictures/\IMAGE-FILE\.\EXT\" alt="\ALT\">
</div>
@end html
@iftex
@smallexample
scripts/auxiliar/fixcc.py \
- fixcc $(find flower lily -name '*cc' -o -name '*hh' | grep -v /out)
+ $(find flower lily -name '*cc' -o -name '*hh' | grep -v /out)
@end smallexample
most of them are not drawn. See the break-visibility property in
item-interface.
+Here is another e-mail exchange. Janek Warchoł asked for a starting point
+to fixing 1301 (change clef colliding with notes). Neil Puttock replied:
+
+The clef is on a loose column (it floats before the head), so the
+first place I'd look would be lily/spacing-loose-columns.cc (and
+possibly lily/spacing-determine-loose-columns.cc).
+I'd guess the problem is the way loose columns are spaced between
+other columns: in this snippet, the columns for the quaver and tuplet
+minim are so close together that the clef's column gets dumped on top
+of the quaver (since it's loose, it doesn't influence the spacing).
@node Info from Han-Wen email
@subsection Info from Han-Wen email
Documentation/included/authors.itexi
@end example
+Also, delete old material in:
+
+@example
+Documentation/changes.tely
+@end example
+
+but don't forget to check it still compiles! also update the
+version numbers.
+
@item
Website:
volume = 17,
number = 3,
note = {A categorisation of music representation systems (languages,
-OO systems etc) splitted into high level and low level expressiveness.
+OO systems etc) split into high level and low level expressiveness.
The discussion of Charm and parallel processing for music
representation is rather vague. HWN}
}
input file.
@menu
-* Music function syntax::
+* Music function definitions::
+* Music function usage::
* Simple substitution functions::
* Intermediate substitution functions::
* Mathematics in functions::
@end menu
-@node Music function syntax
-@subsection Music function syntax
+@node Music function definitions
+@subsection Music function definitions
-The general form for music functions is:
+The general form for defining music functions is:
@example
function =
@item @code{@var{typeN?}}
@tab a scheme @emph{type predicate} for which @code{@var{argN}}
must return @code{#t}. Some of these predicates are specially
-recognized by the parser, making the respective values be read in
-Lilypond syntax rather than in Scheme syntax. Currently these are
-@code{ly:music?}, @code{markup?}, @code{ly:pitch?}, and
-@code{ly:duration?}. Not all combinations are allowed: i.e., you can't
-look for a duration after music since music may end @emph{optionally}
-with a duration.
-
-If you really want to input some of those items as a Scheme rather than
-a Lilypond expression, you may wrap them in a call of @code{ly:export}.
-@c TODO: document what kind of argument lists are permitted in what
-@c syntactical context of a music function call.
+recognized by the parser, see below.
@item @code{@var{music}}
@tab A music expression, optionally written in scheme, with any
@end multitable
@noindent
-For a list of available type predicates, see
-@ruser{Predefined type predicates}. User-defined type predicates
-are also allowed.
+Some type predicates are specially recognized by the parser and will
+make the parser look for the respective arguments in Lilypond syntax
+rather than in Scheme syntax. Currently these are @code{ly:music?},
+@code{markup?}, @code{ly:pitch?}, and @code{ly:duration?}.
+
+If you really want to input one of those items as a Scheme rather than a
+Lilypond expression, you may write them as a Scheme expression that
+calls @code{ly:export} at its outermost level.
+
+Other type predicates, including user-defined ones, will make the
+respective argument only be accepted as a Scheme expression.
+For a list of available type predicates, see
+@ruser{Predefined type predicates}.
@seealso
@file{scm/lily.scm}.
+@node Music function usage
+@subsection Music function usage
+Music functions may currently be used in three places. Depending on
+where they are used, restrictions apply in order to be able to parse
+them unambiguously. The result a music function returns must be
+compatible with the context in which it is called.
+
+@itemize
+@item
+At top level in a music expression. There are no special restrictions
+on the argument list. Using the @code{#@{}@dots{}@code{#@}} construct
+produces a sequential music expression and consequently can only applied
+in this context.
+
+@item
+As a post-event. All trailing arguments of the music function with the
+predicate @code{ly:music?} will get parsed also as post-events. Note
+that returning post-events will also be acceptable for music functions
+called at top level, leading to a result roughly equivalent to
+@example
+s 1*0-\fun
+@end example
+
+@item
+As a chord constituent. All trailing arguments of the music function
+with the predicate @code{ly:music?} will get parsed also as chord
+constituents.
+@end itemize
+
+@noindent
+The special rules for trailing arguments make it possible to write
+polymorphic functions like @code{\tweak} that can be applied to
+different constructs.
+
+There is another somewhat special rule: if you have a predicate
+@code{ly:music?} directly before a @code{ly:duration?} predicate, then
+the corresponding music expression must be either a music identifier, or
+literal sequential or parallel music enclosed in
+@code{@{}@dots{}@code{@}} or @code{<<}@dots{}@code{>>} explicitly.
+Otherwise, Lilypond could get confused about where the music ends and
+the duration starts.
+
@node Simple substitution functions
@subsection Simple substitution functions
@code{\startTextSpan} jusqu'à la commande @code{\stopTextSpan} et le
format de texte est défini par la commande @code{\override TextSpanner}.
Pour de plus amples détails, voir
-@ruser{Indication textuelle avec ligne d’extension}.
+@ruser{Indication textuelle avec extension}.
Il montre aussi comment créer des marques d'octaviation.
@translationof Changing context default settings
Les réglages montrés dans les sous-sections
-@ref{La commande de fixation (set)},
+@ref{La commande de fixation (set)},
@ref{Modification des greffons de contexte}
@c et @c r ef{Retouches de mise en forme au sein des contextes}
peuvent également être saisis indépendamment de la musique dans le bloc
@node La commande de fixation (set)
-@subsection La commande @code{@bs{}set}
+@subsection La commande de fixation @code{@bs{}set}
@translationof The set command
@cindex propriétés
@node La commande de dérogation (override)
-@subsection La commande @code{@bs{}override}
+@subsection La commande de dérogation @code{@bs{}override}
@translationof The override command
@node La commande d'affinage (tweak)
-@subsection La commande @code{@bs{}tweak}
+@subsection La commande d'affinage @code{@bs{}tweak}
@translationof The tweak command
@ref{Parenthèses}. Cependant, le mode @code{\drummode} n'inclut pas par
défaut le graveur @code{Parenthesis_engraver} qui permet d'imprimer ces
signes. Il faut donc l'ajouter explicitement dans la définition du
-contexte, suivant la manœuvre indiquée dans @ref{La commande set}.
+contexte, suivant la manœuvre indiquée dans
+@ref{La commande de fixation (set)}.
@lilypond[quote,ragged-right,verbatim]
\new DrumStaff \with {
La fonction @code{layout-set-staff-size} fait l'objet de la rubrique
suivante, @ref{Définition de la taille de portée}. La modification des
contextes est abordée dans d'autres chapitres -- voir
-@ref{Modification des propriétés d'un contexte} et
+@ref{Modification des greffons de contexte} et
@ref{Modification des réglages par défaut d'un contexte}. Les variables
du bloc @code{\paper} que l'on peut retrouver dans un bloc
@code{\layout} sont@tie{}:
@ref{Notations anciennes},
@ref{Barres de mesure},
@ref{Modification des greffons de contexte},
-@ref{Typesetting Gregorian chant},
+@c r e f{Typesetting Gregorian chant}, ***A VENIR
@ref{Musique sans métrique},
@ref{Visibilité des objets}.
@unnumberedsubsubsec Mesure incomplète et musique liturgique
@translationof Partial measures in hymn tunes
-Il arrive fréquemment que les chants liturgiques coportent des mesures
+Il arrive fréquemment que les chants liturgiques comportent des mesures
incomplètes aussi bien en début qu'en fin de ligne, de telle sorte qu'à
une portée corresponde une ligne de texte. Ceci requiert donc
l'utilisation de la commande @code{\partial} en début de partition et
-d'une commande @code{\bar@tie{}"|"} ou @code{\baràtie{}"||"} à la fin de
+d'une commande @code{\bar@tie{}"|"} ou @code{\bar@tie{}"||"} à la fin de
chaque ligne.
@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
<!--
- Translation of GIT committish: d4db4930cfb89a8d2f4bfa36e99e81710fa09caa
+ Translation of GIT committish: 02cc634b92fdce39d054ce787dcaa7c0338a11b0
When revising a translation, copy the HEAD committish of the
version that you are working on. See TRANSLATION for details.
<form action="http://google.com/search"
method="get"
name="search"
- onSubmit="search.q.value='site:lilypond.org +v2.12 '
+ onSubmit="search.q.value='site:lilypond.org +v2.14 '
+ search.brute_query.value"
- onMouseMove="search.q.value='site:lilypond.org +v2.12 '
+ onMouseMove="search.q.value='site:lilypond.org +v2.14 '
+ search.brute_query.value"
- onKeyUp="search.q.value='site:lilypond.org +v2.12 '
+ onKeyUp="search.q.value='site:lilypond.org +v2.14 '
+ search.brute_query.value">
<input type="hidden" name="btnG" value="Recherche sur Google">
<input type="text" name="brute_query" onfocus="this.value=''" value="Rechercher">
%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
texidocit = "
Questo modello molto semplice mette a disposizione un rigo con delle note ed è
-quindi adatto per uno strumento non accompagnato o per un frammento
+quindi adatto per uno strumento non accompagnato o per un frammento
melodico. Copialo e incollalo in un file, aggiungi le note e hai finito!
"
for ($i = 0; $i < @hrefsplit; $i++) {
$item = @hrefsplit[$i];
if ($item =~ /#/) {
- @splitted = split(".html#", $item);
- if (@splitted[0] eq @splitted[1]) {
- @hrefsplit[$i] = @splitted[0] . ".html";
+ @split = split(".html#", $item);
+ if (@split[0] eq @split[1]) {
+ @hrefsplit[$i] = @split[0] . ".html";
}
}
}
@cindex slurs, modifying
@cindex ties, modifying
-@cindex Bézier curves
-@cindex Bézier control points
-
-Ties, slurs and phrasing slurs are drawn as third-order Bézier
-curves. If the shape of the tie or slur which is calculated
-automatically is not optimum, the shape may be modified manually by
-explicitly specifying the four control points required to define
-a third-order Bézier curve.
-
-Third-order or cubic Bézier curves are defined by four control
-points. The first and fourth control points are precisely the
-starting and ending points of the curve. The intermediate two
-control points define the shape. Animations showing how the curve
-is drawn can be found on the web, but the following description
-may be helpful. The curve starts from the first control point
-heading directly towards the second, gradually bending over to
-head towards the third and continuing to bend over to head towards
-the fourth, arriving there travelling directly from the third
-control point. The curve is entirely contained in the
-quadrilateral defined by the four control points.
-
-Here is an example of a case where the tie is not optimum, and
-where @code{\tieDown} would not help.
+@cindex Bézier curves, control points
+@cindex control points, Bézier curves
+
+If the shape of the tie or slur which is calculated automatically is not
+optimum, the shape may be modified manually by explicitly specifying the
+control points required to define the curve needed.
+
+Ties, slurs and phrasing slurs are drawn as @q{third-order} Bézier
+curves which are are defined by four control points. The first and
+fourth control points are the start and end points of the curve
+respectively, and the two intermediate control points define the
+overall shape.
+
+Animations showing how the curve is drawn can be found on the web, but
+the following description may be helpful. The curve starts from the
+first control point moving towards the second. As the curve nears and
+passes through the second control point it begins to arc towards the
+third. The curve continues on towards the the third control point,
+again starting to arc as it nears and passes through the third so as to
+finish the curve smoothly at the fourth and final control point. The
+whole curve is contained in the quadrilateral defined by the four
+control points.
+
+Here is an example of a case where the tie is not optimum (and where the
+@code{\tieDown} command would not help).
@lilypond[verbatim,quote,relative=1]
<<
- { e1 ~ e }
+ { e1~ e }
\\
{ r4 <g c,> <g c,> <g c,> }
>>
{
\once \override Tie
#'control-points = #'((1 . -1) (3 . 0.6) (12.5 . 0.6) (14.5 . -1))
- e1 ~ e1
+ e1 ~ e
}
\\
- { r4 <g c,> <g c,> <g c,>4 }
+ { r4 <g c,> <g c,> <g c,> }
>>
@end lilypond
@knownissues
-
It is not possible to modify shapes of ties or slurs by changing
-the @code{control-points} property if there are more than one at
-the same musical moment, not even by using the @code{\tweak}
-command. However, the @code{tie-configuration} property of
-@code{TieColumn} can be overridden to set start line and direction
-of ties as required.
-
+the @code{control-points} property if there are multiple ties or slurs
+at the same musical moment -- the @code{\tweak} command will also not
+work in this case. However, the @code{tie-configuration} property of
+@code{TieColumn} can be overridden to set start line and direction as
+required.
+@seealso
+Internals Reference:
+@rinternals{TieColumn}.
@node Using music functions
Download and extract the zip file. Copy the @code{lilyfonts}
directory to @file{@var{SHARE_DIR}/lilypond/current}; for more
-information, see @rlearning{Other sources of information}.
-Move the existing @code{fonts} directory to @code{fonts_orig} and
-move the @code{lilyfonts} directory to @code{fonts}. Simply move
-@code{fonts_orig} back to @code{fonts} to revert back to Feta.
+information, see @rlearning{Other sources of information}. Rename the
+existing @code{fonts} directory to @code{fonts_orig} and the
+@code{lilyfonts} directory to @code{fonts}. To revert back to Feta,
+reverse the process.
@seealso
Learning Manual: @rlearning{Other sources of information}.
@knownissues
-
-Gonville cannot be used to typeset @q{Ancient Music} notation. Please
-refer to the author's website for more information on this and other
-specifics including licensing of Gonville.
+Gonville cannot be used to typeset @q{Ancient Music} notation and it is
+likely newer glyphs in later releases of LilyPond may not exist in the
+Gonville font family. Please refer to the author's website for more
+information on these and other specifics, including licensing of
+Gonville.
@node MIDI output
@knownissues
Beam collision avoidance does not work for automatic beams that end
-right before a change in staff. To make the latter work, use manual
-beaming.
+right before a change in staff. In this case use manual beams.
@node Changing staff automatically
* All context properties::
* Layout properties::
* Available music functions::
+* Context modification identifiers::
* Predefined type predicates::
* Scheme functions::
@end menu
@include identifiers.tely
+@node Context modification identifiers
+@appendixsec Context modification identifiers
+
+The following commands are defined for use as context modifications
+within a @code{\layout} or @code{\with} block.
+
+@include context-mod-identifiers.tely
@node Predefined type predicates
@appendixsec Predefined type predicates
c1
@end lilypond
-If there are more alternate endings than repeats then the first
-alternatives are applied, LilyPond will ignore the remaining
-alternatives which will not be printed.
+If there are more alternate endings than repeats then only the first
+alternatives are applied. The remaining alternatives will be ignored
+and not printed.
@lilypond[verbatim,quote,relative=2]
\repeat unfold 2 { c4 d e f }
@end lilypond
@noindent
-In the above example, the @code{Voice} context had to be
-explicitly declared, or else the entire music expression would
-belong to the @code{CueVoice} context.
+
It is possible to adjust which aspects of the music are quoted with
@code{\cueDuring} by setting the @code{quotedCueEventTypes}
notes, rests, ties, beams and tuplets are quoted, but not
articulations, dynamic marks, markup etc.
+In this example, the @code{Voice} context must be
+explicitly declared, or else the entire music expression would
+belong to the @code{CueVoice} context.
+
@lilypond[verbatim,quote]
oboeNotes = \relative c'' {
r2 r8 d16(\f f e g f a)
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
lsrtags = "keyboards"
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
lsrtags = "chords"
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
lsrtags = "rhythms, percussion"
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
lsrtags = "staff-notation, vocal-music"
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
lsrtags = "ancient-notation"
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Questo esempio mostra come realizzare una trascrizione moderna di musica
-gregoriana. La musica gregoriana non presenta suddivisione in misure né gambi;
-utilizza soltanto le teste della minima e della semiminima, e dei segni
-appositi che indicano pause di diversa lunghezza.
-
-"
- doctitleit = "Modello per notazione antica -- trascrizione moderna di musica gregoriana"
-
lsrtags = "vocal-music, ancient-notation, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Este ejemplo muestra cómo hacer una transcripción moderna de canto
doctitlees = "Plantilla para notación de música antigua (transcripción moderna de canto gregoriano)"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Questo esempio mostra come realizzare una trascrizione moderna di musica
+gregoriana. La musica gregoriana non presenta suddivisione in misure né gambi;
+utilizza soltanto le teste della minima e della semiminima, e dei segni
+appositi che indicano pause di diversa lunghezza.
+
+"
+ doctitleit = "Modello per notazione antica -- trascrizione moderna di musica gregoriana"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Quando si trascrive musica mensurale, può essere utile inserire all'inizio del
-pezzo un incipit che indichi l'intonazione e il tempo originali. Le stanghette
-di battuta, a cui i musicisti di oggi sono abituati e che aiutano a riconoscere
-più velocemente gli schemi ritmici, durante l'epoca della musica mensurale non
-erano ancora state introdotte; infatti il metro cambiava spesso ogni poche
-note. Come compromesso, le stanghette vengono spesso inserite tra i righi
-invece che al loro interno.
-
-"
- doctitleit = "Modello per notazione antica -- trascrizione moderna di musica mensurale"
-
lsrtags = "ancient-notation, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Al transcribir música mensural, es útil un «incipit» al compienzo
doctitlees = "Plantilla de notación de música antigua (transcripción moderna de música mensural)"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Quando si trascrive musica mensurale, può essere utile inserire all'inizio del
+pezzo un incipit che indichi l'intonazione e il tempo originali. Le stanghette
+di battuta, a cui i musicisti di oggi sono abituati e che aiutano a riconoscere
+più velocemente gli schemi ritmici, durante l'epoca della musica mensurale non
+erano ancora state introdotte; infatti il metro cambiava spesso ogni poche
+note. Come compromesso, le stanghette vengono spesso inserite tra i righi
+invece che al loro interno.
+
+"
+ doctitleit = "Modello per notazione antica -- trascrizione moderna di musica mensurale"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Bei der Transkription von Mensuralmusik ist es oft erwünscht, ein
\version "2.14.0"
\header {
-%% Translation of GIT committish: c3b519f0dd5ff0f8ccfc9a39ed1fe8df8b43741c
+ lsrtags = "vocal-music, template"
+
+%% Translation of GIT committish: b1bebb842d9762894fc7b2a178e2bdfcd544419f
texidoces = "
Esta plantilla muestra una forma de preparar un cántico salmódico
anglicano. También muestra cómo se pueden añadir estrofas adicionales
"
doctitlees = "Plantilla de salmo del canto anglicano"
-
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
texidocit = "
Questo modello presenta un modo di impostare un salmo anglicano. Mostra
anche come le strofe possono essere aggiunte come testo separato al di sotto
"
doctitleit = "Modello per salmo anglicano"
- lsrtags = "vocal-music, template"
-
-
-
-
%% Translation of GIT committish: 144cd434d02e6d90b2fb738eeee99119a7c5e1d2
texidocde = "
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
lsrtags = "fretted-strings, tweaks-and-overrides"
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
lsrtags = "midi"
texidoc = "
Ties may be engraved manually by changing the @code{tie-configuration}
property of the @code{TieColumn} object. The first number indicates the
-distance from the center of the staff in staff-spaces, and the second
+distance from the center of the staff in half staff-spaces, and the second
number indicates the direction (1 = up, -1 = down).
"
} % begin verbatim
\relative c' {
- <c e g>2 ~ <c e g>
+ <c e g>2~ <c e g>
\override TieColumn #'tie-configuration =
#'((0.0 . 1) (-2.0 . 1) (-4.0 . 1))
- <c e g>2 ~ <c e g>
+ <c e g>2~ <c e g>
}
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
lsrtags = "expressive-marks"
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Il codice seguente presenta un modo di impostare un inno in cui ogni verso
-inizia e finisce con una misura parziale. Mostra anche come aggiungere delle
-strofe come testo separato sotto la musica.
-
-"
- doctitleit = "Modello per inno"
-
lsrtags = "vocal-music, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Este fragmento de código muestra una forma de preparar un himno cuando
"
doctitlees = "Plantilla para himnos"
+
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Il codice seguente presenta un modo di impostare un inno in cui ogni verso
+inizia e finisce con una misura parziale. Mostra anche come aggiungere delle
+strofe come testo separato sotto la musica.
+
+"
+ doctitleit = "Modello per inno"
%% Translation of GIT committish: ab9e3136d78bfaf15cc6d77ed1975d252c3fe506
texidocde = "
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Ecco un modello piuttosto complesso, per un gruppo jazz. Si noti che tutti
-gli strumenti sono in @code{\\key c \\major}. Si tratta della tonalità
-reale; sarà trasposta automaticamente includendo la
-musica all'interno di una sezione @code{\\transpose}.
-
-"
- doctitleit = "Modello per combo jazz"
-
lsrtags = "keyboards, percussion, fretted-strings, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Ésta es una plantilla bastante avanzada, para un conjunto de
doctitlees = "Plantilla para combo de jazz"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Ecco un modello piuttosto complesso, per un gruppo jazz. Si noti che tutti
+gli strumenti sono in @code{\\key c \\major}. Si tratta della tonalità
+reale; sarà trasposta automaticamente includendo la
+musica all'interno di una sezione @code{\\transpose}.
+
+"
+ doctitleit = "Modello per combo jazz"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Hier ist ein ziemlich kompliziertes Beispiel für ein Jazz-Ensemble. Achtung:
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Questo modello mostra come usare i contesti annidati @code{StaffGroup} e
-@code{GrandStaff} per creare sottogruppi degli strumenti dello stesso
-tipo. Mostra anche come usare @code{\\transpose} in modo che le variabili
-mantengano la musica per gli strumenti traspositori nell'intonazione reale.
-
-"
- doctitleit = "Modello per orchestra coro e pianoforte"
-
lsrtags = "pitches, staff-notation, vocal-music, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Esta plantilla muestra el uso de contextos @code{StaffGroup} y
"
doctitlees = "Plantilla de orquesta con coro y piano"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Questo modello mostra come usare i contesti annidati @code{StaffGroup} e
+@code{GrandStaff} per creare sottogruppi degli strumenti dello stesso
+tipo. Mostra anche come usare @code{\\transpose} in modo che le variabili
+mantengano la musica per gli strumenti traspositori nell'intonazione reale.
+
+"
+ doctitleit = "Modello per orchestra coro e pianoforte"
+
%% Translation of GIT committish: 64feeff58e5ce3397de87188a08ac99f7ef8e37b
texidocde = "
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Ecco un comune doppio pentagramma per pianoforte con un po' di note.
-
-"
- doctitleit = "Modello per pianoforte (semplice)"
-
lsrtags = "keyboards, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Presentamos a continuación una plantilla de piano sencilla con algunas
doctitlees = "Plantilla de piano (sencilla)"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Ecco un comune doppio pentagramma per pianoforte con un po' di note.
+
+"
+ doctitleit = "Modello per pianoforte (semplice)"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Hier ein einfaches Klaviersystem.
う必要はありません。
"
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a428
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
texidocit = "
Molti spartiti per pianoforte hanno le dinamiche poste al centro dei due righi.
Il contesto @code{Dynamics}, se collocato tra i righi, posiziona automaticamente
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Invece di destinare un rigo a parte alla linea melodica e al suo testo, è
-possibile collocare il testo al centro di un doppio pentagramma per pianoforte.
-
-"
- doctitleit = "Modello per pianoforte con testo al centro"
-
lsrtags = "text, keyboards, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
En lugar de tener un pentagrama dedicado a la melodía y la letra, ésta
旋律と歌詞のための譜表を持つ代わりに、歌詞をピアノ譜の 2 つの譜の間に置くことができます。
"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Invece di destinare un rigo a parte alla linea melodica e al suo testo, è
+possibile collocare il testo al centro di un doppio pentagramma per pianoforte.
+
+"
+ doctitleit = "Modello per pianoforte con testo al centro"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Anstatt ein eigenes System für Melodie und Text zu schreiben, können
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Ecco un tipico formato per canzoni: un rigo con linea melodica e testo,
-e sotto l'accompagnamento per pianoforte.
-
-"
- doctitleit = "Modello per pianoforte con melodia e testo"
-
lsrtags = "vocal-music, keyboards, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
He aquí el típico formato dde una canción: un pentagrama con la
これは一般的な歌曲のフォーマットです: 旋律と歌詞を持つ譜表と、その下にピアノ伴奏譜があります。
"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Ecco un tipico formato per canzoni: un rigo con linea melodica e testo,
+e sotto l'accompagnamento per pianoforte.
+
+"
+ doctitleit = "Modello per pianoforte con melodia e testo"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Das nächste Beispiel ist typisch für ein Lied: Im oberen System die
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
-\version "2.15.2"
+\version "2.15.7"
\header {
lsrtags = "staff-notation, tweaks-and-overrides, breaks"
\version "2.14.0"
\header {
-%% Translation of GIT committish: c3b519f0dd5ff0f8ccfc9a39ed1fe8df8b43741c
+ lsrtags = "vocal-music, template"
+
+%% Translation of GIT committish: b1bebb842d9762894fc7b2a178e2bdfcd544419f
texidoces = "
Plantilla de coro SATB (en cuatro pentagramas)
"
doctitlees = "Plantilla de coro SATB a cuatro pentagramas"
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
texidocit = "
Modello per coro SATB (quattro righi)
"
doctitleit = "Modello per coro SATB - quattro righi"
- lsrtags = "vocal-music, template"
-
-
-
-
%% Translation of GIT committish: 144cd434d02e6d90b2fb738eeee99119a7c5e1d2
texidocde = "
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Ecco il modello di un comune spartito semplificato (lead sheet): include
-linea melodica, testo vocale, sigle degli accordi e relativi diagrammi
-per chitarra.
-
-"
- doctitleit = "Modello di rigo singolo con note testo accordi e tasti"
-
lsrtags = "vocal-music, chords, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Esta plantilla facilita la preparación de una canción con melodía,
これは旋律、単語、コードを持つ歌曲の楽譜のためのテンプレートです。
"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Ecco il modello di un comune spartito semplificato (lead sheet): include
+linea melodica, testo vocale, sigle degli accordi e relativi diagrammi
+per chitarra.
+
+"
+ doctitleit = "Modello di rigo singolo con note testo accordi e tasti"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Mit diesem Beispiel können Sie einen Song mit Melodie,
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Vuoi preparare uno spartito semplificato (lead sheet) con melodia e
-accordi? La tua ricerca è finita!
-
-"
- doctitleit = "Modello di rigo singolo con note e accordi"
-
lsrtags = "chords, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
¿Quiere preparar una hoja guía de acordes (o «lead sheet») con
旋律とコードを持つリード譜を欲しくはありませんか?他を見る必要はありません!
"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Vuoi preparare uno spartito semplificato (lead sheet) con melodia e
+accordi? La tua ricerca è finita!
+
+"
+ doctitleit = "Modello di rigo singolo con note e accordi"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Wollen Sie ein Liedblatt mit Melodie und Akkorden schreiben? Hier ist
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Questo piccolo modello presenta una semplice linea melodica con un testo. Copialo
-e incollalo, aggiungi le note e le parole. Questo esempio disabilita la
-disposizione automatica delle travature, come è consuetudine per le parti
-vocali. Per usare la disposizione automatica delle travature, cambia o
-commenta la relativa linea di codice.
-
-"
- doctitleit = "Modello di rigo singolo con note e testo"
-
lsrtags = "vocal-music, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Esta pequeña plantilla muestra una melodía sencilla con letra. Córtela
"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Questo piccolo modello presenta una semplice linea melodica con un testo. Copialo
+e incollalo, aggiungi le note e le parole. Questo esempio disabilita la
+disposizione automatica delle travature, come è consuetudine per le parti
+vocali. Per usare la disposizione automatica delle travature, cambia o
+commenta la relativa linea di codice.
+
+"
+ doctitleit = "Modello di rigo singolo con note e testo"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Das nächste Beispiel zeigt eine einfache Melodie mit Text. Kopieren
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Questo modello molto semplice mette a disposizione un rigo con delle note ed è
-quindi adatto per uno strumento non accompagnato o per un frammento
-melodico. Copialo e incollalo in un file, aggiungi le note e hai finito!
-
-"
- doctitleit = "Modello di rigo singolo con solo note"
-
lsrtags = "template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Esta plantilla simple prepara un pentagrama con notas, adecuado para
"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Questo modello molto semplice mette a disposizione un rigo con delle note ed è
+quindi adatto per uno strumento non accompagnato o per un frammento
+melodico. Copialo e incollalo in un file, aggiungi le note e hai finito!
+
+"
+ doctitleit = "Modello di rigo singolo con solo note"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Das erste Beispiel zeigt ein Notensystem mit Noten, passend für ein
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Questo modello presenta un semplice quartetto d'archi. Impiega anche una
-sezione @code{\\global} per definire il tempo e l'armatura di chiave.
-
-"
- doctitleit = "Modello per quartetto d'archi (semplice)"
-
lsrtags = "unfretted-strings, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Esta plantilla muestra un cuarteto de cuerda normal. También utiliza
@code{@bs{}global} セクションを使っています。
"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Questo modello presenta un semplice quartetto d'archi. Impiega anche una
+sezione @code{\\global} per definire il tempo e l'armatura di chiave.
+
+"
+ doctitleit = "Modello per quartetto d'archi (semplice)"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Dieses Beispiel demonstriert die Partitur für ein Streichquartett. Hier
\version "2.14.0"
\header {
-%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
- texidocit = "
-Il frammento di codice del @qq{Modello per quartetto d'archi} crea un bel
-quartetto, ma cosa fare se si ha bisogno di creare le singole parti? Questo
-nuovo modello mostra come usare la funzionalità @code{\\tag} per dividere
-facilmente un pezzo in parti staccate.
-
-Occorre dividere questo modello in file separati; i nomi dei file sono
-indicati nei commenti all'inizio di ogni file. @code{piece.ly}
-contiene tutte le definizioni musicali. Gli altri file – @code{score.ly},
-@code{vn1.ly}, @code{vn2.ly}, @code{vla.ly} e @code{vlc.ly} –
-creano ciascuna parte.
-
-
-Non dimenticare di togliere i commenti quando usi i file separati!
-
-"
- doctitleit = "Modello per quartetto d'archi con parti separate"
-
-
lsrtags = "unfretted-strings, template"
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
El fragmento de código @qq{Plantilla de cuarteto de cuerda} produce un
別々のファイルに分ける場合は、指定されたコメントを外すことを忘れないでください!
"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Il frammento di codice del @qq{Modello per quartetto d'archi} crea un bel
+quartetto, ma cosa fare se si ha bisogno di creare le singole parti? Questo
+nuovo modello mostra come usare la funzionalità @code{\\tag} per dividere
+facilmente un pezzo in parti staccate.
+
+Occorre dividere questo modello in file separati; i nomi dei file sono
+indicati nei commenti all'inizio di ogni file. @code{piece.ly}
+contiene tutte le definizioni musicali. Gli altri file – @code{score.ly},
+@code{vn1.ly}, @code{vn2.ly}, @code{vla.ly} e @code{vlc.ly} –
+creano ciascuna parte.
+
+
+Non dimenticare di togliere i commenti quando usi i file separati!
+
+"
+ doctitleit = "Modello per quartetto d'archi con parti separate"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
Mit diesem Beispiel können Sie ein schönes Streichquartett notieren,
specified, the error message @samp{warning: ignoring too many clashing
note columns} will appear when compiling the LilyPond file. This
message can be suppressed by setting the @code{'ignore-collision}
-property of the @code{NoteColumn} object to @code{#t}.
+property of the @code{NoteColumn} object to @code{#t}. Please note that
+this does not just suppress warnings but stops LilyPond trying to
+resolve collisions at all and so may have unintended results unless
+used with care.
"
doctitle = "Suppressing warnings for clashing note columns"
の音符) に変更が加えられた場合、その変更はピアノ譜にも適用されます。
"
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
texidocit = "
Questo modello aggiunge una riduzione automatica per pianoforte alla tipica
partitura vocale SATB illustrata in @qq{Modello per complesso vocale}. Si
\version "2.14.0"
\header {
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
- texidocit = "
-Questo modello è fondamentalmente analogo al semplice modello @qq{Complesso vocale},
-con l'unica differenza che qui tutti i versi del testo sono posizionati
-usando @code{alignAboveContext} e @code{alignBelowContext}.
-
-"
- doctitleit = "Modello per gruppo vocale con testo allineato sotto e sopra i righi"
-
lsrtags = "text, vocal-music, contexts-and-engravers, template"
-
-
-
%% Translation of GIT committish: 70f5f30161f7b804a681cd080274bfcdc9f4fe8c
texidoces = "
Esta plantilla es, básicamente, la misma que la sencilla plantilla
@code{alignAboveContext} と @code{alignBelowContext} を用いて配置されています。
"
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
+ texidocit = "
+Questo modello è fondamentalmente analogo al semplice modello @qq{Complesso vocale},
+con l'unica differenza che qui tutti i versi del testo sono posizionati
+usando @code{alignAboveContext} e @code{alignBelowContext}.
+
+"
+ doctitleit = "Modello per gruppo vocale con testo allineato sotto e sopra i righi"
+
%% Translation of GIT committish: 0a868be38a775ecb1ef935b079000cebbc64de40
texidocde = "
In diesem Beispiel werden die Texte mit den Befehlen
doctitlees = "Estrofa para solista y estribillo a dos voces"
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
texidocit = "
Questo modello crea una partitura che inizia con una sezione solistica e
prosegue in un ritornello a due voci. Illustra anche l'uso delle
便利です。例えば、拍子記号と調号はほとんど常にすべてのパートで同じです。\"賛美@c
歌\" テンプレートのように、4 つのボイスは 2 つの譜にグループ分けされています。"
-%% Translation of GIT committish: 4077120c18ac1dc490501b3d7d5886bc93e61a42
+%% Translation of GIT committish: 514674cb00c18629242dfcde0c1a4976758adc56
texidocit = "
Ecco una tipica partitura corale a quattro parti, SATB. Se il complesso è più
ampio, è spesso comodo scrivere gli elementi comuni in un'unica sezione, che
@item --pdf
Create PDF files for use with PDF@LaTeX{}.
+@item --redirect-lilypond-output
+By default, output is displayed on the terminal. This option redirects
+all output to log files in the same directory as the source files.
+
@itemx --use-source-file-names
Write snippet output files with the same base name as their source file.
This option works only for snippets included with @code{lilypondfile}
The @code{ps}, @code{eps}, and @code{svg} backends support this
option.
+@item gui
+Runs silently and redirect all output to a log file.
+
+Note to Windows users: By default @code{lilypond.exe} outputs all
+progress information to the command window, @code{lilypond-windows.exe}
+does not and returns a prompt, with no progress information, immediately
+at the command line. The @code{-dgui} option can be used in this case
+to redirect output to a log file.
+
+
@item print-pages
Generate the full pages, the default. @code{-dno-print-pages} is
useful in combination with @code{-dpreview}.
@itemize
+@item
+@ref{All}:
+previous stable versions and current as a compressed archive.
+
@item
@ref{Translated}:
translation status for non-English readers.
@c used for news about the upcoming release; see CG 10.2
@newsItem
-@subsubheading LilyPond 2.15.6 released! @emph{July 26, 2011}
-
-We are happy to announce the release of LilyPond 2.15.6. This
-release contains the usual number of bugfixes.
-
-It is strongly recommended that normal users do @strong{not} use
-this release, and instead use the stable 2.14 version.
-
-@newsEnd
-
-
-@newsItem
-@subsubheading LilyPond 2.14.2 released! @emph{July 25, 2011}
-
-We are happy to announce the release of LilyPond 2.14.2. This
-fixes a few minor bugs in the stable version, and should cause no
-problems. We recommend that everybody upgrade to this version.
-
-@newsEnd
-
-
-@newsItem
-@subsubheading LilyPond 2.15.5 released! @emph{July 12, 2011}
+@subsubheading Release candidate 1 of 2.16 - LilyPond 2.15.8 released! @emph{Aug 01, 2011}
-We are happy to announce the release of LilyPond 2.15.5. This
-release contains the usual number of bugfixes.
+LilyPond 2.15.8 is out; this is the first release candidate of
+the upcoming 2.16 stable release. All users are invited to
+experiment with this version. New features since 2.14.2 are
+listed in the @qq{Changes} manual on the website section about
+@ref{Development}.
-It is strongly recommended that normal users do @strong{not} use
-this release, and instead use the stable 2.14 version.
+There are no known Critical issues with this release. If no
+Critical bugs are found, then the official 2.16.0 release will be
+on 08 Aug 2011. If you discover any problems, please send us
+@ref{Bug reports}.
@newsEnd
@newsItem
-@subsubheading LilyPond 2.15.4 released! @emph{July 4, 2011}
+@subsubheading LilyPond 2.15.7 released! @emph{July 29, 2011}
-We are happy to announce the release of LilyPond 2.15.4. This
+We are happy to announce the release of LilyPond 2.15.7. This
release contains the usual number of bugfixes.
It is strongly recommended that normal users do @strong{not} use
@newsItem
-@subsubheading LilyPond 2.15.3 released! @emph{June 27, 2011}
-
-We are happy to announce the release of LilyPond 2.15.3. This
-release contains the usual number of bugfixes.
-
-It is strongly recommended that normal users do @strong{not} use
-this release, and instead use the stable 2.14 version.
-
-@newsEnd
-
-
-@newsItem
-@subsubheading LilyPond 2.15.2 released! @emph{June 18, 2011}
+@subsubheading LilyPond 2.15.6 released! @emph{July 26, 2011}
-We are happy to announce the release of LilyPond 2.15.2. This
+We are happy to announce the release of LilyPond 2.15.6. This
release contains the usual number of bugfixes.
It is strongly recommended that normal users do @strong{not} use
@newsItem
-@subsubheading LilyPond 2.14.1 released! @emph{June 12, 2011}
+@subsubheading LilyPond 2.14.2 released! @emph{July 25, 2011}
-We are happy to announce the release of LilyPond 2.14.1. This
+We are happy to announce the release of LilyPond 2.14.2. This
fixes a few minor bugs in the stable version, and should cause no
problems. We recommend that everybody upgrade to this version.
@newsEnd
-@newsItem
-@subsubheading LilyPond 2.15.1 released! @emph{June 11, 2011}
-
-We are happy to announce the release of LilyPond 2.15.1. This is
-the beginning of a new unstable development effort, and adds the
-usual number of bugs.
-
-It is strongly recommended that normal users do @strong{not} use
-this release, and instead use the stable 2.14 version.
-
-@newsEnd
-
-@newsItem
-@subsubheading LilyPond 2.15.0 released! @emph{June 7, 2011}
-
-We are happy to announce the release of LilyPond 2.15.0. This is
-the beginning of a new unstable development effort, and adds the
-usual number of bugs.
-
-It is strongly recommended that normal users do @strong{not} use
-this release, and instead use the stable 2.14 version.
-
-@newsEnd
-
-
-@newsItem
-@subsubheading LilyPond 2.14.0 released! @emph{June 6, 2011}
-
-We are proud to announce the release of GNU LilyPond 2.14.
-LilyPond is a music engraving program, devoted to producing the
-highest-quality sheet music possible. It brings the aesthetics of
-traditionally engraved music to computer printouts.
-
-Many improvements have been made in the past two and a half years
-since the previous main stable version. A few major improvements
-are:
-
-@itemize
-@item
-LilyPond is now licensed under the GNU GPL v3 or higher.
-
-@item
-The vertical spacing engine has been drastically changed, making
-it much more flexible and easier to control.
-
-@item
-Automatic beaming is now more flexible, and beam collisions are
-avoided.
-
-@end itemize
-
-A full list of new features is given in:
-
-@example
-@uref{http://lilypond.org/doc/v2.13/Documentation/changes/index.html}
-@end example
-
-Happy music typesetting! LilyPond 2.14 was brought to you by...
-
-Main development team:
-
-Trevor Daniels, Reinhold Kainhofer, David Kastrup, Jonathan Kulp,
-Werner Lemberg, John Mandereau, Patrick McCarty, Joe Neeman,
-Han-Wen Nienhuys, Jan Nieuwenhuizen, Graham Percival, Mark
-Polesky, Neil Puttock, Mike Solomon, Carl Sorensen, Francisco
-Vila, Valentin Villenave.
-
-Programming contributors:
-
-Sven Axelsson, Pál Benkő, Bertrand Bordage, Frédéric Bron, Peter Chubb, Hajo Dezelski, Richard
-Gay, Keith OHara, Andrew Hawryluk, Christian Hitz, Marc Hohl,
-Henning Hraban Ramm, Ian Hulin, Michael Käppler, Marek Klein,
-Kieren MacMillan, Thomas Morgan, Benjamin Peterson, Nathan Reed,
-Julien Rioux, Boris Shingarov, Patrick Schmidt, Owen Tuz, Jan Warchoł, Andrew
-Wilson, Rodolfo Zitellini.
-
-Font contributors:
-
-Keith OHara, Marc Hohl, Alexander Kobel, Carsten Steger.
-
-Documentation contributors:
-
-Colin Campbell, Andrew Hawryluk, James Lowe, Mike Moral, Ralph
-Palmer, David Pounder, Patrick Schmidt.
-
-Bug squad:
-
-James E. Bailey, Colin Campbell, Phil Holmes, Urs Liska, Ralph
-Palmer, Kieren MacMillan, Dmytro O. Redchuk.
-
-Binaries support contributors:
-
-Christian Hitz.
-
-Translation contributors:
-
-Federico Bruni, Dénes Harmath, Jean-Charles Malahieude, Tineke de
-Munnik, Till Paala, Ralf Wildenhues, Yoshiki Sawada.
-
-@newsEnd
-
* don't duplicate entries from news-front.itexi
@end ignore
+
+
+@newsItem
+@subsubheading LilyPond 2.15.5 released! @emph{July 12, 2011}
+
+We are happy to announce the release of LilyPond 2.15.5. This
+release contains the usual number of bugfixes.
+
+It is strongly recommended that normal users do @strong{not} use
+this release, and instead use the stable 2.14 version.
+
+@newsEnd
+
+
+@newsItem
+@subsubheading LilyPond 2.15.4 released! @emph{July 4, 2011}
+
+We are happy to announce the release of LilyPond 2.15.4. This
+release contains the usual number of bugfixes.
+
+It is strongly recommended that normal users do @strong{not} use
+this release, and instead use the stable 2.14 version.
+
+@newsEnd
+
+
+@newsItem
+@subsubheading LilyPond 2.15.3 released! @emph{June 27, 2011}
+
+We are happy to announce the release of LilyPond 2.15.3. This
+release contains the usual number of bugfixes.
+
+It is strongly recommended that normal users do @strong{not} use
+this release, and instead use the stable 2.14 version.
+
+@newsEnd
+
+
+@newsItem
+@subsubheading LilyPond 2.15.2 released! @emph{June 18, 2011}
+
+We are happy to announce the release of LilyPond 2.15.2. This
+release contains the usual number of bugfixes.
+
+It is strongly recommended that normal users do @strong{not} use
+this release, and instead use the stable 2.14 version.
+
+@newsEnd
+
+
+@newsItem
+@subsubheading LilyPond 2.14.1 released! @emph{June 12, 2011}
+
+We are happy to announce the release of LilyPond 2.14.1. This
+fixes a few minor bugs in the stable version, and should cause no
+problems. We recommend that everybody upgrade to this version.
+
+@newsEnd
+
+@newsItem
+@subsubheading LilyPond 2.15.1 released! @emph{June 11, 2011}
+
+We are happy to announce the release of LilyPond 2.15.1. This is
+the beginning of a new unstable development effort, and adds the
+usual number of bugs.
+
+It is strongly recommended that normal users do @strong{not} use
+this release, and instead use the stable 2.14 version.
+
+@newsEnd
+
+@newsItem
+@subsubheading LilyPond 2.15.0 released! @emph{June 7, 2011}
+
+We are happy to announce the release of LilyPond 2.15.0. This is
+the beginning of a new unstable development effort, and adds the
+usual number of bugs.
+
+It is strongly recommended that normal users do @strong{not} use
+this release, and instead use the stable 2.14 version.
+
+@newsEnd
+
+
+@newsItem
+@subsubheading LilyPond 2.14.0 released! @emph{June 6, 2011}
+
+We are proud to announce the release of GNU LilyPond 2.14.
+LilyPond is a music engraving program, devoted to producing the
+highest-quality sheet music possible. It brings the aesthetics of
+traditionally engraved music to computer printouts.
+
+Many improvements have been made in the past two and a half years
+since the previous main stable version. A few major improvements
+are:
+
+@itemize
+@item
+LilyPond is now licensed under the GNU GPL v3 or higher.
+
+@item
+The vertical spacing engine has been drastically changed, making
+it much more flexible and easier to control.
+
+@item
+Automatic beaming is now more flexible, and beam collisions are
+avoided.
+
+@end itemize
+
+A full list of new features is given in:
+
+@example
+@uref{http://lilypond.org/doc/v2.13/Documentation/changes/index.html}
+@end example
+
+Happy music typesetting! LilyPond 2.14 was brought to you by...
+
+Main development team:
+
+Trevor Daniels, Reinhold Kainhofer, David Kastrup, Jonathan Kulp,
+Werner Lemberg, John Mandereau, Patrick McCarty, Joe Neeman,
+Han-Wen Nienhuys, Jan Nieuwenhuizen, Graham Percival, Mark
+Polesky, Neil Puttock, Mike Solomon, Carl Sorensen, Francisco
+Vila, Valentin Villenave.
+
+Programming contributors:
+
+Sven Axelsson, Pál Benkő, Bertrand Bordage, Frédéric Bron, Peter Chubb, Hajo Dezelski, Richard
+Gay, Keith OHara, Andrew Hawryluk, Christian Hitz, Marc Hohl,
+Henning Hraban Ramm, Ian Hulin, Michael Käppler, Marek Klein,
+Kieren MacMillan, Thomas Morgan, Benjamin Peterson, Nathan Reed,
+Julien Rioux, Boris Shingarov, Patrick Schmidt, Owen Tuz, Jan Warchoł, Andrew
+Wilson, Rodolfo Zitellini.
+
+Font contributors:
+
+Keith OHara, Marc Hohl, Alexander Kobel, Carsten Steger.
+
+Documentation contributors:
+
+Colin Campbell, Andrew Hawryluk, James Lowe, Mike Moral, Ralph
+Palmer, David Pounder, Patrick Schmidt.
+
+Bug squad:
+
+James E. Bailey, Colin Campbell, Phil Holmes, Urs Liska, Ralph
+Palmer, Kieren MacMillan, Dmytro O. Redchuk.
+
+Binaries support contributors:
+
+Christian Hitz.
+
+Translation contributors:
+
+Federico Bruni, Dénes Harmath, Jean-Charles Malahieude, Tineke de
+Munnik, Till Paala, Ralf Wildenhues, Yoshiki Sawada.
+
+@newsEnd
+
+
+
@newsItem
@subsubheading Release candidate 7 of 2.14 - LilyPond 2.13.63 released! @emph{May 30, 2011}
PACKAGE_NAME=LilyPond
MAJOR_VERSION=2
MINOR_VERSION=15
-PATCH_LEVEL=7
+PATCH_LEVEL=9
MY_PATCH_LEVEL=
VERSION_STABLE=2.14.2
-VERSION_DEVEL=2.15.6
+VERSION_DEVEL=2.15.8
(defun LilyPond-menu-keywords ()
"Make Insert Tag menu.
-The Insert Tag -menu is splitted into parts if it is long enough."
+The Insert Tag -menu is split into parts if it is long enough."
(let ((li (mapcar 'LilyPond-menu-keywords-item LilyPond-menu-keywords))
(w (round (sqrt (length LilyPond-menu-keywords))))
- (splitted '())
+ (split '())
(imin 0) imax lw rw)
(while (< imin (length LilyPond-menu-keywords))
(setq imax (- (min (+ imin w) (length LilyPond-menu-keywords)) 1))
(setq lw (nth imin LilyPond-menu-keywords))
(setq rw (nth imax LilyPond-menu-keywords))
- (add-to-list 'splitted
+ (add-to-list 'split
(let ((l (list (concat (substring lw 0 (min 7 (length lw)))
" ... "
(substring rw 0 (min 7 (length rw)))))))
(add-to-list 'l (nth imin li))
(setq imin (1+ imin)))
(reverse l))))
- (if (> (length LilyPond-menu-keywords) 12) (reverse splitted) li)))
+ (if (> (length LilyPond-menu-keywords) 12) (reverse split) li)))
;;; LilyPond-mode-menu should not be interactive, via "M-x LilyPond-<Tab>"
(easy-menu-define LilyPond-mode-menu
void *
lily_fopencookie (void *cookie,
- char const * /* modes */,
- lily_cookie_io_functions_t /* io_funcs */)
+ char const * /* modes */,
+ lily_cookie_io_functions_t /* io_funcs */)
{
assert (is_memory_stream (cookie));
return (FILE *) cookie;
much be exchanged. */
#if 0
static /* avoid warning */
-#endif
+#endif
string
slashify (string file_name)
{
s = s.substr (0, s.rfind ('/'));
else
s = "";
-
+
return s;
}
return s;
}
-
string
File_name::file_part () const
{
string f = file_part ();
if (!f.empty ()
- && !dir_.empty())
+ && !dir_.empty ())
{
d += ::to_string (DIRSEP);
}
File_name::is_absolute () const
{
/*
- Hmm. Is c:foo absolute?
+ Hmm. Is c:foo absolute?
*/
return (dir_.length () && dir_[0] == DIRSEP) || root_.length ();
}
-
-
File_name
File_name::canonicalized () const
{
replace_all (&c.dir_, string ("//"), string ("/"));
- vector<string> components = string_split (c.dir_, '/');
+ vector<string> components = string_split (c.dir_, '/');
vector<string> new_components;
for (vsize i = 0; i < components.size (); i++)
{
if (components[i] == "..")
- new_components.pop_back ();
+ new_components.pop_back ();
else
- new_components.push_back (components[i]);
+ new_components.push_back (components[i]);
}
- c.dir_ = string_join (new_components, "/");
- return c;
+ c.dir_ = string_join (new_components, "/");
+ return c;
}
canonicalize; in particular, trailing slashes should disappear.
*/
file_name = File_name (file_name).to_string ();
-
+
#if !STAT_MACROS_BROKEN
struct stat sbuf;
if (stat (file_name.c_str (), &sbuf) != 0)
file_name.root_ = dir.root_;
dir.root_ = "";
if (file_name.dir_.empty ())
- file_name.dir_ = dir.to_string ();
+ file_name.dir_ = dir.to_string ();
else if (!dir.to_string ().empty ())
- file_name.dir_ = dir.to_string ()
- + ::to_string (DIRSEP) + file_name.dir_;
+ file_name.dir_ = dir.to_string ()
+ + ::to_string (DIRSEP) + file_name.dir_;
if (is_file (file_name.to_string ()))
- return file_name.to_string ();
+ return file_name.to_string ();
}
return "";
}
{
if (name.empty () || name == "-")
return name;
-
+
File_name file_name (name);
string orig_ext = file_name.ext_;
for (int i = 0; extensions[i]; i++)
{
file_name.ext_ = orig_ext;
if (*extensions[i] && !file_name.ext_.empty ())
- file_name.ext_ += ".";
+ file_name.ext_ += ".";
file_name.ext_ += extensions[i];
string found = find (file_name.to_string ());
if (!found.empty ())
- return found;
+ return found;
}
-
+
return "";
}
{
s = s + dirs_[i];
if (i < dirs_.size () - 1)
- s += ::to_string (PATHSEP);
+ s += ::to_string (PATHSEP);
}
return s;
}
char const *ln = option_a_[i].longname_str0_;
if (ln && !strncmp (ln, optnm, searchlen))
- {
- found_option_ = option_a_ + i;
- break;
- }
+ {
+ found_option_ = option_a_ + i;
+ break;
+ }
}
if (!found_option_)
if (found_option_->take_arg_str0_)
{
if (endopt)
- optional_argument_str0_ = endopt +1; // a '='
+ optional_argument_str0_ = endopt + 1; // a '='
else
- {
- optional_argument_str0_ = arg_value_char_a_a_[array_index_];
- array_index_++;
- }
+ {
+ optional_argument_str0_ = arg_value_char_a_a_[array_index_];
+ array_index_++;
+ }
if (!optional_argument_str0_)
- report (E_ARGEXPECT);
+ report (E_ARGEXPECT);
}
else
{
optional_argument_str0_ = 0;
if (endopt)
- report (E_NOARGEXPECT);
+ report (E_NOARGEXPECT);
}
return found_option_;
if (take_arg_str0_)
{
if (longname_str0_)
- s = s + "=";
+ s = s + "=";
else
- s = s + " ";
+ s = s + " ";
s = s + gettext (take_arg_str0_);
}
{
case E_ARGEXPECT:
str += _f ("option `%s' requires an argument",
- found_option_->to_string ());
+ found_option_->to_string ());
break;
case E_NOARGEXPECT:
str += _f ("option `%s' does not allow an argument",
- found_option_->to_string ());
+ found_option_->to_string ());
break;
case E_UNKNOWNOPTION:
str += _f ("unrecognized option: `%s'",
- string (argument_index_
- ? string ("-" + string (1, arg_value_char_a_a_[array_index_][argument_index_]))
- : string (arg_value_char_a_a_[array_index_])));
+ string (argument_index_
+ ? string ("-" + string (1, arg_value_char_a_a_[array_index_][argument_index_]))
+ : string (arg_value_char_a_a_[array_index_])));
break;
case E_ILLEGALARG:
str += _f ("invalid argument `%s' to option `%s'",
- optional_argument_str0_, found_option_->to_string ());
+ optional_argument_str0_, found_option_->to_string ());
break;
default:
assert (false);
for (int i = 0; i < table_len_; i++)
if (option_a_[i].shortname_char_ == c)
{
- found_option_ = option_a_ + i;
- break;
+ found_option_ = option_a_ + i;
+ break;
}
if (!found_option_)
if (argument[0] != '-')
return 0;
- if (argument[1] == '-') {// what to do with "command -- bla"
- if (argument[2])
- return parselong ();
- else
- return 0;
- }
+ if (argument[1] == '-') // what to do with "command -- bla"
+ {
+ if (argument[2])
+ return parselong ();
+ else
+ return 0;
+ }
else
{
if (argument[ 1 ])
- {
- argument_index_ = 1;
- return parseshort ();
- }
+ {
+ argument_index_ = 1;
+ return parseshort ();
+ }
else
- return 0;
+ return 0;
}
}
{
error_ = E_NOERROR;
while (array_index_ < argument_count_
- && !arg_value_char_a_a_[array_index_][argument_index_])
+ && !arg_value_char_a_a_[array_index_][argument_index_])
{
array_index_++;
argument_index_ = 0;
int wid = 0;
for (int i = 0; l[i].shortname_char_ || l[i].longname_str0_; i++)
- wid = max (int(wid), int(l[i].str_for_help ().length ()));
+ wid = max (int (wid), int (l[i].str_for_help ().length ()));
for (int i = 0; l[i].shortname_char_ || l[i].longname_str0_; i++)
{
string help_text (gettext (l[i].help_str0_));
replace_all (&help_text, "\n",
- "\n" + string (wid + EXTRA_SPACES + 2, ' '));
+ "\n" + string (wid + EXTRA_SPACES + 2, ' '));
tabstr += s + help_text + "\n";
}
int
Long_option_init::compare (Long_option_init const &a, Long_option_init const &b)
{
- if (a.shortname_char_ && b.shortname_char_ && a.shortname_char_- b.shortname_char_)
+ if (a.shortname_char_ && b.shortname_char_ && a.shortname_char_ - b.shortname_char_)
return a.shortname_char_ - b.shortname_char_;
if (b.shortname_char_ && a.longname_str0_)
#ifndef ARITHMETIC_OPERATOR_HH
#define ARITHMETIC_OPERATOR_HH
-#define IMPLEMENT_ARITHMETIC_OPERATOR(type, op) \
- inline type \
- operator op (type a1, type const &a2) \
- { \
- a1 op ## = a2; \
- return a1; \
+#define IMPLEMENT_ARITHMETIC_OPERATOR(type, op) \
+ inline type \
+ operator op (type a1, type const &a2) \
+ { \
+ a1 op ## = a2; \
+ return a1; \
}
#endif /* ARITHMETIC_OPERATOR_HH */
using namespace std;
enum Axis
- {
- X_AXIS = 0,
- Y_AXIS = 1,
- NO_AXES = 2,
- };
+{
+ X_AXIS = 0,
+ Y_AXIS = 1,
+ NO_AXES = 2,
+};
static inline
Axis
#ifndef COMPARE_HH
#define COMPARE_HH
-#define ONE_OPERATOR(type, function, op) \
- inline bool \
- operator op (type t1, type t2) \
- { \
- return function (t1, t2) op 0; \
+#define ONE_OPERATOR(type, function, op) \
+ inline bool \
+ operator op (type t1, type t2) \
+ { \
+ return function (t1, t2) op 0; \
}
/** handy notations for a signed comparison.
make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
Please fill a & in the type argument if necessary.
*/
-#define TEMPLATE_INSTANTIATE_COMPARE(type, function, prefix) \
- prefix ONE_OPERATOR (type, function, >) \
- prefix ONE_OPERATOR (type, function, >=) \
- prefix ONE_OPERATOR (type, function, ==) \
- prefix ONE_OPERATOR (type, function, !=) \
- prefix ONE_OPERATOR (type, function, <) \
- prefix ONE_OPERATOR (type, function, <=) \
- /* namespace std { */ \
+#define TEMPLATE_INSTANTIATE_COMPARE(type, function, prefix) \
+ prefix ONE_OPERATOR (type, function, >) \
+ prefix ONE_OPERATOR (type, function, >=) \
+ prefix ONE_OPERATOR (type, function, ==) \
+ prefix ONE_OPERATOR (type, function, !=) \
+ prefix ONE_OPERATOR (type, function, <) \
+ prefix ONE_OPERATOR (type, function, <=) \
+ /* namespace std { */ \
prefix inline type max (type t1, type t2) { return (t1 > t2) ? t1 : t2; } \
prefix inline type min (type t1, type t2) { return (t1 < t2) ? t1 : t2; } \
- /* } */ \
- /* stupid fix to allow ; */ \
+ /* } */ \
+ /* stupid fix to allow ; */ \
prefix bool operator < (type t1, type t2)
#define INSTANTIATE_COMPARE(type, func) TEMPLATE_INSTANTIATE_COMPARE (type, func,)
#include "axis.hh"
enum Direction
- {
- UP = 1,
- DOWN=-1,
- LEFT=-1,
- RIGHT = 1,
- MIN=-1,
- MAX = 1,
- CENTER = 0,
- SMALLER=-1,
- BIGGER = 1,
- START = -1,
- STOP = 1,
-
- /*
- This is necessary to safely write loops,
- since
-
- dir <= RIGHT
-
- is otherwise transformed into true unconditionally.
- */
- DIRECTION_LIMIT = 2,
- DIRECTION_NEG_LIMIT = -2,
- };
+{
+ UP = 1,
+ DOWN = -1,
+ LEFT = -1,
+ RIGHT = 1,
+ MIN = -1,
+ MAX = 1,
+ CENTER = 0,
+ SMALLER = -1,
+ BIGGER = 1,
+ START = -1,
+ STOP = 1,
+
+ /*
+ This is necessary to safely write loops,
+ since
+
+ dir <= RIGHT
+
+ is otherwise transformed into true unconditionally.
+ */
+ DIRECTION_LIMIT = 2,
+ DIRECTION_NEG_LIMIT = -2,
+};
inline Direction
other_dir (Direction const d)
{
return at (d);
}
- T const& operator [] (Direction d) const
+ T const &operator [] (Direction d) const
{
return at (d);
}
linear_combination (Drul_array<Real> const &d, Real x)
{
return ((1.0 - x) * Real (d.at (LEFT))
- + (x + 1.0) * Real (d.at (RIGHT))) * 0.5;
+ + (x + 1.0) * Real (d.at (RIGHT))) * 0.5;
}
#endif /* DRUL_ARRAY_HH */
#include <unistd.h>
#include <cstdio>
-using namespace std;
-
+ using namespace std;
#if (! defined (__off64_t) && ! defined (__off64_t_defined)) || ! defined (__cplusplus)
#define off64_t unsigned long long
} lily_cookie_io_functions_t;
void *lily_fopencookie (void *cookie, char const *modes,
- lily_cookie_io_functions_t io_funcs);
+ lily_cookie_io_functions_t io_funcs);
int lily_cookie_fclose (void *);
int lily_cookie_fprintf (void *file, char const *format, ...)
- __attribute__ ((format (printf, 2, 3)));
+ __attribute__ ((format (printf, 2, 3)));
int lily_cookie_putc (int c, void *file);
#ifdef __cplusplus
string base_;
string ext_;
- File_name (string="");
+ File_name (string = "");
bool is_absolute () const;
string to_string () const;
/** errorcodes: no error, argument expected, no argument expected,
unknown option, illegal argument (eg. int expected). */
enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
- E_ILLEGALARG };
+ E_ILLEGALARG
+ };
/// argument. Set to 0 if not present
char const *optional_argument_str0_;
GNU gettext
*/
string _f (char const *format, ...)
- __attribute__ ((format (printf, 1, 2)));
+__attribute__ ((format (printf, 1, 2)));
string _f (char const *format, string s, string s2 = "", string s3 = "");
/**
va_list version of _f
{
if (!is_empty ())
{
- at (LEFT) *= r;
- at (RIGHT) *= r;
- if (r < T (0))
- swap ();
+ at (LEFT) *= r;
+ at (RIGHT) *= r;
+ if (r < T (0))
+ swap ();
}
return *this;
}
}
typedef Interval_t<Real> Interval;
-typedef Interval_t<int> Slice; // weird name
+typedef Interval_t<int> Slice; // weird name
#endif // INTERVAL_HH
Interval_t<T>::set_empty ()
{
at (LEFT) = (T) infinity ();
- at (RIGHT) = (T) -infinity ();
+ at (RIGHT) = (T) - infinity ();
}
template<class T>
void
Interval_t<T>::set_full ()
{
- at (LEFT) = (T) -infinity ();
+ at (LEFT) = (T) - infinity ();
at (RIGHT) = (T) infinity ();
}
string s ("[");
return (s + T_to_string (at (LEFT)) + string (",")
- + T_to_string (at (RIGHT)) + string ("]"));
+ + T_to_string (at (RIGHT)) + string ("]"));
}
template<class T>
return r >= at (LEFT) && r <= at (RIGHT);
}
-#define INTERVAL__INSTANTIATE(T) struct Interval_t<T>; \
+#define INTERVAL__INSTANTIATE(T) struct Interval_t<T>; \
template int Interval__compare (const Interval_t<T> &, Interval_t<T> const &)
#endif // INTERVAL_TCC
char *strnlwr (char *start, int n);
char *strnupr (char *start, int n);
-#if ! HAVE_MEMMEM /* GNU extension. */
+#if ! HAVE_MEMMEM /* GNU extension. */
void *memmem (void const *haystack, int haystack_len,
- void const *needle, int needle_len);
+ void const *needle, int needle_len);
#endif /* HAVE_MEMMEM */
#if ! HAVE_MEMRCHR
double my_round (double);
/* namespace std { */
-
-#if ! HAVE_SNPRINTF /* GNU extension. */
+
+#if ! HAVE_SNPRINTF /* GNU extension. */
int snprintf (char *str, size_t n, char const *format, ...);
- __attribute__ ((format (printf, 3, 4)));
+__attribute__ ((format (printf, 3, 4)));
#endif
-#if ! HAVE_VSNPRINTF /* GNU extension. */
+#if ! HAVE_VSNPRINTF /* GNU extension. */
int vsnprintf (char *str, size_t, char const *format, va_list args);
#endif
#ifndef isinf
-#if ! HAVE_ISINF /* BSD extension. */
+#if ! HAVE_ISINF /* BSD extension. */
int isinf (double x);
#endif
#endif
#include "std-vector.hh"
-template<class T, class A=std::allocator<T> >
+template<class T, class A = std::allocator<T> >
class Matrix
{
public:
}
Matrix<T, A> (vsize rows, vsize columns, T const &t)
- : data_(rows * columns, t)
+ : data_ (rows *columns, t)
{
rank_ = rows;
}
data_.resize (rows * columns, t);
else
{
- vector<T,A> new_data;
- new_data.resize (rows * columns, t);
- vsize cur_cols = rank_ ? data_.size () / rank_: 0;
-
- for (vsize i = 0; i < cur_cols; i++)
- for (vsize j = 0; j < rank_; j++)
- new_data[i*rows + j] = data_[i*rank_ + j];
- rank_ = rows;
- data_ = new_data;
+ vector<T, A> new_data;
+ new_data.resize (rows * columns, t);
+ vsize cur_cols = rank_ ? data_.size () / rank_ : 0;
+
+ for (vsize i = 0; i < cur_cols; i++)
+ for (vsize j = 0; j < rank_; j++)
+ new_data[i * rows + j] = data_[i * rank_ + j];
+ rank_ = rows;
+ data_ = new_data;
}
}
#include "std-string.hh"
#include "real.hh"
-
/*
This is a mixture a 2D vector. Sometimes it can
also be convenient to think of 2D vectors as complex numbers
Offset &operator /= (Real a)
{
- (*this) *= 1/a;
+ (*this) *= 1 / a;
return *this;
}
}
Offset direction () const;
Offset swapped () const;
-
+
Real arg () const;
Real angle_degrees () const;
Real length () const;
IMPLEMENT_ARITHMETIC_OPERATOR (Offset, -);
IMPLEMENT_ARITHMETIC_OPERATOR (Offset, *);
-
-
Offset complex_multiply (Offset, Offset);
Offset complex_divide (Offset, Offset);
Offset complex_exp (Offset);
template<class T>
class Link_array : public vector<T *>
{
-
+
};
#endif // PARRAY_HH
#include "arithmetic-operator.hh"
#include "real.hh"
-/// structure for a polynomial in one var.
+/// structure for a polynomial in one var.
struct Polynomial
{
/// degree of polynomial
int degree ()const;
- /// coefficients
+ /// coefficients
vector<Real> coefs_;
// leading coef
void operator *= (Polynomial const &p2);
void operator -= (Polynomial const &p2);
Polynomial (Real a, Real b = 0.0);
- Polynomial (){}
+ Polynomial () {}
void set_negate (const Polynomial &src);
/// take the derivative
vsize j = i / 2;
while (j)
{
- if (compare (elt (j), v) > 0)
- {
- elt (i) = elt (j);
- i = j;
- j = i / 2;
- }
- else
- break;
+ if (compare (elt (j), v) > 0)
+ {
+ elt (i) = elt (j);
+ i = j;
+ j = i / 2;
+ }
+ else
+ break;
}
elt (i) = v;
OK ();
while (mini < size ())
{
- if (compare (elt (mini + 1), elt (mini)) < 0)
- mini++;
- if (compare (last, elt (mini)) < 0)
- break;
- elt (lasti) = elt (mini);
- lasti = mini;
- mini *= 2;
+ if (compare (elt (mini + 1), elt (mini)) < 0)
+ mini++;
+ if (compare (last, elt (mini)) < 0)
+ break;
+ elt (lasti) = elt (mini);
+ lasti = mini;
+ mini *= 2;
}
elt (lasti) = last;
heap_array_.pop_back ();
Rational (Rational const &r) { copy (r);}
Rational &operator = (Rational const &r)
{
- copy (r); return *this;
+ copy (r);
+ return *this;
}
Rational &operator *= (Rational);
#include "arithmetic-operator.hh"
-IMPLEMENT_ARITHMETIC_OPERATOR (Rational, /);
+IMPLEMENT_ARITHMETIC_OPERATOR (Rational, / );
IMPLEMENT_ARITHMETIC_OPERATOR (Rational, +);
IMPLEMENT_ARITHMETIC_OPERATOR (Rational, *);
IMPLEMENT_ARITHMETIC_OPERATOR (Rational, -);
-IMPLEMENT_ARITHMETIC_OPERATOR (Rational, %);
+IMPLEMENT_ARITHMETIC_OPERATOR (Rational, % );
INSTANTIATE_COMPARE (Rational const &, Rational::compare);
extern const Real infinity_f;
/* namespace std { */
-
+
template<class T> inline T abs (T x)
{
return x > 0 ? x : -x;
#ifndef STD_STRING_HH
#define STD_STRING_HH
-
+
#include "compare.hh"
#include "flower-proto.hh"
#define NPOS string::npos
string to_string (string s);
-string to_string (char c, int n=1);
-string to_string (int i, char const *format=0);
-string to_string (double f, char const *format=0);
+string to_string (char c, int n = 1);
+string to_string (int i, char const *format = 0);
+string to_string (double f, char const *format = 0);
string to_string (long);
string to_string (long unsigned);
-string to_string (I64, char const *format=0);
+string to_string (I64, char const *format = 0);
string to_string (unsigned);
string to_string (bool b);
string to_string (char const *format, ...)
- __attribute__ ((format (printf, 1, 2)));
-
-string &replace_all (string* str, string const &find, string const &replace);
-string &replace_all (string* str, char find, char replace);
+__attribute__ ((format (printf, 1, 2)));
+
+string &replace_all (string *str, string const &find, string const &replace);
+string &replace_all (string *str, char find, char replace);
char *string_copy (string s);
int string_compare (string const &, string const &);
INSTANTIATE_COMPARE (string const &, string_compare);
-
#endif /* STD_STRING_HH */
#include <vector>
#undef vector
-namespace std {
+namespace std
+{
+
+/* Interface without pointer arithmetic (iterator) semantics. */
+template<typename T, typename A = std::allocator<T> >
+class vector : public __flower_vector<T, A>
+{
+public:
+ typedef typename __flower_vector<T>::iterator iterator;
+ typedef typename __flower_vector<T>::const_iterator const_iterator;
+
+ vector<T, A> () : __flower_vector<T, A> ()
+ {
+ }
+
+ vector<T, A> (vector<T, A> const &v) : __flower_vector<T, A> (v)
+ {
+ }
- /* Interface without pointer arithmetic (iterator) semantics. */
- template<typename T, typename A=std::allocator<T> >
- class vector : public __flower_vector<T, A>
+ vector<T, A> (const_iterator b, const_iterator e) : __flower_vector<T, A> (b, e)
{
- public:
- typedef typename __flower_vector<T>::iterator iterator;
- typedef typename __flower_vector<T>::const_iterator const_iterator;
-
- vector<T, A> () : __flower_vector<T, A> ()
- {
- }
-
- vector<T, A> (vector<T, A> const& v) : __flower_vector<T, A> (v)
- {
- }
-
- vector<T, A> (const_iterator b, const_iterator e) : __flower_vector<T, A> (b, e)
- {
- }
-
- T*
- data ()
- {
- return &(*this)[0];
- }
-
- T const*
- data () const
- {
- return &(*this)[0];
- }
- };
+ }
+
+ T *
+ data ()
+ {
+ return &(*this)[0];
+ }
+
+ T const *
+ data () const
+ {
+ return &(*this)[0];
+ }
+};
} /* namespace std */
}
template<typename T>
-T&
+T &
back (vector<T> &v, vsize i)
{
return v[v.size () - i - 1];
template<typename T>
void
-concat (vector<T> &v, vector<T> const& w)
+concat (vector<T> &v, vector<T> const &w)
{
v.insert (v.end (), w.begin (), w.end ());
}
template<typename T, typename Compare>
vsize
lower_bound (vector<T> const &v,
- T const &key,
- Compare less,
- vsize b=0, vsize e=VPOS)
+ T const &key,
+ Compare less,
+ vsize b = 0, vsize e = VPOS)
{
if (e == VPOS)
e = v.size ();
typename vector<T>::const_iterator i = lower_bound (v.begin () + b,
- v.begin () + e,
- key,
- less);
+ v.begin () + e,
+ key,
+ less);
return i - v.begin ();
}
template<typename T, typename Compare>
vsize
upper_bound (vector<T> const &v,
- T const &key,
- Compare less,
- vsize b=0, vsize e=VPOS)
+ T const &key,
+ Compare less,
+ vsize b = 0, vsize e = VPOS)
{
if (e == VPOS)
e = v.size ();
typename vector<T>::const_iterator i = upper_bound (v.begin () + b,
- v.begin () + e,
- key,
- less);
+ v.begin () + e,
+ key,
+ less);
return i - v.begin ();
}
template<typename T, typename Compare>
vsize
binary_search (vector<T> const &v,
- T const &key,
- Compare less=less<T> (),
- vsize b=0, vsize e=VPOS)
+ T const &key,
+ Compare less = less<T> (),
+ vsize b = 0, vsize e = VPOS)
{
vsize lb = lower_bound (v, key, less, b, e);
template<typename T, typename Compare>
void
vector_sort (vector<T> &v,
- Compare less,
- vsize b=0, vsize e=VPOS)
+ Compare less,
+ vsize b = 0, vsize e = VPOS)
{
if (e == VPOS)
e = v.size ();
template<typename T> struct del : public unary_function<T, void>
{
- void operator() (T x)
+ void operator () (T x)
{
delete x;
x = 0;
static int dec2int (string dec_string);
static double dec2double (string dec_string);
static string double_string (double f, char const *fmt = 0);
- static string form_string (char const *format, ...) __attribute__ ((format (printf, 1,2)));
+ static string form_string (char const *format, ...) __attribute__ ((format (printf, 1, 2)));
static string vform_string (char const *format, va_list args);
static int hex2int (string str);
static unsigned hex2unsigned (string str);
Tuple ()
{
}
-
+
Tuple (T const *src)
{
for (int i = 0; i < N; i++)
{
}
-
+
Tuple2 (K a, K b)
{
- Tuple<K,2> *p(this); // ugr.
-
+ Tuple<K, 2> *p (this); // ugr.
+
p->t_array[0] = a;
p->t_array[1] = b;
}
};
-
template<class T, int N>
inline bool
-operator<(Tuple<T, N> const &t1,
- Tuple<T, N> const &t2)
+operator <(Tuple<T, N> const &t1,
+ Tuple<T, N> const &t2)
{
- for (int i = 0; i < N ; i++)
+ for (int i = 0; i < N; i++)
{
if (t1.t_array[i] > t2.t_array[i])
- return false;
+ return false;
if (t1.t_array[i] < t2.t_array[i])
- return true;
+ return true;
}
return false;
#include <typeinfo>
using namespace std;
-
/*
-
Virtual copy constructor. Make up for C++'s lack of a standard
factory or clone () function. Usage:
{
VIRTUAL_COPY_CONSTRUCTOR (Baseclass, Foo);
};
-
*/
#define DECLARE_CLASSNAME(name) \
- virtual const char *class_name () const { \
+ virtual const char *class_name () const { \
return #name; \
}
-#define VIRTUAL_COPY_CONSTRUCTOR(Base, name) \
+#define VIRTUAL_COPY_CONSTRUCTOR(Base, name) \
DECLARE_CLASSNAME(name);\
- virtual Base *clone () const \
- { \
- return new name (*this); \
+ virtual Base *clone () const \
+ { \
+ return new name (*this); \
}
#endif /* VIRTUAL_METHODS_HH */
#define TEST_PARAMETER(Suite, Case, Type, value) \
namespace { \
struct Case: public yaffut::Test<Suite, Case>{ \
- Type parameter_one_; \
+ Type parameter_one_; \
Case (); \
}; \
} \
#define ASSERT_THROW YAFFUT_ASSERT_THROW
#endif
-namespace yaffut {
+namespace yaffut
+{
template <typename T>
-std::string demangle()
+std::string demangle ()
{
size_t sz;
int status;
- char* ptr = abi::__cxa_demangle(typeid(T).name(), 0, &sz, &status);
- std::string name(ptr ? ptr : "", ptr ? strlen(ptr) : 0);
- if(ptr){ free(ptr); }
- std::string::size_type pos = name.rfind("::");
- if(pos != std::string::npos)
- {
- name = name.substr(pos + 2);
- }
+ char *ptr = abi::__cxa_demangle (typeid (T).name (), 0, &sz, &status);
+ std::string name (ptr ? ptr : "", ptr ? strlen (ptr) : 0);
+ if (ptr) { free (ptr); }
+ std::string::size_type pos = name.rfind ("::");
+ if (pos != std::string::npos)
+ {
+ name = name.substr (pos + 2);
+ }
return name;
}
struct ITest
{
- virtual ~ITest(){}
+ virtual ~ITest () {}
};
class Factory
{
public:
- typedef ITest* (*Create_t) ();
+ typedef ITest *(*Create_t) ();
private:
typedef std::map<std::string, Create_t> Tests_t;
Tests_t m_Tests;
size_t m_fail;
size_t m_pass;
private:
- Factory(){}
- ~Factory(){}
- static bool EqualsSuiteName (std::string const &name, std::string const& s)
+ Factory () {}
+ ~Factory () {}
+ static bool EqualsSuiteName (std::string const &name, std::string const &s)
{
return name.find (':') >= name.length () - 2
- && s.substr (0, name.length ()) == name;
+ && s.substr (0, name.length ()) == name;
}
public:
- static Factory& Instance()
+ static Factory &Instance ()
{
static Factory instance;
return instance;
}
- void Register(const std::string& name, Create_t create)
+ void Register (const std::string &name, Create_t create)
{
m_Tests[name] = create;
}
size_t Fail () { return m_fail; }
- void List(const std::string& name)
+ void List (const std::string &name)
{
- for(Tests_t::const_iterator it = m_Tests.begin(); it != m_Tests.end(); ++it)
- {
- if(name.empty () || it->first == name
- || EqualsSuiteName (name, it->first))
- std::cout << it->first << std::endl;
- }
+ for (Tests_t::const_iterator it = m_Tests.begin (); it != m_Tests.end (); ++it)
+ {
+ if (name.empty () || it->first == name
+ || EqualsSuiteName (name, it->first))
+ std::cout << it->first << std::endl;
+ }
}
- void Run(const std::string& name)
+ void Run (const std::string &name)
{
- for(Tests_t::const_iterator it = m_Tests.begin(); it != m_Tests.end(); ++it)
- {
- if("All" == name || it->first == name
- || EqualsSuiteName (name, it->first))
+ for (Tests_t::const_iterator it = m_Tests.begin (); it != m_Tests.end (); ++it)
{
- try
- {
- std::cout << std::endl << it->first << ' ' << std::flush;
+ if ("All" == name || it->first == name
+ || EqualsSuiteName (name, it->first))
{
- std::auto_ptr<ITest> test(it->second());
+ try
+ {
+ std::cout << std::endl << it->first << ' ' << std::flush;
+ {
+ std::auto_ptr<ITest> test (it->second ());
+ }
+ std::cout << "[OK]" << std::flush;
+ ++m_pass;
+ }
+ catch (const std::exception &e)
+ {
+ std::cout << "[FAIL]\n " << e.what () << std::flush;
+ ++m_fail;
+ }
+ catch (...)
+ {
+ std::cout << "[FAIL]\n unknown exception" << std::flush;
+ ++m_fail;
+ }
}
- std::cout << "[OK]" << std::flush;
- ++m_pass;
- }
- catch(const std::exception& e)
- {
- std::cout << "[FAIL]\n " << e.what() << std::flush;
- ++m_fail;
- }
- catch(...)
- {
- std::cout << "[FAIL]\n unknown exception" << std::flush;
- ++m_fail;
- }
}
- }
}
void Report ()
{
- const size_t size = m_Tests.size();
+ const size_t size = m_Tests.size ();
std::cout << std::endl;
std::cout << "[TOTAL](" << m_pass + m_fail << '/' << size << ")" << std::endl;
std::cout << "[OK](" << m_pass << '/' << size << ")" << std::endl;
if (m_fail)
std::cout << "[FAIL](" << m_fail << '/' << size << ")" << std::endl;
}
- int Main (int argc, const char* argv[])
+ int Main (int argc, const char *argv[])
{
- if(argc > 1
- && (std::string(argv[1]) == "-h" || std::string(argv[1]) == "--help"))
- {
- std::cout << "Yaffut - Yet Another Framework For Unit Testing.\n\n"
- "Usage: yaffut [OPTION] [Suite:|Suite::Test]...\n\n"
- "Options:\n"
- " -h, --help show this help\n"
- " -l, --list list test cases" << std::endl;
- return 0;
- }
- if(argc > 1
- && (std::string(argv[1]) == "-l" || std::string(argv[1]) == "--list"))
- {
- Factory::Instance().List(argc > 2 ? argv[2] : "");
- return 0;
- }
+ if (argc > 1
+ && (std::string (argv[1]) == "-h" || std::string (argv[1]) == "--help"))
+ {
+ std::cout << "Yaffut - Yet Another Framework For Unit Testing.\n\n"
+ "Usage: yaffut [OPTION] [Suite:|Suite::Test]...\n\n"
+ "Options:\n"
+ " -h, --help show this help\n"
+ " -l, --list list test cases" << std::endl;
+ return 0;
+ }
+ if (argc > 1
+ && (std::string (argv[1]) == "-l" || std::string (argv[1]) == "--list"))
+ {
+ Factory::Instance ().List (argc > 2 ? argv[2] : "");
+ return 0;
+ }
- const char* all[] = {"All"};
- const char** test = all;
+ const char *all[] = {"All"};
+ const char **test = all;
int num = 1;
- if(1 < argc)
- {
- test = argv;
- num = argc;
- }
-
- for(int i = 0; i < num; ++i)
- {
- try
+ if (1 < argc)
{
- Factory::Instance().Run(test[i]);
+ test = argv;
+ num = argc;
}
- catch(const std::exception& e)
+
+ for (int i = 0; i < num; ++i)
{
- std::clog << e.what() << std::endl;
+ try
+ {
+ Factory::Instance ().Run (test[i]);
+ }
+ catch (const std::exception &e)
+ {
+ std::clog << e.what () << std::endl;
+ }
}
- }
- Factory::Instance().Report ();
- return Factory::Instance().Fail ();
+ Factory::Instance ().Report ();
+ return Factory::Instance ().Fail ();
}
};
std::string failure_;
public:
template <typename Expected, typename Actual>
- failure(const Expected& e, Actual& a, const char* at = "", const char* expr = "")
+ failure (const Expected &e, Actual &a, const char *at = "", const char *expr = "")
{
std::ostringstream os;
os << at << expr << "\nexpected: "
<< "(" << demangle<Expected>() << ") " << e
<< " != actual: " << "(" << demangle<Actual>() << ") " << a;
- failure_ = os.str();
+ failure_ = os.str ();
}
- failure(const char* at = "", const char* expr = "")
+ failure (const char *at = "", const char *expr = "")
{
std::ostringstream os;
os << at << expr;
- failure_ = os.str();
+ failure_ = os.str ();
}
- virtual ~failure() throw() {}
- virtual const char* what() const throw() { return failure_.c_str(); }
+ virtual ~failure () throw () {}
+ virtual const char *what () const throw () { return failure_.c_str (); }
};
template <typename Suite, typename Case>
struct Registrator
{
- Registrator()
+ Registrator ()
{
- Factory::Instance().Register(TestName(), Create);
+ Factory::Instance ().Register (TestName (), Create);
}
- const std::string& TestName()
+ const std::string &TestName ()
{
- static const std::string name(demangle<Suite>() + "::" + demangle<Case>());
+ static const std::string name (demangle<Suite>() + "::" + demangle<Case>());
return name;
}
- static ITest* Create()
+ static ITest *Create ()
{
return new Case;
}
template <typename Case>
struct Registrator<Case, void>
{
- Registrator()
+ Registrator ()
{
- Factory::Instance().Register(TestName(), Create);
+ Factory::Instance ().Register (TestName (), Create);
}
- const std::string& TestName()
+ const std::string &TestName ()
{
static const std::string name ("::" + demangle<Case>());
return name;
}
- static ITest* Create()
+ static ITest *Create ()
{
return new Case;
}
};
-
template <typename Suite, typename Case = void>
struct Test: public ITest, public virtual Suite
{
static Registrator<Suite, Case> s_Registrator;
- Test(): Suite()
+ Test (): Suite ()
{
Registrator<Suite, Case>* r = &s_Registrator;
r = 0;
}
template <typename E, typename T>
- void assert_throw(void(T::*mf)(), const char* at)
+ void assert_throw (void (T::*mf) (), const char *at)
{
try
- {
- (dynamic_cast<T*> (this)->*mf)();
- throw yaffut::failure (at, "statement failed to throw");
- }
- catch(const E&){}
+ {
+ (dynamic_cast<T *> (this)->*mf) ();
+ throw yaffut::failure (at, "statement failed to throw");
+ }
+ catch (const E &) {}
}
};
template <typename Suite, typename Case>
Registrator<Suite, Case> Test<Suite, Case>::s_Registrator;
-
template <typename Case>
struct Test<Case, void>: public ITest
{
static Registrator<Case, void> s_Registrator;
- Test()
+ Test ()
{
Registrator<Case, void>* r = &s_Registrator;
r = 0;
}
template <typename E, typename T>
- void assert_throw(void(T::*mf)(), const char* at)
+ void assert_throw (void (T::*mf) (), const char *at)
{
try
- {
- (dynamic_cast<T*> (this)->*mf)();
- throw yaffut::failure (at, "statement failed to throw");
- }
- catch(const E&){}
+ {
+ (dynamic_cast<T *> (this)->*mf) ();
+ throw yaffut::failure (at, "statement failed to throw");
+ }
+ catch (const E &) {}
}
};
template <typename Case>
Registrator<Case, void> Test<Case, void>::s_Registrator;
-
-
template <typename Expected, typename Actual>
-void equal(const Expected& e, const Actual& a, const char* at = "", const char* expr = "")
+void equal (const Expected &e, const Actual &a, const char *at = "", const char *expr = "")
{
- if(e != a)
- {
- throw failure(e, a, at, expr);
- }
+ if (e != a)
+ {
+ throw failure (e, a, at, expr);
+ }
}
-inline void equal(double e, double a, const char* at = "", const char* expr = "")
+inline void equal (double e, double a, const char *at = "", const char *expr = "")
{
- double max = std::abs(std::max(e, a));
+ double max = std::abs (std::max (e, a));
max = max < 1.0 ? 1.0 : max;
- if(std::abs(e - a) > std::numeric_limits<double>::epsilon() * max)
- {
- throw failure(e, a, at, expr);
- }
+ if (std::abs (e - a) > std::numeric_limits<double>::epsilon () * max)
+ {
+ throw failure (e, a, at, expr);
+ }
}
-inline void check(bool b, const char* at = "", const char* expr = "")
-{
- if(!b)
- {
- throw failure(at, expr);
- }
+inline void check (bool b, const char *at = "", const char *expr = "")
+{
+ if (!b)
+ {
+ throw failure (at, expr);
+ }
}
template <typename Expected, typename Actual>
-void unequal(const Expected& e, const Actual& a, const char* at = "", const char* expr = "")
+void unequal (const Expected &e, const Actual &a, const char *at = "", const char *expr = "")
{
- if(e == a)
- {
- throw failure(e, a, at, expr);
- }
+ if (e == a)
+ {
+ throw failure (e, a, at, expr);
+ }
}
-inline void unequal(double e, double a, const char* at = "", const char* expr = "")
+inline void unequal (double e, double a, const char *at = "", const char *expr = "")
{
- double max = std::abs(std::max(e, a));
+ double max = std::abs (std::max (e, a));
max = max < 1.0 ? 1.0 : max;
- if(std::abs(e - a) <= std::numeric_limits<double>::epsilon() * max)
- {
- throw failure(e, a, at, expr);
- }
+ if (std::abs (e - a) <= std::numeric_limits<double>::epsilon () * max)
+ {
+ throw failure (e, a, at, expr);
+ }
}
template <typename T>
-void fail(const T& expr, const char* at = "")
+void fail (const T &expr, const char *at = "")
{
std::ostringstream os;
os << expr;
- throw failure(at, os.str().c_str());
+ throw failure (at, os.str ().c_str ());
}
template <typename E>
-void assert_throw(void(*pf)(), const char* at = "")
+void assert_throw (void (*pf) (), const char *at = "")
{
try
- {
- (*pf)();
- throw failure (at, " statement failed to throw");
- }
- catch(const E&){}
+ {
+ (*pf) ();
+ throw failure (at, " statement failed to throw");
+ }
+ catch (const E &) {}
}
}
#include <iostream>
-int main(int argc, const char* argv[])
+int main (int argc, const char *argv[])
{
- std::cout << "pid(" << getpid() << ")" << std::endl;
- return yaffut::Factory::Instance().Main (argc, argv);
+ std::cout << "pid(" << getpid () << ")" << std::endl;
+ return yaffut::Factory::Instance ().Main (argc, argv);
};
#endif /* YAFFUT_MAIN */
_f (char const *format, string s, string s2, string s3)
{
return String_convert::form_string (gettext (format), s.c_str (), s2.c_str (),
- s3.c_str ());
+ s3.c_str ());
}
s.intersect (allowed_regions_[i]);
if (!s.is_empty ())
- {
- Interval before = allowed_regions_[i];
- Interval after = allowed_regions_[i];
+ {
+ Interval before = allowed_regions_[i];
+ Interval after = allowed_regions_[i];
- before[RIGHT] = s[LEFT];
- after[LEFT] = s[RIGHT];
+ before[RIGHT] = s[LEFT];
+ after[LEFT] = s[RIGHT];
- if (!before.is_empty () && before.length () > 0.0)
- {
- allowed_regions_.insert (allowed_regions_.begin () + i, before);
- i++;
- }
- allowed_regions_.erase (allowed_regions_.begin () + i);
- if (!after.is_empty () && after.length () > 0.0)
- {
- allowed_regions_.insert (allowed_regions_.begin () + i, after);
- i++;
- }
- }
+ if (!before.is_empty () && before.length () > 0.0)
+ {
+ allowed_regions_.insert (allowed_regions_.begin () + i, before);
+ i++;
+ }
+ allowed_regions_.erase (allowed_regions_.begin () + i);
+ if (!after.is_empty () && after.length () > 0.0)
+ {
+ allowed_regions_.insert (allowed_regions_.begin () + i, after);
+ i++;
+ }
+ }
else
- i++;
+ i++;
}
}
unsigned char *
_memmem (unsigned char const *haystack, int haystack_len,
- unsigned char const *needle, int needle_len)
+ unsigned char const *needle, int needle_len)
{
unsigned char const *end_haystack = haystack + haystack_len - needle_len + 1;
unsigned char const *end_needle = needle + needle_len;
unsigned char const *subneedle = needle;
unsigned char const *subhaystack = haystack;
while (subneedle < end_needle)
- if (*subneedle++ != *subhaystack++)
- goto next;
+ if (*subneedle++ != *subhaystack++)
+ goto next;
/* Completed the needle. Gotcha. */
return (unsigned char *) haystack;
- next:
+next:
haystack++;
}
return 0;
void *
memmem (void const *haystack, int haystack_len,
- void const *needle, int needle_len)
+ void const *needle, int needle_len)
{
unsigned char const *haystack_byte_c = (unsigned char const *)haystack;
unsigned char const *needle_byte_c = (unsigned char const *)needle;
while (q > p)
{
if (*--q == c)
- return (unsigned char *)q;
+ return (unsigned char *)q;
}
return 0;
}
double
my_round (double x)
{
- return floor (x -0.5)+ 1.0;
+ return floor (x - 0.5) + 1.0;
}
/* namespace std { */
-
+
#ifndef isinf
#if !HAVE_ISINF
int
isinf (double x)
{
- return x && (x == x/ 2);
+ return x && (x == x / 2);
}
#endif
#endif
lily_cookie_io_functions_t
Memory_out_stream::functions_
-= {
+=
+{
Memory_out_stream::reader,
Memory_out_stream::writer,
Memory_out_stream::seeker,
ssize_t
Memory_out_stream::writer (void *cookie,
- char const *buffer,
- size_t size)
+ char const *buffer,
+ size_t size)
{
Memory_out_stream *stream = (Memory_out_stream *) cookie;
if (change)
stream->buffer_ = (char *) realloc (stream->buffer_,
- stream->buffer_blocks_ * block_size_);
+ stream->buffer_blocks_ * block_size_);
memcpy (stream->buffer_ + stream->size_, buffer, size);
stream->size_ = newsize;
ssize_t
Memory_out_stream::reader (void * /* cookie */,
- char * /* buffer */,
- size_t /* size */)
+ char * /* buffer */,
+ size_t /* size */)
{
assert (false);
return 0;
int
Memory_out_stream::seeker (void *,
- off64_t *,
- int)
+ off64_t *,
+ int)
{
assert (false);
return 0;
{
string s;
s = string (" (") + ::to_string (coordinate_a_[X_AXIS]) + ", "
- + ::to_string (coordinate_a_[Y_AXIS]) + ")";
+ + ::to_string (coordinate_a_[Y_AXIS]) + ")";
return s;
}
#endif
Offset::length () const
{
return sqrt (sqr (coordinate_a_[X_AXIS])
- + sqr (coordinate_a_[Y_AXIS]));
+ + sqr (coordinate_a_[Y_AXIS]));
}
bool
Offset::is_sane () const
{
return !isnan (coordinate_a_[X_AXIS])
- && !isnan (coordinate_a_ [Y_AXIS])
- && !isinf (coordinate_a_[X_AXIS])
- && !isinf (coordinate_a_[Y_AXIS]);
+ && !isnan (coordinate_a_ [Y_AXIS])
+ && !isinf (coordinate_a_[X_AXIS])
+ && !isinf (coordinate_a_[Y_AXIS]);
}
Offset
Offset::direction () const
{
Offset d = *this;
- d /= length ();
+ d /= length ();
return d;
}
#include <cmath>
-
using namespace std;
/*
{
dest.coefs_.push_back (0);
for (int j = 0; j <= i; j++)
- if (i - j <= p2.degree () && j <= p1.degree ())
- dest.coefs_.back () += p1.coefs_[j] * p2.coefs_[i - j];
+ if (i - j <= p2.degree () && j <= p1.degree ())
+ dest.coefs_.back () += p1.coefs_[j] * p2.coefs_[i - j];
}
return dest;
while (e > 0)
{
if (e % 2)
- {
- dest = multiply (dest, base);
- e--;
- }
+ {
+ dest = multiply (dest, base);
+ e--;
+ }
else
- {
- base = multiply (base, base);
- e /= 2;
- }
+ {
+ base = multiply (base, base);
+ e /= 2;
+ }
}
return dest;
}
We only do relative comparisons. Absolute comparisons break down in
degenerate cases. */
while (degree () > 0
- && (fabs (coefs_.back ()) < FUDGE * fabs (back (coefs_, 1))
- || !coefs_.back ()))
+ && (fabs (coefs_.back ()) < FUDGE * fabs (back (coefs_, 1))
+ || !coefs_.back ()))
coefs_.pop_back ();
}
if (v.lc () < 0.0)
{
for (int k = u.degree () - v.degree () - 1; k >= 0; k -= 2)
- coefs_[k] = -coefs_[k];
+ coefs_[k] = -coefs_[k];
for (int k = u.degree () - v.degree (); k >= 0; k--)
- for (int j = v.degree () + k - 1; j >= k; j--)
- coefs_[j] = -coefs_[j] - coefs_[v.degree () + k] * v.coefs_[j - k];
+ for (int j = v.degree () + k - 1; j >= k; j--)
+ coefs_[j] = -coefs_[j] - coefs_[v.degree () + k] * v.coefs_[j - k];
}
else
{
for (int k = u.degree () - v.degree (); k >= 0; k--)
- for (int j = v.degree () + k - 1; j >= k; j--)
- coefs_[j] -= coefs_[v.degree () + k] * v.coefs_[j - k];
+ for (int j = v.degree () + k - 1; j >= k; j--)
+ coefs_[j] -= coefs_[v.degree () + k] * v.coefs_[j - k];
}
int k = v.degree () - 1;
while (k >= 0 && coefs_[k] == 0.0)
k--;
- coefs_.resize (1+ ((k < 0) ? 0 : k));
+ coefs_.resize (1 + ((k < 0) ? 0 : k));
return degree ();
}
* substitute x = y - A/3 to eliminate quadric term: x^3 +px + q = 0
*/
- Real sq_A = A *A;
+ Real sq_A = A * A;
Real p = 1.0 / 3 * (-1.0 / 3 * sq_A + B);
- Real q = 1.0 / 2 * (2.0 / 27 * A *sq_A - 1.0 / 3 * A *B + C);
+ Real q = 1.0 / 2 * (2.0 / 27 * A * sq_A - 1.0 / 3 * A * B + C);
/* use Cardano's formula */
if (iszero (D))
{
- if (iszero (q)) { /* one triple solution */
- sol.push_back (0);
- sol.push_back (0);
- sol.push_back (0);
- }
- else { /* one single and one double solution */
- Real u = cubic_root (-q);
-
- sol.push_back (2 * u);
- sol.push_back (-u);
- }
+ if (iszero (q)) /* one triple solution */
+ {
+ sol.push_back (0);
+ sol.push_back (0);
+ sol.push_back (0);
+ }
+ else /* one single and one double solution */
+ {
+ Real u = cubic_root (-q);
+
+ sol.push_back (2 * u);
+ sol.push_back (-u);
+ }
}
else if (D < 0)
{
- /* Casus irreducibilis: three real solutions */
+ /* Casus irreducibilis: three real solutions */
Real phi = 1.0 / 3 * acos (-q / sqrt (-cb));
Real t = 2 * sqrt (-p);
int
Polynomial::degree ()const
{
- return coefs_.size () -1;
+ return coefs_.size () - 1;
}
/*
all roots of quadratic eqn.
return 0.0;
}
-
#ifdef STREAM_SUPPORT
ostream &
operator << (ostream &o, Rational r)
Rational
Rational::trunc_rat () const
{
- if (is_infinity())
+ if (is_infinity ())
return *this;
return Rational ((num_ - (num_ % den_)) * sign_, den_);
}
den_ = 1;
}
-
void
Rational::set_infinite (int s)
{
return r;
}
-
/*
copy & paste from scm_gcd (GUILE).
*/
I64 t;
/* Determine a common factor 2^k */
while (!(1 & (u | v)))
- {
- k <<= 1;
- u >>= 1;
- v >>= 1;
- }
+ {
+ k <<= 1;
+ u >>= 1;
+ v >>= 1;
+ }
/* Now, any factor 2^n can be eliminated */
if (u & 1)
- t = -v;
+ t = -v;
else
- {
- t = u;
- b3:
- t = t >> 1;
- }
+ {
+ t = u;
+b3:
+ t = t >> 1;
+ }
if (!(1 & t))
- goto b3;
+ goto b3;
if (t > 0)
- u = t;
+ u = t;
else
- v = -t;
+ v = -t;
t = u - v;
if (t != 0)
- goto b3;
+ goto b3;
result = u * k;
}
return result;
}
-
void
Rational::normalize ()
{
const int FACT = 1 << 20;
/*
- Thanks to Afie for this too simple idea.
+ Thanks to Afie for this too simple idea.
- do not blindly substitute by libg++ code, since that uses
- arbitrary-size integers. The rationals would overflow too
- easily.
+ do not blindly substitute by libg++ code, since that uses
+ arbitrary-size integers. The rationals would overflow too
+ easily.
*/
num_ = (U64) (mantissa * FACT);
den_ = (U64) FACT;
normalize ();
if (expt < 0)
- den_ <<= -expt;
+ den_ <<= -expt;
else
- num_ <<= expt;
+ num_ <<= expt;
normalize ();
}
else
den_ *= r.den_;
normalize ();
- exit_func:
+exit_func:
return *this;
}
int
Rational::to_int () const
{
- return (int)(num () / den ());
+ return (int) (num () / den ());
}
int
ssize len = find.length ();
ssize replen = replace.length ();
for (ssize i = str->find (find); i != NPOS; i = str->find (find, i + replen))
- *str = str->replace (i, len, replace);
+ * str = str->replace (i, len, replace);
return *str;
}
char *dest = new char[len + 1];
copy (s.begin (), s.end (), dest);
dest[len] = 0;
-
+
return dest;
}
{
string s = str.substr (0, i);
a.push_back (s);
- i ++;
+ i++;
str = str.substr (i);
i = str.find (c);
}
string_join (vector<string> const &strs, string infix)
{
string result;
- for (vsize i = 0; i < strs.size (); i ++)
+ for (vsize i = 0; i < strs.size (); i++)
{
if (i)
- result += infix;
+ result += infix;
result += strs[i];
}
String_convert::bin2hex (Byte bin_char)
{
string str;
- str += to_string ((char) nibble2hex_byte ((Byte)(bin_char >> 4)));
+ str += to_string ((char) nibble2hex_byte ((Byte) (bin_char >> 4)));
str += to_string ((char) nibble2hex_byte (bin_char++));
return str;
}
String_convert::bin2hex (string bin_string)
{
string str;
- Byte const *byte = (Byte const*)bin_string.data ();
+ Byte const *byte = (Byte const *)bin_string.data ();
for (ssize i = 0; i < bin_string.length (); i++)
{
- str += to_string ((char)nibble2hex_byte ((Byte)(*byte >> 4)));
+ str += to_string ((char)nibble2hex_byte ((Byte) (*byte >> 4)));
str += to_string ((char)nibble2hex_byte (*byte++));
}
return str;
assert (false);
assert (form_string ("%ld", l) == dec_string);
-
+
return (int)l;
}
{
char buffer[STRING_BUFFER_LEN];
snprintf (buffer, STRING_BUFFER_LEN,
- (fmt ? fmt : "%Ld"), i64); // assume radix 10
+ (fmt ? fmt : "%Ld"), i64); // assume radix 10
return string (buffer);
}
// breendet imp from string
{
if (!dec_string.length ())
return 0;
-
+
double d = 0.0;
if (!sscanf (dec_string.c_str (), "%lf", &d))
assert (false);
-
+
return d;
}
hex_string = "0" + hex_string;
bin_string_r = "";
- Byte const *byte = (Byte const*) hex_string.data ();
+ Byte const *byte = (Byte const *) hex_string.data ();
ssize i = 0;
while (i < hex_string.length ())
{
int high_i = hex2nibble (*byte++);
int low_i = hex2nibble (*byte++);
if (high_i < 0 || low_i < 0)
- return 1; // invalid char
+ return 1; // invalid char
bin_string_r += to_string ((char) (high_i << 4 | low_i), 1);
i += 2;
}
if (hex2bin (hex_string, str))
assert (false);
-
+
return str;
}
u /= 16;
}
#else
- str += int_string (u, "%x"); // hmm. %lx vs. %x -> portability?
+ str += int_string (u, "%x"); // hmm. %lx vs. %x -> portability?
#endif
str = to_string (fill_char, length - str.length ()) + str;
String_convert::nibble2hex_byte (Byte byte)
{
if ((byte & 0x0f) <= 9)
- return (Byte)((byte & 0x0f) + '0');
+ return (Byte) ((byte & 0x0f) + '0');
else
- return (Byte)((byte & 0x0f) - 10 + 'a');
+ return (Byte) ((byte & 0x0f) - 10 + 'a');
}
/**
Convert an integer to a string
{
char buffer[STRING_BUFFER_LEN];
snprintf (buffer, STRING_BUFFER_LEN,
- (fmt ? fmt : "%d"), i); // assume radix 10
+ (fmt ? fmt : "%d"), i); // assume radix 10
return string (buffer);
}
char *ch = new char[ n ];
memset (ch, c, n);
string s (ch, n);
-
+
delete[] ch;
return s;
}
return (sign (x) > 0 ? str : "-" + str);
}
-
string
String_convert::long_string (long l)
{
string
String_convert::pad_to (string s, int n)
{
- return s + string (max (int(n - s.length ()), 0), ' ');
+ return s + string (max (int (n - s.length ()), 0), ' ');
}
string
string
String_convert::reverse (string s)
{
- return (char*) memrev ((unsigned char *)s.data (), s.length ());
+ return (char *) memrev ((unsigned char *)s.data (), s.length ());
}
struct CaseB: public yaffut::Test<File_name, CaseB>
{
- CaseB(): File_name("123"){}
+ CaseB (): File_name ("123") {}
};
TEST_STRING (File_name, Mingw_slashify, "foe.ly")
EQUAL (vector<int> (v.begin (), v.begin ()).size (), vsize (0));
EQUAL (vector<int> (v.begin (), v.end ()).size (), v.size ());
EQUAL (vector<int> (v.begin () + 1, v.begin () + 2).size (),
- vsize (1));
+ vsize (1));
#endif
}
v.insert (1, 0);
#else
v.insert (v.begin (), 1);
-#endif
+#endif
EQUAL (v[0], 1);
#if VECTOR_INSERT
v.insert (2, v.size ());
#else
v.insert (v.end (), 2);
-#endif
+#endif
EQUAL (v.back (), 2);
vector<int> u;
u.insert (u.begin (), v.begin (), v.end ());
#if !STD_VECTOR
Link_array<int> u, v;
#else
- vector<int*> u, v;
-#endif
+ vector<int *> u, v;
+#endif
int a[5] = { 0, 1, 2, 3, 4 };
u.push_back (&a[0]);
u.push_back (&a[1]);
using namespace std;
-
FUNC (string_split_join)
{
string orig = "a/bbbb/cc//d";
vector<string> splits = string_split (orig, '/');
string loop = string_join (splits, "/");
- EQUAL(orig, loop);
- EQUAL(splits.size (), size_t (5));
+ EQUAL (orig, loop);
+ EQUAL (splits.size (), size_t (5));
}
\version "2.15.3"
-\layout { ragged-right = ##t }
-
-music = {
- \clef bass r2 r4 r8 f,
- r2 r4 g,8 r
- r4 f, 8 r8 r2
-}
-
-beams = {
- \repeat "unfold" 24 { s8[ s ] s[ s]}
-}
-
-\new Staff {
- \context Voice << { \beams } { \music}>>
-}
+\new Voice << { c'4 c'8 c' } { s8[ s] s[ s] } >>
-\version "2.15.0"
+\version "2.15.7"
\header {
- texidoc = "Lilypond does footnotes."
+ texidoc = "This is an example of automatic footnote numbering
+where the number is reset on each page. It uses the symbol-footnotes
+numbering function, which assigns the symbols *, †, ‡, § and ¶ to
+successive footnotes, doubling up on the symbol after five footnotes
+have been reached.
+"
}
\paper {
-\version "2.15.0"
+\version "2.15.7"
\header {
- texidoc = "Lilypond does footnotes."
+ texidoc = "This is an example of automatic footnote numbering
+where the number is not reset on each page. It uses the default
+numbering function, which assigns numbers starting at 1 to successive
+footnotes.
+"
}
\paper {
} \addlyrics {
bla16 -- bla -- bla -- bla --
bla -- bla -- bla -- bla8 --
- bla16 -- bla -- bla
+ bla16 -- bla -- bla
}
>>
-
+
+++ /dev/null
-\version "2.14.0"
-
-\header {
- texidoc = "
-If a nested property revert follows an override in the same grob for
-a different property, the nested property's default setting should not
-be evicted from the property alist.
-"
-}
-
-\relative c' {
- c1\startTrillSpan
- c1\stopTrillSpan
- \override TrillSpanner #'color = #red
- \revert TrillSpanner #'(bound-details left text)
- c1\startTrillSpan
- c1\stopTrillSpan
-}
public:
SCM last_keysig_;
- vector<Grob*> left_objects_;
- vector<Grob*> right_objects_;
+ vector<Grob *> left_objects_;
+ vector<Grob *> right_objects_;
Grob *accidental_placement_;
vector<Accidental_entry> accidentals_;
- vector<Spanner*> ties_;
- vector<Grob*> note_columns_;
+ vector<Spanner *> ties_;
+ vector<Grob *> note_columns_;
};
/*
in grobs should always store ly_deep_copy ()s of those.
*/
-
Accidental_engraver::Accidental_engraver ()
{
accidental_placement_ = 0;
{
last_keysig_ = new_sig;
set_context_property_on_children (context (),
- ly_symbol2scm ("localKeySignature"),
- new_sig);
+ ly_symbol2scm ("localKeySignature"),
+ new_sig);
Context *trans = context ()->get_parent_context ();
int score () const
{
return need_acc ? 1 : 0
- + need_restore ? 1 : 0;
+ + need_restore ? 1 : 0;
}
};
static
Accidental_result
check_pitch_against_rules (Pitch const &pitch, Context *origin,
- SCM rules, int bar_number, SCM measurepos)
+ SCM rules, int bar_number, SCM measurepos)
{
Accidental_result result;
SCM pitch_scm = pitch.smobbed_copy ();
if (scm_is_pair (rules) && !scm_is_symbol (scm_car (rules)))
warning (_f ("accidental typesetting list must begin with context-name: %s",
- ly_scm2string (scm_car (rules)).c_str ()));
+ ly_scm2string (scm_car (rules)).c_str ()));
for (; scm_is_pair (rules) && origin; rules = scm_cdr (rules))
{
SCM rule = scm_car (rules);
if (ly_is_procedure (rule))
- {
- SCM rule_result_scm = scm_call_4 (rule, origin->self_scm (),
- pitch_scm, barnum_scm, measurepos);
- Accidental_result rule_result (rule_result_scm);
+ {
+ SCM rule_result_scm = scm_call_4 (rule, origin->self_scm (),
+ pitch_scm, barnum_scm, measurepos);
+ Accidental_result rule_result (rule_result_scm);
- result.need_acc |= rule_result.need_acc;
- result.need_restore |= rule_result.need_restore;
- }
+ result.need_acc |= rule_result.need_acc;
+ result.need_restore |= rule_result.need_restore;
+ }
/*
- If symbol then it is a context name. Scan parent contexts to
- find it.
+ If symbol then it is a context name. Scan parent contexts to
+ find it.
*/
else if (scm_is_symbol (rule))
- {
- Context *dad = origin;
- while (dad && !dad->is_alias (rule))
- dad = dad->get_parent_context ();
-
- if (dad)
- origin = dad;
- }
+ {
+ Context *dad = origin;
+ while (dad && !dad->is_alias (rule))
+ dad = dad->get_parent_context ();
+
+ if (dad)
+ origin = dad;
+ }
else
- warning (_f ("procedure or context-name expected for accidental rule, found %s",
- print_scm_val (rule).c_str ()));
+ warning (_f ("procedure or context-name expected for accidental rule, found %s",
+ print_scm_val (rule).c_str ()));
}
return result;
SCM accidental_rules = get_property ("autoAccidentals");
SCM cautionary_rules = get_property ("autoCautionaries");
SCM measure_position = get_property ("measurePosition");
- int barnum = measure_number (context());
+ int barnum = measure_number (context ());
for (vsize i = 0; i < accidentals_.size (); i++)
- {
- if (accidentals_[i].done_)
- continue;
- accidentals_[i].done_ = true;
-
- Stream_event *note = accidentals_[i].melodic_;
- Context *origin = accidentals_[i].origin_;
-
- Pitch *pitch = unsmob_pitch (note->get_property ("pitch"));
- if (!pitch)
- continue;
-
- Accidental_result acc = check_pitch_against_rules (*pitch, origin, accidental_rules,
- barnum, measure_position);
- Accidental_result caut = check_pitch_against_rules (*pitch, origin, cautionary_rules,
- barnum, measure_position);
-
- bool cautionary = to_boolean (note->get_property ("cautionary"));
- if (caut.score () > acc.score ())
- {
- acc.need_acc |= caut.need_acc;
- acc.need_restore |= caut.need_restore;
-
- cautionary = true;
- }
-
- bool forced = to_boolean (note->get_property ("force-accidental"));
- if (!acc.need_acc && forced)
- acc.need_acc = true;
-
- /*
- Cannot look for ties: it's not guaranteed that they reach
- us before the notes.
- */
- if (!note->in_event_class ("trill-span-event"))
- {
- if (acc.need_acc)
- create_accidental (&accidentals_[i], acc.need_restore, cautionary);
-
- if (forced || cautionary)
- accidentals_[i].accidental_->set_property ("forced", SCM_BOOL_T);
- }
- }
+ {
+ if (accidentals_[i].done_)
+ continue;
+ accidentals_[i].done_ = true;
+
+ Stream_event *note = accidentals_[i].melodic_;
+ Context *origin = accidentals_[i].origin_;
+
+ Pitch *pitch = unsmob_pitch (note->get_property ("pitch"));
+ if (!pitch)
+ continue;
+
+ Accidental_result acc = check_pitch_against_rules (*pitch, origin, accidental_rules,
+ barnum, measure_position);
+ Accidental_result caut = check_pitch_against_rules (*pitch, origin, cautionary_rules,
+ barnum, measure_position);
+
+ bool cautionary = to_boolean (note->get_property ("cautionary"));
+ if (caut.score () > acc.score ())
+ {
+ acc.need_acc |= caut.need_acc;
+ acc.need_restore |= caut.need_restore;
+
+ cautionary = true;
+ }
+
+ bool forced = to_boolean (note->get_property ("force-accidental"));
+ if (!acc.need_acc && forced)
+ acc.need_acc = true;
+
+ /*
+ Cannot look for ties: it's not guaranteed that they reach
+ us before the notes.
+ */
+ if (!note->in_event_class ("trill-span-event"))
+ {
+ if (acc.need_acc)
+ create_accidental (&accidentals_[i], acc.need_restore, cautionary);
+
+ if (forced || cautionary)
+ accidentals_[i].accidental_->set_property ("forced", SCM_BOOL_T);
+ }
+ }
}
}
void
Accidental_engraver::create_accidental (Accidental_entry *entry,
- bool restore_natural,
- bool cautionary)
+ bool restore_natural,
+ bool cautionary)
{
Stream_event *note = entry->melodic_;
Grob *support = entry->head_;
if (restore_natural)
{
if (to_boolean (get_property ("extraNatural")))
- a->set_property ("restore-first", SCM_BOOL_T);
+ a->set_property ("restore-first", SCM_BOOL_T);
}
entry->accidental_ = a;
Grob *
Accidental_engraver::make_standard_accidental (Stream_event * /* note */,
- Grob *note_head,
- Engraver *trans,
- bool cautionary)
+ Grob *note_head,
+ Engraver *trans,
+ bool cautionary)
{
/*
We construct the accidentals at the originating Voice
for (vsize i = 0; i < left_objects_.size (); i++)
{
if (left_objects_[i]->get_property ("side-axis") == scm_from_int (X_AXIS))
- Side_position_interface::add_support (left_objects_[i], a);
+ Side_position_interface::add_support (left_objects_[i], a);
}
for (vsize i = 0; i < right_objects_.size (); i++)
if (!accidental_placement_)
accidental_placement_ = make_item ("AccidentalPlacement",
- a->self_scm ());
+ a->self_scm ());
Accidental_placement::add_accidental (accidental_placement_, a);
note_head->set_object ("accidental-grob", a->self_scm ());
Grob *
Accidental_engraver::make_suggested_accidental (Stream_event * /* note */,
- Grob *note_head,
- Engraver *trans)
+ Grob *note_head,
+ Engraver *trans)
{
Grob *a = trans->make_item ("AccidentalSuggestion", note_head->self_scm ());
{
Grob *r = Tie::head (ties_[j], RIGHT);
for (vsize i = accidentals_.size (); i--;)
- if (accidentals_[i].head_ == r)
- {
- if (Grob *g = accidentals_[i].accidental_)
- {
- g->set_object ("tie", ties_[j]->self_scm ());
- accidentals_[i].tied_ = true;
- }
- ties_.erase (ties_.begin () + j);
- break;
- }
+ if (accidentals_[i].head_ == r)
+ {
+ if (Grob *g = accidentals_[i].accidental_)
+ {
+ g->set_object ("tie", ties_[j]->self_scm ());
+ accidentals_[i].tied_ = true;
+ }
+ ties_.erase (ties_.begin () + j);
+ break;
+ }
}
for (vsize i = accidentals_.size (); i--;)
Pitch *pitch = unsmob_pitch (note->get_property ("pitch"));
if (!pitch)
- continue;
+ continue;
int n = pitch->get_notename ();
int o = pitch->get_octave ();
SCM key = scm_cons (scm_from_int (o), scm_from_int (n));
Moment end_mp = measure_position (context (),
- unsmob_duration (note->get_property ("duration")));
+ unsmob_duration (note->get_property ("duration")));
SCM position = scm_cons (scm_from_int (barnum), end_mp.smobbed_copy ());
SCM localsig = SCM_EOL;
while (origin
- && origin->where_defined (ly_symbol2scm ("localKeySignature"), &localsig))
- {
- bool change = false;
- if (accidentals_[i].tied_
- && !(to_boolean (accidentals_[i].accidental_->get_property ("forced"))))
- {
- /*
- Remember an alteration that is different both from
- that of the tied note and of the key signature.
- */
- localsig = ly_assoc_prepend_x (localsig, key,scm_cons (ly_symbol2scm ("tied"),
- position));
- change = true;
- }
- else
- {
- /*
- not really correct if there is more than one
- note head with the same notename.
- */
- localsig = ly_assoc_prepend_x (localsig, key,
- scm_cons (ly_rational2scm (a),
- position));
- change = true;
- }
-
- if (change)
- origin->set_property ("localKeySignature", localsig);
-
- origin = origin->get_parent_context ();
- }
+ && origin->where_defined (ly_symbol2scm ("localKeySignature"), &localsig))
+ {
+ bool change = false;
+ if (accidentals_[i].tied_
+ && !(to_boolean (accidentals_[i].accidental_->get_property ("forced"))))
+ {
+ /*
+ Remember an alteration that is different both from
+ that of the tied note and of the key signature.
+ */
+ localsig = ly_assoc_prepend_x (localsig, key, scm_cons (ly_symbol2scm ("tied"),
+ position));
+ change = true;
+ }
+ else
+ {
+ /*
+ not really correct if there is more than one
+ note head with the same notename.
+ */
+ localsig = ly_assoc_prepend_x (localsig, key,
+ scm_cons (ly_rational2scm (a),
+ position));
+ change = true;
+ }
+
+ if (change)
+ origin->set_property ("localKeySignature", localsig);
+
+ origin = origin->get_parent_context ();
+ }
}
if (accidental_placement_)
Stream_event *note = info.event_cause ();
if (note
&& (note->in_event_class ("note-event")
- || note->in_event_class ("trill-span-event")))
+ || note->in_event_class ("trill-span-event")))
{
/*
- string harmonics usually don't have accidentals.
+ string harmonics usually don't have accidentals.
*/
if (info.grob ()->get_property ("style") != ly_symbol2scm ("harmonic")
- || to_boolean (get_property ("harmonicAccidentals")))
- {
- Accidental_entry entry;
- entry.head_ = info.grob ();
- entry.origin_engraver_ = dynamic_cast<Engraver *> (info.origin_translator ());
- entry.origin_ = entry.origin_engraver_->context ();
- entry.melodic_ = note;
-
- accidentals_.push_back (entry);
- }
+ || to_boolean (get_property ("harmonicAccidentals")))
+ {
+ Accidental_entry entry;
+ entry.head_ = info.grob ();
+ entry.origin_engraver_ = dynamic_cast<Engraver *> (info.origin_translator ());
+ entry.origin_ = entry.origin_engraver_->context ();
+ entry.melodic_ = note;
+
+ accidentals_.push_back (entry);
+ }
}
}
ADD_ACKNOWLEDGER (Accidental_engraver, note_column);
ADD_TRANSLATOR (Accidental_engraver,
- /* doc */
- "Make accidentals."
- " Catch note heads, ties and notices key-change events."
- " This engraver usually lives at Staff level, but"
- " reads the settings for Accidental at @code{Voice} level,"
- " so you can @code{\\override} them at @code{Voice}.",
-
- /* create */
- "Accidental "
- "AccidentalCautionary "
- "AccidentalPlacement "
- "AccidentalSuggestion ",
-
- /* read */
- "autoAccidentals "
- "autoCautionaries "
- "internalBarNumber "
- "extraNatural "
- "harmonicAccidentals "
- "keySignature "
- "localKeySignature ",
-
- /* write */
- "localKeySignature "
- );
+ /* doc */
+ "Make accidentals."
+ " Catch note heads, ties and notices key-change events."
+ " This engraver usually lives at Staff level, but"
+ " reads the settings for Accidental at @code{Voice} level,"
+ " so you can @code{\\override} them at @code{Voice}.",
+
+ /* create */
+ "Accidental "
+ "AccidentalCautionary "
+ "AccidentalPlacement "
+ "AccidentalSuggestion ",
+
+ /* read */
+ "autoAccidentals "
+ "autoCautionaries "
+ "internalBarNumber "
+ "extraNatural "
+ "harmonicAccidentals "
+ "keySignature "
+ "localKeySignature ",
+
+ /* write */
+ "localKeySignature "
+ );
*/
void
Accidental_placement::split_accidentals (Grob *accs,
- vector<Grob *> *break_reminder,
- vector<Grob *> *real_acc)
+ vector<Grob *> *break_reminder,
+ vector<Grob *> *real_acc)
{
for (SCM acs = accs->get_object ("accidental-grobs"); scm_is_pair (acs);
acs = scm_cdr (acs))
for (SCM s = scm_cdar (acs); scm_is_pair (s); s = scm_cdr (s))
{
- Grob *a = unsmob_grob (scm_car (s));
+ Grob *a = unsmob_grob (scm_car (s));
- if (unsmob_grob (a->get_object ("tie"))
- && !to_boolean (a->get_property ("forced")))
- break_reminder->push_back (a);
- else
- real_acc->push_back (a);
+ if (unsmob_grob (a->get_object ("tie"))
+ && !to_boolean (a->get_property ("forced")))
+ break_reminder->push_back (a);
+ else
+ real_acc->push_back (a);
}
}
ret.insert (ret.end (), ra.begin (), ra.end ());
if (right)
- ret.insert (ret.end (), br.begin (), br.end ());
+ ret.insert (ret.end (), br.begin (), br.end ());
}
return ret;
}
}
bool ape_less (Accidental_placement_entry *const &a,
- Accidental_placement_entry *const &b)
+ Accidental_placement_entry *const &b)
{
return ape_priority (a) < ape_priority (b);
}
{
Accidental_placement_entry *a = 0;
if (parity)
- {
- a = asc.back ();
- asc.pop_back ();
- }
+ {
+ a = asc.back ();
+ asc.pop_back ();
+ }
else
- a = asc[i++];
+ a = asc[i++];
apes->push_back (a);
parity = !parity;
Accidental_placement_entry *ape = new Accidental_placement_entry;
for (SCM t = scm_cdar (s); scm_is_pair (t); t = scm_cdr (t))
- ape->grobs_.push_back (unsmob_grob (scm_car (t)));
+ ape->grobs_.push_back (unsmob_grob (scm_car (t)));
apes.push_back (ape);
}
static void
set_ape_skylines (Accidental_placement_entry *ape,
- Grob **common, Real padding)
+ Grob **common, Real padding)
{
vector<Grob *> accs (ape->grobs_);
vector_sort (accs, &acc_less);
Pitch *p = accidental_pitch (a);
if (!p)
- continue;
+ continue;
if (i == accs.size () - 1 || p->get_octave () != last_octave)
- {
- last_offset = 0;
- offset = a->extent (a, X_AXIS)[LEFT] - padding;
- }
+ {
+ last_offset = 0;
+ offset = a->extent (a, X_AXIS)[LEFT] - padding;
+ }
else if (p->get_alteration () == last_alteration)
- a->translate_axis (last_offset, X_AXIS);
+ a->translate_axis (last_offset, X_AXIS);
else /* Our alteration is different from the last one */
- {
- Real this_offset = offset - a->extent (a, X_AXIS)[RIGHT];
- a->translate_axis (this_offset, X_AXIS);
+ {
+ Real this_offset = offset - a->extent (a, X_AXIS)[RIGHT];
+ a->translate_axis (this_offset, X_AXIS);
- last_offset = this_offset;
- offset -= a->extent (a, X_AXIS).length () + padding;
- }
+ last_offset = this_offset;
+ offset -= a->extent (a, X_AXIS).length () + padding;
+ }
vector<Box> boxes = Accidental_interface::accurate_boxes (a, common);
ape->extents_.insert (ape->extents_.end (), boxes.begin (), boxes.end ());
for (vsize j = boxes.size (); j--;)
- ape->vertical_extent_.unite (boxes[j][Y_AXIS]);
+ ape->vertical_extent_.unite (boxes[j][Y_AXIS]);
last_octave = p->get_octave ();
last_alteration = p->get_alteration ();
{
Accidental_placement_entry *ape = apes[i];
for (vsize j = ape->grobs_.size (); j--;)
- {
- Grob *acc = ape->grobs_[j];
- Grob *head = acc->get_parent (Y_AXIS);
- Grob *col = head->get_parent (X_AXIS);
-
- if (Note_column::has_interface (col))
- note_cols.push_back (col);
- else
- ret.push_back (head);
- }
+ {
+ Grob *acc = ape->grobs_[j];
+ Grob *head = acc->get_parent (Y_AXIS);
+ Grob *col = head->get_parent (X_AXIS);
+
+ if (Note_column::has_interface (col))
+ note_cols.push_back (col);
+ else
+ ret.push_back (head);
+ }
}
/*
{
Grob *c = note_cols[i]->get_parent (X_AXIS);
if (Note_collision_interface::has_interface (c))
- {
- extract_grob_set (c, "elements", columns);
- concat (note_cols, columns);
- }
+ {
+ extract_grob_set (c, "elements", columns);
+ concat (note_cols, columns);
+ }
}
/* Now that we have all of the columns, grab all of the note-heads */
for (vsize i = apes.size (); i--;)
for (vsize j = apes[i]->grobs_.size (); j--;)
{
- if (!ret)
- ret = apes[i]->grobs_[j];
- else
- ret = ret->common_refpoint (apes[i]->grobs_[j], a);
+ if (!ret)
+ ret = apes[i]->grobs_[j];
+ else
+ ret = ret->common_refpoint (apes[i]->grobs_[j], a);
}
return ret;
static Skyline
build_heads_skyline (vector<Grob *> const &heads_and_stems,
- Grob **common)
+ Grob **common)
{
vector<Box> head_extents;
for (vsize i = heads_and_stems.size (); i--;)
head_extents.push_back (Box (heads_and_stems[i]->extent (common[X_AXIS], X_AXIS),
- heads_and_stems[i]->pure_height (common[Y_AXIS], 0, INT_MAX)));
+ heads_and_stems[i]->pure_height (common[Y_AXIS], 0, INT_MAX)));
return Skyline (head_extents, 0, Y_AXIS, LEFT);
}
*/
static Interval
position_apes (Grob *me,
- vector<Accidental_placement_entry *> const &apes,
- Skyline const &heads_skyline)
+ vector<Accidental_placement_entry *> const &apes,
+ Skyline const &heads_skyline)
{
Real padding = robust_scm2double (me->get_property ("padding"), 0.2);
Skyline left_skyline = heads_skyline;
Real offset = -ape->right_skyline_.distance (left_skyline);
if (isinf (offset))
- offset = last_offset;
+ offset = last_offset;
else
- offset -= padding;
+ offset -= padding;
Skyline new_left_skyline = ape->left_skyline_;
new_left_skyline.raise (offset);
/* Shift all of the accidentals in this ape */
for (vsize j = ape->grobs_.size (); j--;)
- ape->grobs_[j]->translate_axis (offset, X_AXIS);
+ ape->grobs_[j]->translate_axis (offset, X_AXIS);
for (vsize j = ape->extents_.size (); j--;)
- width.unite (offset + ape->extents_[j][X_AXIS]);
+ width.unite (offset + ape->extents_[j][X_AXIS]);
last_offset = offset;
}
* |_| |
* | |
*
-
*/
MAKE_SCHEME_CALLBACK (Accidental_placement, calc_positioning_done, 1);
}
ADD_INTERFACE (Accidental_placement,
- "Resolve accidental collisions.",
-
- /* properties */
- "accidental-grobs "
- "direction "
- "padding "
- "positioning-done "
- "right-padding "
- "script-priority "
- );
+ "Resolve accidental collisions.",
+
+ /* properties */
+ "accidental-grobs "
+ "direction "
+ "padding "
+ "positioning-done "
+ "right-padding "
+ "script-priority "
+ );
Stencil
parenthesize (Grob *me, Stencil m)
{
- Font_metric * font
- = Font_interface::get_default_font (me);
+ Font_metric *font
+ = Font_interface::get_default_font (me);
Stencil open
= font->find_by_name ("accidentals.leftparen");
Stencil close
SCM
Accidental_interface::pure_height (SCM smob, SCM start_scm, SCM)
{
- Item *me = dynamic_cast<Item*> (unsmob_grob (smob));
+ Item *me = dynamic_cast<Item *> (unsmob_grob (smob));
int start = scm_to_int (start_scm);
int rank = me->get_column ()->get_rank ();
if (to_boolean (me->get_property ("forced"))
|| !unsmob_grob (me->get_object ("tie"))
|| (rank == start + 1 && /* we are at the start of a line */
- !to_boolean (me->get_property ("hide-tied-accidental-after-break"))))
+ !to_boolean (me->get_property ("hide-tied-accidental-after-break"))))
{
Stencil *s = unsmob_stencil (get_stencil (me));
if (s)
- return ly_interval2scm (s->extent (Y_AXIS));
+ return ly_interval2scm (s->extent (Y_AXIS));
}
return ly_interval2scm (Interval ());
SCM alist = me->get_property ("glyph-name-alist");
SCM alt = me->get_property ("alteration");
string glyph_name = robust_scm2string (ly_assoc_get (alt, alist, SCM_BOOL_F),
- "");
-
+ "");
+
if (glyph_name == "accidentals.flat"
- || glyph_name == "accidentals.mirroredflat")
- {
- Box stem = b;
- Box bulb = b;
-
- /*
- we could make the stem thinner, but that places the flats
- really close.
- */
- Direction bulb_dir =
- glyph_name == "accidentals.mirroredflat" ? LEFT : RIGHT;
- stem[X_AXIS][bulb_dir] = stem[X_AXIS].center ();
-
- /*
- To prevent vertical alignment for 6ths
- */
- stem[Y_AXIS] *= 1.1;
- bulb[Y_AXIS][UP] *= .35;
-
- boxes.push_back (bulb);
- boxes.push_back (stem);
- }
- else if (glyph_name == "accidentals.natural")
- {
- Box lstem = b;
- Box rstem = b;
- Box belly = b;
-
- lstem[Y_AXIS] *= 1.1;
- rstem[Y_AXIS] *= 1.1;
-
- belly[Y_AXIS] *= 0.75;
- lstem[X_AXIS][RIGHT] *= .33;
- rstem[X_AXIS][LEFT] = rstem[X_AXIS].linear_combination (1.0 / 3.0);
- lstem[Y_AXIS][DOWN] = belly[Y_AXIS][DOWN];
- rstem[Y_AXIS][UP] = belly[Y_AXIS][UP];
- boxes.push_back (belly);
- boxes.push_back (lstem);
- boxes.push_back (rstem);
- }
+ || glyph_name == "accidentals.mirroredflat")
+ {
+ Box stem = b;
+ Box bulb = b;
+
+ /*
+ we could make the stem thinner, but that places the flats
+ really close.
+ */
+ Direction bulb_dir
+ = glyph_name == "accidentals.mirroredflat" ? LEFT : RIGHT;
+ stem[X_AXIS][bulb_dir] = stem[X_AXIS].center ();
+
+ /*
+ To prevent vertical alignment for 6ths
+ */
+ stem[Y_AXIS] *= 1.1;
+ bulb[Y_AXIS][UP] *= .35;
+
+ boxes.push_back (bulb);
+ boxes.push_back (stem);
+ }
+ else if (glyph_name == "accidentals.natural")
+ {
+ Box lstem = b;
+ Box rstem = b;
+ Box belly = b;
+
+ lstem[Y_AXIS] *= 1.1;
+ rstem[Y_AXIS] *= 1.1;
+
+ belly[Y_AXIS] *= 0.75;
+ lstem[X_AXIS][RIGHT] *= .33;
+ rstem[X_AXIS][LEFT] = rstem[X_AXIS].linear_combination (1.0 / 3.0);
+ lstem[Y_AXIS][DOWN] = belly[Y_AXIS][DOWN];
+ rstem[Y_AXIS][UP] = belly[Y_AXIS][UP];
+ boxes.push_back (belly);
+ boxes.push_back (lstem);
+ boxes.push_back (rstem);
+ }
/*
- TODO: add support for, double flat.
+ TODO: add support for, double flat.
*/
}
boxes.push_back (b);
Offset o (me->relative_coordinate (common[X_AXIS], X_AXIS),
- me->relative_coordinate (common[Y_AXIS], Y_AXIS));
+ me->relative_coordinate (common[Y_AXIS], Y_AXIS));
for (vsize i = boxes.size (); i--;)
boxes[i].translate (o);
Grob *me = unsmob_grob (smob);
Grob *tie = unsmob_grob (me->get_object ("tie"));
- if (tie &&
- (to_boolean (me->get_property ("hide-tied-accidental-after-break"))
- || (!tie->original () && !to_boolean (me->get_property ("forced")))))
+ if (tie
+ && (to_boolean (me->get_property ("hide-tied-accidental-after-break"))
+ || (!tie->original () && !to_boolean (me->get_property ("forced")))))
{
me->suicide ();
return SCM_EOL;
SCM alist = me->get_property ("glyph-name-alist");
SCM alt = me->get_property ("alteration");
SCM glyph_name = ly_assoc_get (alt, alist, SCM_BOOL_F);
-
+
if (!scm_is_string (glyph_name))
{
me->warning (_f ("Could not find glyph-name for alteration %s",
- ly_scm_write_string (alt).c_str ()));
+ ly_scm_write_string (alt).c_str ()));
return SCM_EOL;
}
-
+
Stencil mol (fm->find_by_name (ly_scm2string (glyph_name)));
if (to_boolean (me->get_property ("restore-first")))
{
/*
- this isn't correct for ancient accidentals, but they don't
- use double flats/sharps anyway.
- */
+ this isn't correct for ancient accidentals, but they don't
+ use double flats/sharps anyway.
+ */
Stencil acc (fm->find_by_name ("accidentals.natural"));
if (acc.is_empty ())
- me->warning (_ ("natural alteration glyph not found"));
+ me->warning (_ ("natural alteration glyph not found"));
else
- mol.add_at_edge (X_AXIS, LEFT, acc, 0.1);
+ mol.add_at_edge (X_AXIS, LEFT, acc, 0.1);
}
-
+
if (to_boolean (me->get_property ("parenthesized")))
mol = parenthesize (me, mol);
return mol.smobbed_copy ();
}
-
ADD_INTERFACE (Accidental_interface,
- "A single accidental.",
-
- /* properties */
- "alteration "
- "avoid-slur "
- "forced "
- "glyph-name-alist "
- "hide-tied-accidental-after-break "
- "parenthesized "
- "restore-first "
- "tie "
- );
+ "A single accidental.",
+
+ /* properties */
+ "alteration "
+ "avoid-slur "
+ "forced "
+ "glyph-name-alist "
+ "hide-tied-accidental-after-break "
+ "parenthesized "
+ "restore-first "
+ "tie "
+ );
#include "system.hh"
#include "warn.hh"
-
MAKE_SCHEME_CALLBACK (Align_interface, align_to_minimum_distances, 1);
SCM
Align_interface::align_to_minimum_distances (SCM smob)
// code. Split them into 2 functions, perhaps?
static void
get_skylines (Grob *me,
- vector<Grob*> *const elements,
- Axis a,
- bool pure, int start, int end,
- vector<Skyline_pair> *const ret)
+ vector<Grob *> *const elements,
+ Axis a,
+ bool pure, int start, int end,
+ vector<Skyline_pair> *const ret)
{
Grob *other_common = common_refpoint_of_array (*elements, me, other_axis (a));
-
+
for (vsize i = elements->size (); i--;)
{
Grob *g = (*elements)[i];
Skyline_pair skylines;
if (!pure)
- {
- Skyline_pair *skys = Skyline_pair::unsmob (g->get_property (a == Y_AXIS
- ? "vertical-skylines"
- : "horizontal-skylines"));
- if (skys)
- skylines = *skys;
-
- /* This skyline was calculated relative to the grob g. In order to compare it to
- skylines belonging to other grobs, we need to shift it so that it is relative
- to the common reference. */
- Real offset = g->relative_coordinate (other_common, other_axis (a));
- skylines.shift (offset);
- }
+ {
+ Skyline_pair *skys = Skyline_pair::unsmob (g->get_property (a == Y_AXIS
+ ? "vertical-skylines"
+ : "horizontal-skylines"));
+ if (skys)
+ skylines = *skys;
+
+ /* This skyline was calculated relative to the grob g. In order to compare it to
+ skylines belonging to other grobs, we need to shift it so that it is relative
+ to the common reference. */
+ Real offset = g->relative_coordinate (other_common, other_axis (a));
+ skylines.shift (offset);
+ }
else
- {
- assert (a == Y_AXIS);
- Interval extent = g->pure_height (g, start, end);
-
- // This is a hack to get better accuracy on the pure-height of VerticalAlignment.
- // It's quite common for a treble clef to be the highest element of one system
- // and for a low note (or lyrics) to be the lowest note on another. The two will
- // never collide, but the pure-height stuff only works with bounding boxes, so it
- // doesn't know that. The result is a significant over-estimation of the pure-height,
- // especially on systems with many staves. To correct for this, we build a skyline
- // in two parts: the part we did above contains most of the grobs (note-heads, etc.)
- // while the bit we're about to do only contains the breakable grobs at the beginning
- // of the system. This way, the tall treble clefs are only compared with the treble
- // clefs of the other staff and they will be ignored if the staff above is, for example,
- // lyrics.
- if (Axis_group_interface::has_interface (g)
- && !Hara_kiri_group_spanner::request_suicide (g, start, end))
- {
- extent = Axis_group_interface::rest_of_line_pure_height (g, start, end);
- Interval begin_of_line_extent = Axis_group_interface::begin_of_line_pure_height (g, start);
- if (!begin_of_line_extent.is_empty ())
- {
- Box b;
- b[a] = begin_of_line_extent;
- b[other_axis (a)] = Interval (-infinity_f, -1);
- skylines.insert (b, 0, other_axis (a));
- }
- }
-
- if (!extent.is_empty ())
- {
- Box b;
- b[a] = extent;
- b[other_axis (a)] = Interval (0, infinity_f);
- skylines.insert (b, 0, other_axis (a));
- }
- }
+ {
+ assert (a == Y_AXIS);
+ Interval extent = g->pure_height (g, start, end);
+
+ // This is a hack to get better accuracy on the pure-height of VerticalAlignment.
+ // It's quite common for a treble clef to be the highest element of one system
+ // and for a low note (or lyrics) to be the lowest note on another. The two will
+ // never collide, but the pure-height stuff only works with bounding boxes, so it
+ // doesn't know that. The result is a significant over-estimation of the pure-height,
+ // especially on systems with many staves. To correct for this, we build a skyline
+ // in two parts: the part we did above contains most of the grobs (note-heads, etc.)
+ // while the bit we're about to do only contains the breakable grobs at the beginning
+ // of the system. This way, the tall treble clefs are only compared with the treble
+ // clefs of the other staff and they will be ignored if the staff above is, for example,
+ // lyrics.
+ if (Axis_group_interface::has_interface (g)
+ && !Hara_kiri_group_spanner::request_suicide (g, start, end))
+ {
+ extent = Axis_group_interface::rest_of_line_pure_height (g, start, end);
+ Interval begin_of_line_extent = Axis_group_interface::begin_of_line_pure_height (g, start);
+ if (!begin_of_line_extent.is_empty ())
+ {
+ Box b;
+ b[a] = begin_of_line_extent;
+ b[other_axis (a)] = Interval (-infinity_f, -1);
+ skylines.insert (b, 0, other_axis (a));
+ }
+ }
+
+ if (!extent.is_empty ())
+ {
+ Box b;
+ b[a] = extent;
+ b[other_axis (a)] = Interval (0, infinity_f);
+ skylines.insert (b, 0, other_axis (a));
+ }
+ }
if (skylines.is_empty ())
- elements->erase (elements->begin () + i);
+ elements->erase (elements->begin () + i);
else
- ret->push_back (skylines);
+ ret->push_back (skylines);
}
reverse (*ret);
}
vector<Real>
Align_interface::get_minimum_translations (Grob *me,
- vector<Grob*> const &all_grobs,
- Axis a)
+ vector<Grob *> const &all_grobs,
+ Axis a)
{
return internal_get_minimum_translations (me, all_grobs, a, true, false, 0, 0);
}
vector<Real>
Align_interface::get_pure_minimum_translations (Grob *me,
- vector<Grob*> const &all_grobs,
- Axis a, int start, int end)
+ vector<Grob *> const &all_grobs,
+ Axis a, int start, int end)
{
return internal_get_minimum_translations (me, all_grobs, a, true, true, start, end);
}
vector<Real>
Align_interface::get_minimum_translations_without_min_dist (Grob *me,
- vector<Grob*> const &all_grobs,
- Axis a)
+ vector<Grob *> const &all_grobs,
+ Axis a)
{
return internal_get_minimum_translations (me, all_grobs, a, false, false, 0, 0);
}
// else centered dynamics will break when there is a fixed alignment).
vector<Real>
Align_interface::internal_get_minimum_translations (Grob *me,
- vector<Grob*> const &all_grobs,
- Axis a,
- bool include_fixed_spacing,
- bool pure, int start, int end)
+ vector<Grob *> const &all_grobs,
+ Axis a,
+ bool include_fixed_spacing,
+ bool pure, int start, int end)
{
- if (!pure && a == Y_AXIS && dynamic_cast<Spanner*> (me) && !me->get_system ())
+ if (!pure && a == Y_AXIS && dynamic_cast<Spanner *> (me) && !me->get_system ())
me->programming_error ("vertical alignment called before line-breaking");
// If include_fixed_spacing is true, we look at things like system-system-spacing
// and alignment-distances, which only make sense for the toplevel VerticalAlignment.
// If we aren't toplevel, we're working on something like BassFigureAlignment
// and so we definitely don't want to include alignment-distances!
- if (!dynamic_cast<System*> (me->get_parent (Y_AXIS)))
+ if (!dynamic_cast<System *> (me->get_parent (Y_AXIS)))
include_fixed_spacing = false;
-
+
Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"),
- DOWN);
- vector<Grob*> elems (all_grobs); // writable copy
+ DOWN);
+ vector<Grob *> elems (all_grobs); // writable copy
vector<Skyline_pair> skylines;
get_skylines (me, &elems, a, pure, start, end, &skylines);
Real padding = default_padding;
if (j == 0)
- dy = skylines[j][-stacking_dir].max_height () + padding;
+ dy = skylines[j][-stacking_dir].max_height () + padding;
else
- {
- SCM spec = Page_layout_problem::get_spacing_spec (elems[j-1], elems[j], pure, start, end);
- Page_layout_problem::read_spacing_spec (spec, &padding, ly_symbol2scm ("padding"));
-
- dy = down_skyline.distance (skylines[j][-stacking_dir]) + padding;
-
- Real min_distance = 0;
- if (Page_layout_problem::read_spacing_spec (spec, &min_distance, ly_symbol2scm ("minimum-distance")))
- dy = max (dy, min_distance);
-
- if (include_fixed_spacing && Page_layout_problem::is_spaceable (elems[j]) && last_spaceable_element)
- {
- // Spaceable staves may have
- // constraints coming from the previous spaceable staff
- // as well as from the previous staff.
- spec = Page_layout_problem::get_spacing_spec (last_spaceable_element, elems[j], pure, start, end);
- Real spaceable_padding = 0;
- Page_layout_problem::read_spacing_spec (spec,
- &spaceable_padding,
- ly_symbol2scm ("padding"));
- dy = max(dy, (last_spaceable_skyline.distance (skylines[j][-stacking_dir])
- + stacking_dir*(last_spaceable_element_pos - where) + spaceable_padding));
-
- Real spaceable_min_distance = 0;
- if (Page_layout_problem::read_spacing_spec (spec,
- &spaceable_min_distance,
- ly_symbol2scm ("minimum-distance")))
- dy = max (dy, spaceable_min_distance + stacking_dir*(last_spaceable_element_pos - where));
-
- dy = max (dy, Page_layout_problem::get_fixed_spacing (last_spaceable_element, elems[j], spaceable_count,
- pure, start, end));
- }
- }
+ {
+ SCM spec = Page_layout_problem::get_spacing_spec (elems[j - 1], elems[j], pure, start, end);
+ Page_layout_problem::read_spacing_spec (spec, &padding, ly_symbol2scm ("padding"));
+
+ dy = down_skyline.distance (skylines[j][-stacking_dir]) + padding;
+
+ Real min_distance = 0;
+ if (Page_layout_problem::read_spacing_spec (spec, &min_distance, ly_symbol2scm ("minimum-distance")))
+ dy = max (dy, min_distance);
+
+ if (include_fixed_spacing && Page_layout_problem::is_spaceable (elems[j]) && last_spaceable_element)
+ {
+ // Spaceable staves may have
+ // constraints coming from the previous spaceable staff
+ // as well as from the previous staff.
+ spec = Page_layout_problem::get_spacing_spec (last_spaceable_element, elems[j], pure, start, end);
+ Real spaceable_padding = 0;
+ Page_layout_problem::read_spacing_spec (spec,
+ &spaceable_padding,
+ ly_symbol2scm ("padding"));
+ dy = max (dy, (last_spaceable_skyline.distance (skylines[j][-stacking_dir])
+ + stacking_dir * (last_spaceable_element_pos - where) + spaceable_padding));
+
+ Real spaceable_min_distance = 0;
+ if (Page_layout_problem::read_spacing_spec (spec,
+ &spaceable_min_distance,
+ ly_symbol2scm ("minimum-distance")))
+ dy = max (dy, spaceable_min_distance + stacking_dir * (last_spaceable_element_pos - where));
+
+ dy = max (dy, Page_layout_problem::get_fixed_spacing (last_spaceable_element, elems[j], spaceable_count,
+ pure, start, end));
+ }
+ }
if (isinf (dy)) /* if the skyline is empty, maybe max_height is infinity_f */
- dy = 0.0;
+ dy = 0.0;
dy = max (0.0, dy);
down_skyline.raise (-stacking_dir * dy);
translates.push_back (where);
if (Page_layout_problem::is_spaceable (elems[j]))
- {
- spaceable_count++;
- last_spaceable_element = elems[j];
- last_spaceable_element_pos = where;
- last_spaceable_skyline = down_skyline;
- }
+ {
+ spaceable_count++;
+ last_spaceable_element = elems[j];
+ last_spaceable_element_pos = where;
+ last_spaceable_skyline = down_skyline;
+ }
}
// So far, we've computed the translates for all the non-empty elements.
if (!translates.empty ())
{
Real w = translates[0];
- for (vsize i = 0, j = 0; j < all_grobs.size (); j++)
- {
- if (i < elems.size () && all_grobs[j] == elems[i])
- w = translates[i++];
- all_translates.push_back (w);
- }
+ for (vsize i = 0, j = 0; j < all_grobs.size (); j++)
+ {
+ if (i < elems.size () && all_grobs[j] == elems[i])
+ w = translates[i++];
+ all_translates.push_back (w);
+ }
}
return all_translates;
}
if (translates.size ())
{
for (vsize i = 0; i < all_grobs.size (); i++)
- if (all_grobs[i] == ch)
- return translates[i];
+ if (all_grobs[i] == ch)
+ return translates[i];
}
else
return 0;
Axis a = Align_interface::axis (me);
SCM sym = axis_offset_symbol (a);
SCM proc = axis_parent_positioning (a);
-
+
element->set_property (sym, proc);
Axis_group_interface::add_element (me, element);
}
}
ADD_INTERFACE (Align_interface,
- "Order grobs from top to bottom, left to right, right to left"
- " or bottom to top. For vertical alignments of staves, the"
- " @code{break-system-details} of the left"
- " @rinternals{NonMusicalPaperColumn} may be set to tune"
- " vertical spacing.",
-
- /* properties */
- "align-dir "
- "axes "
- "elements "
- "padding "
- "positioning-done "
- "stacking-dir "
- );
+ "Order grobs from top to bottom, left to right, right to left"
+ " or bottom to top. For vertical alignments of staves, the"
+ " @code{break-system-details} of the left"
+ " @rinternals{NonMusicalPaperColumn} may be set to tune"
+ " vertical spacing.",
+
+ /* properties */
+ "align-dir "
+ "axes "
+ "elements "
+ "padding "
+ "positioning-done "
+ "stacking-dir "
+ );
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2007--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "main.hh"
LY_DEFINE (ly_reset_all_fonts, "ly:reset-all-fonts", 0, 0, 0,
- (),
- "Forget all about previously loaded fonts.")
+ (),
+ "Forget all about previously loaded fonts.")
{
delete all_fonts_global;
all_fonts_global = new All_font_metrics (global_path.to_string ());
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_system_font_load, "ly:system-font-load", 1, 0, 0,
- (SCM name),
- "Load the OpenType system font @file{@var{name}.otf}."
- " Fonts loaded with this command must contain three"
- " additional SFNT font tables called @code{LILC},"
- " @code{LILF}, and @code{LILY}, needed for typesetting"
- " musical elements. Currently, only the Emmentaler and"
- " the Emmentaler-Brace fonts fulfill these requirements.\n"
- "\n"
- "Note that only @code{ly:font-get-glyph} and derived"
- " code (like @code{\\lookup}) can access glyphs from"
- " the system fonts; text strings are handled exclusively"
- " via the Pango interface.")
+ (SCM name),
+ "Load the OpenType system font @file{@var{name}.otf}."
+ " Fonts loaded with this command must contain three"
+ " additional SFNT font tables called @code{LILC},"
+ " @code{LILF}, and @code{LILY}, needed for typesetting"
+ " musical elements. Currently, only the Emmentaler and"
+ " the Emmentaler-Brace fonts fulfill these requirements.\n"
+ "\n"
+ "Note that only @code{ly:font-get-glyph} and derived"
+ " code (like @code{\\lookup}) can access glyphs from"
+ " the system fonts; text strings are handled exclusively"
+ " via the Pango interface.")
{
LY_ASSERT_TYPE (scm_is_string, name, 1);
-
+
string name_str = ly_scm2string (name);
Font_metric *fm = all_fonts_global->find_font (name_str);
#include "scm-hash.hh"
#include "warn.hh"
-
Index_to_charcode_map const *
All_font_metrics::get_index_to_charcode_map (string filename,
- int face_index,
- FT_Face face)
+ int face_index,
+ FT_Face face)
{
string key = filename + String_convert::int_string (face_index);
if (filename_charcode_maps_map_.find (key)
return &filename_charcode_maps_map_[key];
}
-
All_font_metrics::All_font_metrics (string path)
{
otf_dict_ = new Scheme_hash_table;
pango_dpi_ = PANGO_RESOLUTION;
pango_ft2_font_map_set_resolution (pango_ft2_fontmap_,
- pango_dpi_, pango_dpi_);
+ pango_dpi_, pango_dpi_);
pango_dict_ = new Scheme_hash_table;
#endif
Pango_font *
All_font_metrics::find_pango_font (PangoFontDescription const *description,
- Real output_scale
- )
+ Real output_scale
+ )
{
gchar *pango_fn = pango_font_description_to_filename (description);
SCM key = ly_symbol2scm (pango_fn);
if (!pango_dict_->try_retrieve (key, &val))
{
if (be_verbose_global)
- progress_indication ("\n[" + string (pango_fn));
+ progress_indication ("\n[" + string (pango_fn));
Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
- description,
- output_scale
- );
-
+ description,
+ output_scale
+ );
+
val = pf->self_scm ();
pango_dict_->set (key, val);
pf->unprotect ();
if (be_verbose_global)
- progress_indication ("]");
+ progress_indication ("]");
pf->description_ = scm_cons (SCM_BOOL_F,
- scm_from_double (1.0));
+ scm_from_double (1.0));
}
g_free (pango_fn);
return dynamic_cast<Pango_font *> (unsmob_metrics (val));
#endif
-
Open_type_font *
All_font_metrics::find_otf (string name)
{
string file_name;
if (file_name.empty ())
- file_name = search_path_.find (name + ".otf");
+ file_name = search_path_.find (name + ".otf");
if (file_name.empty ())
- return 0;
+ return 0;
if (be_verbose_global)
- progress_indication ("\n[" + file_name);
+ progress_indication ("\n[" + file_name);
val = Open_type_font::make_otf (file_name);
if (be_verbose_global)
- progress_indication ("]");
+ progress_indication ("]");
unsmob_metrics (val)->file_name_ = file_name;
SCM name_string = ly_string2scm (name);
unsmob_metrics (val)->description_ = scm_cons (name_string,
- scm_from_double (1.0));
+ scm_from_double (1.0));
otf_dict_->set (sname, val);
unsmob_metrics (val)->unprotect ();
}
accidentals_[d] = make_item ("AmbitusAccidental", SCM_EOL);
accidentals_[d]->set_parent (heads_[d], Y_AXIS);
heads_[d]->set_object ("accidental-grob",
- accidentals_[d]->self_scm ());
+ accidentals_[d]->self_scm ());
Axis_group_interface::add_element (group_, heads_[d]);
Axis_group_interface::add_element (group_, accidentals_[d]);
}
{
SCM p = nr->get_property ("pitch");
/*
- If the engraver is added to a percussion context,
- filter out unpitched note heads.
+ If the engraver is added to a percussion context,
+ filter out unpitched note heads.
*/
if (!unsmob_pitch (p))
- return;
+ return;
Pitch pitch = *unsmob_pitch (p);
Drul_array<bool> expands = pitch_interval_.add_point (pitch);
if (expands[UP])
- causes_[UP] = nr;
+ causes_[UP] = nr;
if (expands[DOWN])
- causes_[DOWN] = nr;
+ causes_[DOWN] = nr;
}
}
{
if (ambitus_ && !pitch_interval_.is_empty ())
{
- Grob *accidental_placement =
- make_item ("AccidentalPlacement", accidentals_[DOWN]->self_scm ());
+ Grob *accidental_placement
+ = make_item ("AccidentalPlacement", accidentals_[DOWN]->self_scm ());
Direction d = DOWN;
do
- {
- Pitch p = pitch_interval_[d];
- heads_[d]->set_property ("cause", causes_[d]->self_scm());
- heads_[d]->set_property ("staff-position",
- scm_from_int (start_c0_ + p.steps ()));
-
- SCM handle = scm_assoc (scm_cons (scm_from_int (p.get_octave ()),
- scm_from_int (p.get_notename ())),
- start_key_sig_);
-
- if (handle == SCM_BOOL_F)
- handle = scm_assoc (scm_from_int (p.get_notename ()),
- start_key_sig_);
-
- Rational sig_alter = (handle != SCM_BOOL_F)
- ? robust_scm2rational (scm_cdr (handle), Rational (0))
- : Rational (0);
-
- const Pitch other = pitch_interval_[-d];
-
- if (sig_alter == p.get_alteration ()
- && !((p.steps () == other.steps ())
- && (p.get_alteration () != other.get_alteration ())))
- {
- accidentals_[d]->suicide ();
- heads_[d]->set_object ("accidental-grob", SCM_EOL);
- }
- else
- accidentals_[d]->
- set_property ("alteration",
- ly_rational2scm (p.get_alteration ()));
- Separation_item::add_conditional_item (heads_[d],
- accidental_placement);
- Accidental_placement::add_accidental (accidental_placement,
- accidentals_[d]);
- Pointer_group_interface::add_grob (ambitus_,
- ly_symbol2scm ("note-heads"),
- heads_[d]);
- }
+ {
+ Pitch p = pitch_interval_[d];
+ heads_[d]->set_property ("cause", causes_[d]->self_scm ());
+ heads_[d]->set_property ("staff-position",
+ scm_from_int (start_c0_ + p.steps ()));
+
+ SCM handle = scm_assoc (scm_cons (scm_from_int (p.get_octave ()),
+ scm_from_int (p.get_notename ())),
+ start_key_sig_);
+
+ if (handle == SCM_BOOL_F)
+ handle = scm_assoc (scm_from_int (p.get_notename ()),
+ start_key_sig_);
+
+ Rational sig_alter = (handle != SCM_BOOL_F)
+ ? robust_scm2rational (scm_cdr (handle), Rational (0))
+ : Rational (0);
+
+ const Pitch other = pitch_interval_[-d];
+
+ if (sig_alter == p.get_alteration ()
+ && !((p.steps () == other.steps ())
+ && (p.get_alteration () != other.get_alteration ())))
+ {
+ accidentals_[d]->suicide ();
+ heads_[d]->set_object ("accidental-grob", SCM_EOL);
+ }
+ else
+ accidentals_[d]->
+ set_property ("alteration",
+ ly_rational2scm (p.get_alteration ()));
+ Separation_item::add_conditional_item (heads_[d],
+ accidental_placement);
+ Accidental_placement::add_accidental (accidental_placement,
+ accidentals_[d]);
+ Pointer_group_interface::add_grob (ambitus_,
+ ly_symbol2scm ("note-heads"),
+ heads_[d]);
+ }
while (flip (&d) != DOWN);
Axis_group_interface::add_element (group_, accidental_placement);
{
Direction d = DOWN;
do
- {
- accidentals_[d]->suicide ();
- heads_[d]->suicide ();
- }
+ {
+ accidentals_[d]->suicide ();
+ heads_[d]->suicide ();
+ }
while (flip (&d) != DOWN);
ambitus_->suicide ();
ADD_ACKNOWLEDGER (Ambitus_engraver, note_head);
ADD_TRANSLATOR (Ambitus_engraver,
- /* doc */
- "Create an ambitus.",
-
- /* create */
- "AccidentalPlacement "
- "Ambitus "
- "AmbitusAccidental "
- "AmbitusLine "
- "AmbitusNoteHead ",
-
- /* read */
- "keySignature "
- "middleCPosition ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create an ambitus.",
+
+ /* create */
+ "AccidentalPlacement "
+ "Ambitus "
+ "AmbitusAccidental "
+ "AmbitusLine "
+ "AmbitusNoteHead ",
+
+ /* read */
+ "keySignature "
+ "middleCPosition ",
+
+ /* write */
+ ""
+ );
if (arpeggio_)
{
if (!arpeggio_->get_parent (Y_AXIS))
- arpeggio_->set_parent (info.grob (), Y_AXIS);
+ arpeggio_->set_parent (info.grob (), Y_AXIS);
Pointer_group_interface::add_grob (arpeggio_,
- ly_symbol2scm ("stems"),
- info.grob ());
+ ly_symbol2scm ("stems"),
+ info.grob ());
}
}
void
ADD_ACKNOWLEDGER (Arpeggio_engraver, rhythmic_head);
ADD_TRANSLATOR (Arpeggio_engraver,
- /* doc */
- "Generate an Arpeggio symbol.",
+ /* doc */
+ "Generate an Arpeggio symbol.",
- /* create */
- "Arpeggio",
+ /* create */
+ "Arpeggio",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
{
Grob *stem = stems[i];
common = common->common_refpoint (Staff_symbol_referencer::get_staff_symbol (stem),
- Y_AXIS);
+ Y_AXIS);
}
return common;
{
Grob *me = unsmob_grob (smob);
Interval heads = robust_scm2interval (me->get_property ("positions"),
- Interval ())
- * Staff_symbol_referencer::staff_space (me);
+ Interval ())
+ * Staff_symbol_referencer::staff_space (me);
if (heads.is_empty () || heads.length () < 0.5)
{
if (to_boolean (me->get_property ("transparent")))
- {
- /*
- This is part of a cross-staff/-voice span-arpeggio,
- so we need to ensure `heads' is large enough to encompass
- a single trill-element since the span-arpeggio depends on
- its children to prevent collisions.
- */
- heads.unite (get_squiggle (me).extent (Y_AXIS));
- }
+ {
+ /*
+ This is part of a cross-staff/-voice span-arpeggio,
+ so we need to ensure `heads' is large enough to encompass
+ a single trill-element since the span-arpeggio depends on
+ its children to prevent collisions.
+ */
+ heads.unite (get_squiggle (me).extent (Y_AXIS));
+ }
else
- {
- me->warning ("no heads for arpeggio found?");
- me->suicide ();
- return SCM_EOL;
- }
+ {
+ me->warning ("no heads for arpeggio found?");
+ me->suicide ();
+ return SCM_EOL;
+ }
}
SCM ad = me->get_property ("arpeggio-direction");
{
Grob *me = unsmob_grob (smob);
Interval heads = robust_scm2interval (me->get_property ("positions"),
- Interval ())
- * Staff_symbol_referencer::staff_space (me);
+ Interval ())
+ * Staff_symbol_referencer::staff_space (me);
Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
Real sp = 1.5 * Staff_symbol_referencer::staff_space (me);
Grob *me = unsmob_grob (smob);
SCM dash_definition = me->get_property ("dash-definition");
Interval heads = robust_scm2interval (me->get_property ("positions"),
- Interval ())
- * Staff_symbol_referencer::staff_space (me);
+ Interval ())
+ * Staff_symbol_referencer::staff_space (me);
Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
Real dy = heads.length ();
}
ADD_INTERFACE (Arpeggio,
- "Functions and settings for drawing an arpeggio symbol.",
-
- /* properties */
- "arpeggio-direction "
- "positions "
- "script-priority " // TODO: make around-note-interface
- "stems "
- "dash-definition " // TODO: make apply to non-slur arpeggios
- );
+ "Functions and settings for drawing an arpeggio symbol.",
+
+ /* properties */
+ "arpeggio-direction "
+ "positions "
+ "script-priority " // TODO: make around-note-interface
+ "stems "
+ "dash-definition " // TODO: make apply to non-slur arpeggios
+ );
SCM
articulation_list (vector<Stream_event *> note_events,
- vector<Stream_event *> articulation_events,
- char const *articulation_name)
+ vector<Stream_event *> articulation_events,
+ char const *articulation_name)
{
vector<Stream_event *> string_events;
SCM articulations = SCM_EOL;
Stream_event *articulation_event = 0;
/*
- For notes inside a chord construct, string indications are
- stored as articulations on the note, so we check through
- the notes
+ For notes inside a chord construct, string indications are
+ stored as articulations on the note, so we check through
+ the notes
*/
for (SCM s = event->get_property ("articulations");
- !articulation_event && scm_is_pair (s); s = scm_cdr (s))
- {
- Stream_event *art = unsmob_stream_event (scm_car (s));
+ !articulation_event && scm_is_pair (s); s = scm_cdr (s))
+ {
+ Stream_event *art = unsmob_stream_event (scm_car (s));
- if (art->in_event_class (articulation_name))
- articulation_event = art;
- }
+ if (art->in_event_class (articulation_name))
+ articulation_event = art;
+ }
/*
- For string indications listed outside a chord construct,
- a string_number_event is generated, so if there was no string
- in the articulations, we check for string events outside
- the chord construct
+ For string indications listed outside a chord construct,
+ a string_number_event is generated, so if there was no string
+ in the articulations, we check for string events outside
+ the chord construct
*/
if (!articulation_event && j < articulation_events.size ())
- {
- articulation_event = articulation_events[j];
- if (j + 1 < articulation_events.size ())
- j++;
- }
+ {
+ articulation_event = articulation_events[j];
+ if (j + 1 < articulation_events.size ())
+ j++;
+ }
articulations = scm_cons ((articulation_event
- ? articulation_event->self_scm ()
- : SCM_EOL),
- articulations);
+ ? articulation_event->self_scm ()
+ : SCM_EOL),
+ articulations);
}
return (scm_reverse (articulations));
origin_trans_ = 0;
}
-vector<Context*>
+vector<Context *>
Audio_element_info::origin_contexts (Translator *end) const
{
Context *t = origin_trans_->context ();
- vector<Context*> r;
+ vector<Context *> r;
do
{
r.push_back (t);
You should have received a copy of the GNU General Public License
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <cassert>
+#include <cassert>
#include "audio-element.hh"
}
Audio_item::Audio_item ()
- : audio_column_ (0)
- , channel_ (0)
+ : audio_column_ (0),
+ channel_ (0)
{
}
Audio_note::Audio_note (Pitch p, Moment m, bool tie_event, Pitch transposing)
- : pitch_ (p)
- , length_mom_ (m)
- , transposing_ (transposing)
- , dynamic_ (0)
- , tied_ (0)
- , tie_event_ (tie_event)
+ : pitch_ (p),
+ length_mom_ (m),
+ transposing_ (transposing),
+ dynamic_ (0),
+ tied_ (0),
+ tie_event_ (tie_event)
{
}
}
Audio_dynamic::Audio_dynamic ()
- : volume_ (-1)
- , silent_ (false)
+ : volume_ (-1),
+ silent_ (false)
{
}
Moment
remap_grace_duration (Moment m)
{
- return Moment (m.main_part_ + Rational (9,40) * m.grace_part_,
- Rational (0));
+ return Moment (m.main_part_ + Rational (9, 40) * m.grace_part_,
+ Rational (0));
}
Real
Audio_span_dynamic::render ()
{
if (dynamics_.size () <= 1)
- return ;
+ return;
assert (dynamics_[0]->volume_ >= 0);
- while (dynamics_.back ()->volume_ > 0
- && dynamics_.size () > 1
- && sign (dynamics_.back ()->volume_ - dynamics_[0]->volume_) != grow_dir_)
+ while (dynamics_.back ()->volume_ > 0
+ && dynamics_.size () > 1
+ && sign (dynamics_.back ()->volume_ - dynamics_[0]->volume_) != grow_dir_)
{
dynamics_.erase (dynamics_.end () - 1);
}
if (dynamics_.size () <= 1)
{
programming_error ("Impossible or ambiguous (de)crescendo in MIDI.");
- return ;
+ return;
}
Real delta_v = grow_dir_ * 0.1;
Real total_t = moment_to_real (dynamics_.back ()->get_column ()->when () - start);
- for (vsize i = 1; i < dynamics_.size (); i ++)
+ for (vsize i = 1; i < dynamics_.size (); i++)
{
Moment dt_moment = dynamics_[i]->get_column ()->when ()
- - start;
+ - start;
- Real dt = moment_to_real (dt_moment);
+ Real dt = moment_to_real (dt_moment);
- Real v = start_v + delta_v * (dt / total_t);
+ Real v = start_v + delta_v * (dt / total_t);
dynamics_[i]->volume_ = v;
}
}
-
-
Audio_tempo::Audio_tempo (int per_minute_4)
{
per_minute_4_ = per_minute_4;
i.process ();
i.finalize ();
-
+
midi_stream.write (midi_track);
}
Beaming_pattern *finished_grouping_;
-
Beaming_options beaming_options_;
Beaming_options finished_beaming_options_;
-
void check_bar_property ();
};
if (stems_)
{
if (extend_mom_ < now)
- end_beam ();
+ end_beam ();
}
if (scm_is_string (get_property ("whichBar")))
if (forbid_)
{
if (stems_)
- end_beam ();
+ end_beam ();
else
- junk_beam ();
+ junk_beam ();
}
}
Auto_beam_engraver::test_moment (Direction dir, Moment test_mom, Moment dur)
{
return scm_call_4 (get_property ("autoBeamCheck"),
- context ()->self_scm (),
- scm_from_int (dir),
+ context ()->self_scm (),
+ scm_from_int (dir),
test_mom.smobbed_copy (),
- dur.smobbed_copy ())
- != SCM_BOOL_F;
+ dur.smobbed_copy ())
+ != SCM_BOOL_F;
}
void
{
bool b = test_moment (START, test_mom, dur);
if (b)
- begin_beam ();
+ begin_beam ();
}
}
if (stems_)
{
/* Allow already started autobeam to end:
- don't check for autoBeaming */
+ don't check for autoBeaming */
bool b = test_moment (STOP, test_mom, dur);
if (b)
- end_beam ();
+ end_beam ();
}
}
finished_beam_ = create_beam ();
if (finished_beam_)
- {
- Grob_info i = make_grob_info (finished_beam_, SCM_EOL);
- i.rerouting_daddy_context_ = beam_start_context_;
-
- announce_end_grob (i);
- finished_grouping_ = grouping_;
- finished_beaming_options_ = beaming_options_;
- }
+ {
+ Grob_info i = make_grob_info (finished_beam_, SCM_EOL);
+ i.rerouting_daddy_context_ = beam_start_context_;
+
+ announce_end_grob (i);
+ finished_grouping_ = grouping_;
+ finished_beaming_options_ = beaming_options_;
+ }
delete stems_;
stems_ = 0;
grouping_ = 0;
if (finished_beam_)
{
if (!finished_beam_->get_bound (RIGHT))
- finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
+ finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
finished_grouping_->beamify (finished_beaming_options_);
Beam::set_beaming (finished_beam_, finished_grouping_);
junk_beam ();
}
-
void
Auto_beam_engraver::acknowledge_beam (Grob_info /* info */)
{
if (!Stem::head_count (stem))
{
if (stems_)
- end_beam ();
+ end_beam ();
return;
}
if (Stem::get_beam (stem))
{
if (stems_)
- junk_beam ();
+ junk_beam ();
return;
}
if (durlog <= 2)
{
if (stems_)
- end_beam ();
+ end_beam ();
return;
}
if (dur < shortest_mom_)
{
- /* new shortest moment, so store it and set recheck_needed */
- shortest_mom_ = dur;
- recheck_needed = true;
+ /* new shortest moment, so store it and set recheck_needed */
+ shortest_mom_ = dur;
+ recheck_needed = true;
}
/* end should be based on shortest_mom_, begin should be
return;
grouping_->add_stem (now - beam_start_moment_ + beam_start_location_,
- durlog - 2,
- Stem::is_invisible (stem));
+ durlog - 2,
+ Stem::is_invisible (stem));
stems_->push_back (stem);
last_add_mom_ = now;
extend_mom_ = max (extend_mom_, now) + get_event_length (ev, now);
bool found_end;
-
for (vsize i = 0; i < stems_->size () - 1;)
{
found_end = test_moment (STOP,
void
Auto_beam_engraver::process_acknowledged ()
{
- Moment now = now_mom();
+ Moment now = now_mom ();
if (extend_mom_ > now)
return;
else if (process_acknowledged_count_ > 1)
{
if (stems_)
- {
- if ((extend_mom_ < now)
- || ((extend_mom_ == now) && (last_add_mom_ != now)))
- end_beam ();
- else if (!stems_->size ())
- junk_beam ();
- }
+ {
+ if ((extend_mom_ < now)
+ || ((extend_mom_ == now) && (last_add_mom_ != now)))
+ end_beam ();
+ else if (!stems_->size ())
+ junk_beam ();
+ }
}
process_acknowledged_count_++;
/* write */
""
- );
+ );
void
Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym,
- string to_id)
+ string to_id)
{
Context *current = it->get_outlet ();
Context *last = 0;
if (current)
{
if (last)
- {
- Context *dest
- = it->get_outlet ()->find_create_context (to_type_sym, to_id, SCM_EOL);
-
- send_stream_event (last, "ChangeParent", get_music ()->origin (),
- ly_symbol2scm ("context"), dest->self_scm ());
- }
+ {
+ Context *dest
+ = it->get_outlet ()->find_create_context (to_type_sym, to_id, SCM_EOL);
+
+ send_stream_event (last, "ChangeParent", get_music ()->origin (),
+ ly_symbol2scm ("context"), dest->self_scm ());
+ }
else
- {
- /*
- We could change the current translator's id, but that would make
- errors hard to catch
-
- */
- ;
- }
+ {
+ /*
+ We could change the current translator's id, but that would make
+ errors hard to catch
+
+ */
+ ;
+ }
}
}
{
splitm = unsmob_moment (scm_caar (split_list_));
if ((*splitm + start_moment_) > now)
- break;
+ break;
SCM tag = scm_cdar (split_list_);
Direction d = to_dir (tag);
if (d && d != where_dir_)
- {
- where_dir_ = d;
- string to_id = (d >= 0) ? "up" : "down";
- change_to (child_iter_,
- ly_symbol2scm ("Staff"),
- to_id);
- }
+ {
+ where_dir_ = d;
+ string to_id = (d >= 0) ? "up" : "down";
+ change_to (child_iter_,
+ ly_symbol2scm ("Staff"),
+ to_id);
+ }
}
}
SCM props = get_outlet ()->get_property ("trebleStaffProperties");
Context *up = get_outlet ()->find_create_context (ly_symbol2scm ("Staff"),
- "up", props);
+ "up", props);
props = get_outlet ()->get_property ("bassStaffProperties");
Context *down = get_outlet ()->find_create_context (ly_symbol2scm ("Staff"),
- "down", props);
+ "down", props);
up_.set_context (up);
down_.set_context (down);
Context *voice = up->find_create_context (ly_symbol2scm ("Voice"),
- "", SCM_EOL);
+ "", SCM_EOL);
set_context (voice);
Music_wrapper_iterator::construct_children ();
}
for (vsize i = 0; i < elts_.size (); i++)
{
if (!unsmob_grob (elts_[i]->get_object ("axis-group-parent-Y")))
- {
- if (staffline_->get_parent (Y_AXIS)
- && staffline_->get_parent (Y_AXIS) == elts_[i])
- {
- staffline_->warning (_ ("Axis_group_engraver: vertical group already has a parent"));
- staffline_->warning (_ ("are there two Axis_group_engravers?"));
- staffline_->warning (_ ("removing this vertical group"));
- staffline_->suicide ();
- staffline_ = 0;
- break;
- }
- add_element (elts_[i]);
- }
+ {
+ if (staffline_->get_parent (Y_AXIS)
+ && staffline_->get_parent (Y_AXIS) == elts_[i])
+ {
+ staffline_->warning (_ ("Axis_group_engraver: vertical group already has a parent"));
+ staffline_->warning (_ ("are there two Axis_group_engravers?"));
+ staffline_->warning (_ ("removing this vertical group"));
+ staffline_->suicide ();
+ staffline_ = 0;
+ break;
+ }
+ add_element (elts_[i]);
+ }
}
elts_.clear ();
}
ADD_ACKNOWLEDGER (Axis_group_engraver, grob);
ADD_TRANSLATOR (Axis_group_engraver,
- /* doc */
- "Group all objects created in this context in a"
- " @code{VerticalAxisGroup} spanner.",
+ /* doc */
+ "Group all objects created in this context in a"
+ " @code{VerticalAxisGroup} spanner.",
- /* create */
- "VerticalAxisGroup ",
+ /* create */
+ "VerticalAxisGroup ",
- /* read */
- "currentCommandColumn ",
+ /* read */
+ "currentCommandColumn ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "grob-array.hh"
LY_DEFINE (ly_relative_group_extent, "ly:relative-group-extent",
- 3, 0, 0, (SCM elements, SCM common, SCM axis),
- "Determine the extent of @var{elements} relative to @var{common} in the"
- " @var{axis} direction.")
+ 3, 0, 0, (SCM elements, SCM common, SCM axis),
+ "Determine the extent of @var{elements} relative to @var{common} in the"
+ " @var{axis} direction.")
{
Grob_array *ga = unsmob_grob_array (elements);
LY_ASSERT_SMOB (Grob, common, 2);
LY_ASSERT_TYPE (is_axis, axis, 3);
- vector<Grob*> elts;
+ vector<Grob *> elts;
if (!ga)
{
for (SCM s = elements; scm_is_pair (s); s = scm_cdr (s))
- elts.push_back (unsmob_grob (scm_car (s)));
+ elts.push_back (unsmob_grob (scm_car (s)));
}
Interval ext = Axis_group_interface::relative_group_extent (ga ? ga->array () : elts,
- unsmob_grob (common),
- (Axis) scm_to_int (axis));
+ unsmob_grob (common),
+ (Axis) scm_to_int (axis));
return ly_interval2scm (ext);
}
LY_DEFINE (ly_axis_group_interface__add_element, "ly:axis-group-interface::add-element",
- 2, 0, 0, (SCM grob, SCM grob_element),
- "Set @var{grob} the parent of @var{grob-element} on all axes of"
- " @var{grob}.")
+ 2, 0, 0, (SCM grob, SCM grob_element),
+ "Set @var{grob} the parent of @var{grob-element} on all axes of"
+ " @var{grob}.")
{
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_SMOB (Grob, grob_element, 2);
Axis a = (Axis) scm_to_int (scm_car (ax));
if (!e->get_parent (a))
- e->set_parent (me, a);
+ e->set_parent (me, a);
e->set_object ((a == X_AXIS)
- ? ly_symbol2scm ("axis-group-parent-X")
- : ly_symbol2scm ("axis-group-parent-Y"),
- me->self_scm ());
+ ? ly_symbol2scm ("axis-group-parent-X")
+ : ly_symbol2scm ("axis-group-parent-Y"),
+ me->self_scm ());
}
/* must be ordered, because Align_interface also uses
}
Interval
-Axis_group_interface::relative_group_extent (vector<Grob*> const &elts,
- Grob *common, Axis a)
+Axis_group_interface::relative_group_extent (vector<Grob *> const &elts,
+ Grob *common, Axis a)
{
Interval r;
for (vsize i = 0; i < elts.size (); i++)
{
Grob *se = elts[i];
if (!to_boolean (se->get_property ("cross-staff")))
- {
- Interval dims = se->extent (common, a);
- if (!dims.is_empty ())
- r.unite (dims);
- }
+ {
+ Interval dims = se->extent (common, a);
+ if (!dims.is_empty ())
+ r.unite (dims);
+ }
}
return r;
}
Interval
Axis_group_interface::part_of_line_pure_height (Grob *me, bool begin, int start, int end)
{
- Spanner *sp = dynamic_cast<Spanner*> (me);
+ Spanner *sp = dynamic_cast<Spanner *> (me);
SCM cache_symbol = begin
- ? ly_symbol2scm ("begin-of-line-pure-height")
- : ly_symbol2scm ("rest-of-line-pure-height");
+ ? ly_symbol2scm ("begin-of-line-pure-height")
+ : ly_symbol2scm ("rest-of-line-pure-height");
SCM cached = sp->get_cached_pure_property (cache_symbol, start, end);
if (scm_is_pair (cached))
return robust_scm2interval (cached, Interval (0, 0));
else
{
SCM these_pure_heights = begin
- ? scm_car (adjacent_pure_heights)
- : scm_cdr (adjacent_pure_heights);
+ ? scm_car (adjacent_pure_heights)
+ : scm_cdr (adjacent_pure_heights);
if (scm_is_vector (these_pure_heights))
- ret = combine_pure_heights (me, these_pure_heights, start, end);
+ ret = combine_pure_heights (me, these_pure_heights, start, end);
else
- ret = Interval (0, 0);
+ ret = Interval (0, 0);
}
sp->cache_pure_property (cache_symbol, start, end, ly_interval2scm (ret));
{
Paper_score *ps = get_root_system (me)->paper_score ();
vector<vsize> breaks = ps->get_break_indices ();
- vector<Grob*> cols = ps->get_columns ();
+ vector<Grob *> cols = ps->get_columns ();
Interval ext;
for (vsize i = 0; i + 1 < breaks.size (); i++)
{
int r = Paper_column::get_rank (cols[breaks[i]]);
if (r >= end)
- break;
+ break;
if (r >= start)
- ext.unite (ly_scm2interval (scm_c_vector_ref (measure_extents, i)));
+ ext.unite (ly_scm2interval (scm_c_vector_ref (measure_extents, i)));
}
return ext;
Grob *g = elts[i];
if (to_boolean (g->get_property ("cross-staff")))
- continue;
+ continue;
bool outside_staff = scm_is_number (g->get_property ("outside-staff-priority"));
Real padding = robust_scm2double (g->get_property ("outside-staff-padding"), 0.5);
// but only the fact that outside-staff grobs may need to be raised above
// the staff.
if (outside_staff && begin_line_staff_heights.empty ())
- {
- begin_line_staff_heights = begin_line_heights;
- mid_line_staff_heights = mid_line_heights;
- }
+ {
+ begin_line_staff_heights = begin_line_heights;
+ mid_line_staff_heights = mid_line_heights;
+ }
// TODO: consider a pure version of get_grob_direction?
Direction d = to_dir (g->get_property_data ("direction"));
Interval_t<int> rank_span = g->spanned_rank_interval ();
vsize first_break = lower_bound (ranks, (vsize)rank_span[LEFT], less<vsize> ());
if (first_break > 0 && ranks[first_break] >= (vsize)rank_span[LEFT])
- first_break--;
-
- for (vsize j = first_break; j+1 < ranks.size () && (int)ranks[j] <= rank_span[RIGHT]; ++j)
- {
- int start = ranks[j];
- int end = ranks[j+1];
-
- // Take grobs that are visible with respect to a slightly longer line.
- // Otherwise, we will never include grobs at breakpoints which aren't
- // end-of-line-visible.
- int visibility_end = j + 2 < ranks.size () ? ranks[j+2] : end;
-
- if (g->pure_is_visible (start, visibility_end))
- {
- Interval dims = g->pure_height (common, start, end);
- if (!dims.is_empty ())
- {
- if (rank_span[LEFT] <= start)
- {
- if (outside_staff)
- begin_line_heights[j].unite (
- begin_line_staff_heights[j].union_disjoint (dims, padding, d));
- else
- begin_line_heights[j].unite (dims);
- }
+ first_break--;
+
+ for (vsize j = first_break; j + 1 < ranks.size () && (int)ranks[j] <= rank_span[RIGHT]; ++j)
+ {
+ int start = ranks[j];
+ int end = ranks[j + 1];
+
+ // Take grobs that are visible with respect to a slightly longer line.
+ // Otherwise, we will never include grobs at breakpoints which aren't
+ // end-of-line-visible.
+ int visibility_end = j + 2 < ranks.size () ? ranks[j + 2] : end;
+
+ if (g->pure_is_visible (start, visibility_end))
+ {
+ Interval dims = g->pure_height (common, start, end);
+ if (!dims.is_empty ())
+ {
+ if (rank_span[LEFT] <= start)
+ {
+ if (outside_staff)
+ begin_line_heights[j].unite (begin_line_staff_heights[j].union_disjoint (dims, padding, d));
+ else
+ begin_line_heights[j].unite (dims);
+ }
if (rank_span[RIGHT] > start)
- {
- if (outside_staff)
- mid_line_heights[j].unite (
- mid_line_staff_heights[j].union_disjoint (dims, padding, d));
- else
- mid_line_heights[j].unite (dims);
- }
- }
- }
- }
+ {
+ if (outside_staff)
+ mid_line_heights[j].unite (mid_line_staff_heights[j].union_disjoint (dims, padding, d));
+ else
+ mid_line_heights[j].unite (dims);
+ }
+ }
+ }
+ }
}
// Convert begin_line_heights and min_line_heights to SCM.
Grob *g = elts[i];
Interval_t<int> rank_span = g->spanned_rank_interval ();
if (rank_span[LEFT] <= end && rank_span[RIGHT] >= start
- && g->pure_is_visible (start, end)
- && !to_boolean (g->get_property ("cross-staff")))
- {
- Interval dims = g->pure_height (common, start, end);
- if (!dims.is_empty ())
- r.unite (dims);
- }
+ && g->pure_is_visible (start, end)
+ && !to_boolean (g->get_property ("cross-staff")))
+ {
+ Interval dims = g->pure_height (common, start, end);
+ if (!dims.is_empty ())
+ r.unite (dims);
+ }
}
return r;
}
/* Maybe we are in the second pass of a two-pass spacing run. In that
case, the Y-extent of a system is already given to us */
- System *system = dynamic_cast<System*> (me);
+ System *system = dynamic_cast<System *> (me);
if (system)
{
SCM line_break_details = system->column (start)->get_property ("line-break-system-details");
SCM system_y_extent = scm_assq (ly_symbol2scm ("system-Y-extent"), line_break_details);
if (scm_is_pair (system_y_extent))
- return scm_cdr (system_y_extent);
+ return scm_cdr (system_y_extent);
}
return ly_interval2scm (pure_group_height (me, start, end));
{
SCM skyline_scm = elements[i]->get_property ("vertical-skylines");
if (Skyline_pair::unsmob (skyline_scm))
- {
- Real offset = elements[i]->relative_coordinate (y_common, Y_AXIS);
- Skyline_pair other = *Skyline_pair::unsmob (skyline_scm);
- other.raise (offset);
- other.shift (elements[i]->relative_coordinate (x_common, X_AXIS));
- ret.merge (other);
- }
+ {
+ Real offset = elements[i]->relative_coordinate (y_common, Y_AXIS);
+ Skyline_pair other = *Skyline_pair::unsmob (skyline_scm);
+ other.raise (offset);
+ other.shift (elements[i]->relative_coordinate (x_common, X_AXIS));
+ ret.merge (other);
+ }
}
return ret.smobbed_copy ();
}
Axis_group_interface::staff_extent (Grob *me, Grob *refp, Axis ext_a, Grob *staff, Axis parent_a)
{
extract_grob_set (me, "elements", elts);
- vector<Grob*> new_elts;
+ vector<Grob *> new_elts;
for (vsize i = 0; i < elts.size (); i++)
if (elts[i]->common_refpoint (staff, parent_a) == staff)
return relative_group_extent (new_elts, refp, ext_a);
}
-
MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_pure_relevant_grobs, 1);
SCM
Axis_group_interface::calc_pure_relevant_grobs (SCM smob)
extract_grob_set (me, "elements", elts);
- vector<Grob*> relevant_grobs;
+ vector<Grob *> relevant_grobs;
SCM pure_relevant_p = ly_lily_module_constant ("pure-relevant?");
for (vsize i = 0; i < elts.size (); i++)
{
if (to_boolean (scm_apply_1 (pure_relevant_p, elts[i]->self_scm (), SCM_EOL)))
- relevant_grobs.push_back (elts[i]);
-
- if (Item *it = dynamic_cast<Item*> (elts[i]))
- {
- Direction d = LEFT;
- do
- {
- Item *piece = it->find_prebroken_piece (d);
- if (piece && to_boolean (scm_apply_1 (pure_relevant_p, piece->self_scm (), SCM_EOL)))
- relevant_grobs.push_back (piece);
- }
- while (flip (&d) != LEFT);
- }
+ relevant_grobs.push_back (elts[i]);
+
+ if (Item *it = dynamic_cast<Item *> (elts[i]))
+ {
+ Direction d = LEFT;
+ do
+ {
+ Item *piece = it->find_prebroken_piece (d);
+ if (piece && to_boolean (scm_apply_1 (pure_relevant_p, piece->self_scm (), SCM_EOL)))
+ relevant_grobs.push_back (piece);
+ }
+ while (flip (&d) != LEFT);
+ }
}
vector_sort (relevant_grobs, pure_staff_priority_less);
return common->self_scm ();
}
-
MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_x_common, 1);
SCM
Axis_group_interface::calc_x_common (SCM grob)
}
void
-Axis_group_interface::get_children (Grob *me, vector<Grob*> *found)
+Axis_group_interface::get_children (Grob *me, vector<Grob *> *found)
{
found->push_back (me);
}
static bool
-staff_priority_less (Grob * const &g1, Grob * const &g2)
+staff_priority_less (Grob *const &g1, Grob *const &g2)
{
Real priority_1 = robust_scm2double (g1->get_property ("outside-staff-priority"), -infinity_f);
Real priority_2 = robust_scm2double (g2->get_property ("outside-staff-priority"), -infinity_f);
}
static bool
-pure_staff_priority_less (Grob * const &g1, Grob * const &g2)
+pure_staff_priority_less (Grob *const &g1, Grob *const &g2)
{
Real priority_1 = robust_scm2double (g1->get_property ("outside-staff-priority"), -infinity_f);
Real priority_2 = robust_scm2double (g2->get_property ("outside-staff-priority"), -infinity_f);
else if (Grob_array *elements = unsmob_grob_array (me->get_object ("elements")))
{
for (vsize i = 0; i < elements->size (); i++)
- add_boxes (elements->grob (i), x_common, y_common, boxes, skylines);
+ add_boxes (elements->grob (i), x_common, y_common, boxes, skylines);
}
else if (!scm_is_number (me->get_property ("outside-staff-priority"))
- && !to_boolean (me->get_property ("cross-staff")))
+ && !to_boolean (me->get_property ("cross-staff")))
{
boxes->push_back (Box (me->extent (x_common, X_AXIS),
- me->extent (y_common, Y_AXIS)));
+ me->extent (y_common, Y_AXIS)));
}
}
*/
static void
add_grobs_of_one_priority (Skyline_pair *const skylines,
- vector<Grob*> elements,
- Grob *x_common,
- Grob *y_common)
+ vector<Grob *> elements,
+ Grob *x_common,
+ Grob *y_common)
{
vector<Box> boxes;
Drul_array<Real> last_affected_position;
last_affected_position[DOWN] = -infinity_f;
/* do one pass */
for (vsize i = elements.size (); i--;)
- {
- Direction dir = get_grob_direction (elements[i]);
- if (dir == CENTER)
- {
- warning (_ ("an outside-staff object should have a direction, defaulting to up"));
- dir = UP;
- }
-
- Box b (elements[i]->extent (x_common, X_AXIS),
- elements[i]->extent (y_common, Y_AXIS));
- SCM horizon_padding_scm = elements[i]->get_property ("outside-staff-horizontal-padding");
- Real horizon_padding = robust_scm2double (horizon_padding_scm, 0.0);
-
- if (b[X_AXIS][LEFT] - 2*horizon_padding < last_affected_position[dir])
- continue;
-
- if (!b[X_AXIS].is_empty () && !b[Y_AXIS].is_empty ())
- {
- boxes.clear ();
- boxes.push_back (b);
- Skyline other = Skyline (boxes, horizon_padding, X_AXIS, -dir);
- Real padding = robust_scm2double (elements[i]->get_property ("outside-staff-padding"), 0.5);
- Real dist = (*skylines)[dir].distance (other) + padding;
-
- if (dist > 0)
- {
- b.translate (Offset (0, dir*dist));
- elements[i]->translate_axis (dir*dist, Y_AXIS);
- }
- skylines->insert (b, 0, X_AXIS);
- elements[i]->set_property ("outside-staff-priority", SCM_BOOL_F);
- last_affected_position[dir] = b[X_AXIS][RIGHT];
- }
-
- /*
- Ugh: quadratic. --hwn
- */
- elements.erase (elements.begin () + i);
- }
+ {
+ Direction dir = get_grob_direction (elements[i]);
+ if (dir == CENTER)
+ {
+ warning (_ ("an outside-staff object should have a direction, defaulting to up"));
+ dir = UP;
+ }
+
+ Box b (elements[i]->extent (x_common, X_AXIS),
+ elements[i]->extent (y_common, Y_AXIS));
+ SCM horizon_padding_scm = elements[i]->get_property ("outside-staff-horizontal-padding");
+ Real horizon_padding = robust_scm2double (horizon_padding_scm, 0.0);
+
+ if (b[X_AXIS][LEFT] - 2 * horizon_padding < last_affected_position[dir])
+ continue;
+
+ if (!b[X_AXIS].is_empty () && !b[Y_AXIS].is_empty ())
+ {
+ boxes.clear ();
+ boxes.push_back (b);
+ Skyline other = Skyline (boxes, horizon_padding, X_AXIS, -dir);
+ Real padding = robust_scm2double (elements[i]->get_property ("outside-staff-padding"), 0.5);
+ Real dist = (*skylines)[dir].distance (other) + padding;
+
+ if (dist > 0)
+ {
+ b.translate (Offset (0, dir * dist));
+ elements[i]->translate_axis (dir * dist, Y_AXIS);
+ }
+ skylines->insert (b, 0, X_AXIS);
+ elements[i]->set_property ("outside-staff-priority", SCM_BOOL_F);
+ last_affected_position[dir] = b[X_AXIS][RIGHT];
+ }
+
+ /*
+ Ugh: quadratic. --hwn
+ */
+ elements.erase (elements.begin () + i);
+ }
}
}
// that there is no room for the cross-staff grob. It also means, of course, that
// we don't get the benefits of skyline placement for cross-staff grobs.
Skyline_pair
-Axis_group_interface::skyline_spacing (Grob *me, vector<Grob*> elements)
+Axis_group_interface::skyline_spacing (Grob *me, vector<Grob *> elements)
{
/* For grobs with an outside-staff-priority, the sorting function might
call extent and cause suicide. This breaks the contract that is required
Skyline_pair skylines;
for (i = 0; i < elements.size ()
- && !scm_is_number (elements[i]->get_property ("outside-staff-priority")); i++)
+ && !scm_is_number (elements[i]->get_property ("outside-staff-priority")); i++)
if (!(to_boolean (elements[i]->get_property ("cross-staff")) || has_outside_staff_parent (elements[i])))
add_boxes (elements[i], x_common, y_common, &boxes, &skylines);
for (; i < elements.size (); i++)
{
if (to_boolean (elements[i]->get_property ("cross-staff")))
- continue;
+ continue;
SCM priority = elements[i]->get_property ("outside-staff-priority");
- vector<Grob*> current_elts;
+ vector<Grob *> current_elts;
current_elts.push_back (elements[i]);
while (i + 1 < elements.size ()
- && scm_eq_p (elements[i+1]->get_property ("outside-staff-priority"), priority))
- {
- if (!to_boolean (elements[i+1]->get_property ("cross-staff")))
- current_elts.push_back (elements[i+1]);
- ++i;
- }
+ && scm_eq_p (elements[i + 1]->get_property ("outside-staff-priority"), priority))
+ {
+ if (!to_boolean (elements[i + 1]->get_property ("cross-staff")))
+ current_elts.push_back (elements[i + 1]);
+ ++i;
+ }
add_grobs_of_one_priority (&skylines, current_elts, x_common, y_common);
}
if (Skyline_pair *s = Skyline_pair::unsmob (me->get_property ("vertical-skylines")))
{
ret.add_stencil (Lookup::points_to_line_stencil (0.1, (*s)[UP].to_points (X_AXIS))
- .in_color (255, 0, 255));
+ .in_color (255, 0, 255));
ret.add_stencil (Lookup::points_to_line_stencil (0.1, (*s)[DOWN].to_points (X_AXIS))
- .in_color (0, 255, 255));
+ .in_color (0, 255, 255));
}
return ret.smobbed_copy ();
}
Axis_group_interface::calc_pure_staff_staff_spacing (SCM smob, SCM start, SCM end)
{
return calc_maybe_pure_staff_staff_spacing (unsmob_grob (smob),
- true,
- scm_to_int (start),
- scm_to_int (end));
+ true,
+ scm_to_int (start),
+ scm_to_int (end));
}
MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_staff_staff_spacing, 1)
Axis_group_interface::calc_staff_staff_spacing (SCM smob)
{
return calc_maybe_pure_staff_staff_spacing (unsmob_grob (smob),
- false,
- 0,
- INT_MAX);
+ false,
+ 0,
+ INT_MAX);
}
SCM
{
bool within_group = Staff_grouper_interface::maybe_pure_within_group (grouper, me, pure, start, end);
if (within_group)
- return grouper->get_maybe_pure_property ("staff-staff-spacing", pure, start, end);
+ return grouper->get_maybe_pure_property ("staff-staff-spacing", pure, start, end);
else
- return grouper->get_maybe_pure_property ("staffgroup-staff-spacing", pure, start, end);
+ return grouper->get_maybe_pure_property ("staffgroup-staff-spacing", pure, start, end);
}
return me->get_maybe_pure_property ("default-staff-staff-spacing", pure, start, end);
}
}
ADD_INTERFACE (Axis_group_interface,
- "An object that groups other layout objects.",
-
- // TODO: some of these properties are specific to
- // VerticalAxisGroup. We should split off a
- // vertical-axis-group-interface.
- /* properties */
- "adjacent-pure-heights "
- "axes "
- "default-staff-staff-spacing "
- "elements "
- "max-stretch "
- "no-alignment "
- "nonstaff-nonstaff-spacing "
- "nonstaff-relatedstaff-spacing "
- "nonstaff-unrelatedstaff-spacing "
- "pure-relevant-grobs "
- "pure-relevant-items "
- "pure-relevant-spanners "
- "pure-Y-common "
- "staff-affinity "
- "staff-grouper "
- "staff-staff-spacing "
- "system-Y-offset "
- "vertical-skylines "
- "X-common "
- "Y-common "
- );
+ "An object that groups other layout objects.",
+
+ // TODO: some of these properties are specific to
+ // VerticalAxisGroup. We should split off a
+ // vertical-axis-group-interface.
+ /* properties */
+ "adjacent-pure-heights "
+ "axes "
+ "default-staff-staff-spacing "
+ "elements "
+ "max-stretch "
+ "no-alignment "
+ "nonstaff-nonstaff-spacing "
+ "nonstaff-relatedstaff-spacing "
+ "nonstaff-unrelatedstaff-spacing "
+ "pure-relevant-grobs "
+ "pure-relevant-items "
+ "pure-relevant-spanners "
+ "pure-Y-common "
+ "staff-affinity "
+ "staff-grouper "
+ "staff-staff-spacing "
+ "system-Y-offset "
+ "vertical-skylines "
+ "X-common "
+ "Y-common "
+ );
vector<Stream_event *> events_;
void stop_translation_timestep ();
-
- void balloonify (Grob *, Stream_event *);
+
+ void balloonify (Grob *, Stream_event *);
};
IMPLEMENT_TRANSLATOR_LISTENER (Balloon_engraver, annotate_output);
void
Balloon_engraver::balloonify (Grob *g, Stream_event *event)
{
- Grob * b = make_item ("BalloonTextItem", event->self_scm ());
+ Grob *b = make_item ("BalloonTextItem", event->self_scm ());
b->set_property ("text", event->get_property ("text"));
b->set_parent (g, Y_AXIS);
b->set_parent (g, X_AXIS);
Balloon_engraver::acknowledge_grob (Grob_info info)
{
Stream_event *cause = info.event_cause ();
-
+
SCM arts = cause ? cause->get_property ("articulations") : SCM_EOL;
for (SCM s = arts; scm_is_pair (s); s = scm_cdr (s))
{
Stream_event *e = unsmob_stream_event (scm_car (s));
if (e->in_event_class ("annotate-output-event"))
- {
- balloonify (info.grob (), e);
- }
+ {
+ balloonify (info.grob (), e);
+ }
}
for (vsize i = 0; i < events_.size (); i++)
{
if (info.grob ()->name () == ly_symbol2string (events_[i]->get_property ("symbol")))
- balloonify (info.grob (), events_[i]);
+ balloonify (info.grob (), events_[i]);
}
}
-
-
ADD_ACKNOWLEDGER (Balloon_engraver, grob);
-
+
ADD_TRANSLATOR (Balloon_engraver,
- /* doc */
- "Create balloon texts.",
+ /* doc */
+ "Create balloon texts.",
- /* create */
- "BalloonTextItem ",
+ /* create */
+ "BalloonTextItem ",
- /*read*/
- "",
+ /*read*/
+ "",
- /*write*/
- ""
- );
+ /*write*/
+ ""
+ );
Grob *p = me->get_parent (X_AXIS);
Offset off (me->relative_coordinate (p, X_AXIS),
- me->relative_coordinate (p, Y_AXIS));
+ me->relative_coordinate (p, Y_AXIS));
return internal_balloon_print (me, p, off);
}
if (orig)
{
- Direction spanner_placement = robust_scm2dir (me->get_property ("spanner-placement"), LEFT);
+ Direction spanner_placement = robust_scm2dir (me->get_property ("spanner-placement"), LEFT);
Spanner *wanted = (spanner_placement != RIGHT)
- ? orig->broken_intos_[0]
- : orig->broken_intos_.back ();
+ ? orig->broken_intos_[0]
+ : orig->broken_intos_.back ();
if (me != wanted)
return SCM_EOL;
}
-
Spanner *p = dynamic_cast<Spanner *> (me->get_parent (Y_AXIS));
if (!p)
return SCM_EOL;
Offset off (me->relative_coordinate (me->get_bound (LEFT), X_AXIS),
- me->relative_coordinate (p, Y_AXIS));
+ me->relative_coordinate (p, Y_AXIS));
return internal_balloon_print (me, p, off);
}
Balloon_interface::internal_balloon_print (Grob *me, Grob *p, Offset off)
{
Box b (p->extent (p, X_AXIS),
- p->extent (p, Y_AXIS));
+ p->extent (p, Y_AXIS));
Real padding = robust_scm2double (me->get_property ("padding"), .1);
b.widen (padding, padding);
SCM stencil = Text_interface::interpret_markup (me->layout ()->self_scm (),
chain, bt);
Stencil *text_stil = unsmob_stencil (stencil);
-
+
Offset z1;
for (int i = X_AXIS; i < NO_AXES; i++)
}
ADD_INTERFACE (Balloon_interface,
- "A collection of routines to put text balloons around an"
- " object.",
-
- /* properties */
- "annotation-balloon "
- "annotation-line "
- "padding "
- "spanner-placement "
- "text "
- );
+ "A collection of routines to put text balloons around an"
+ " object.",
+
+ /* properties */
+ "annotation-balloon "
+ "annotation-line "
+ "padding "
+ "spanner-placement "
+ "text "
+ );
SCM check = tr->get_property ("ignoreBarChecks");
if (to_boolean (check))
- return;
+ return;
SCM mp = tr->get_property ("measurePosition");
SCM sync = tr->get_property ("barCheckSynchronize");
Moment *where = unsmob_moment (mp);
if (!where)
- return;
+ return;
if (where->main_part_)
- {
- bool warn = true;
- if (to_boolean (sync))
- {
- SCM mp;
- tr = tr->where_defined (ly_symbol2scm ("measurePosition"), &mp);
- Moment zero;
- tr->set_property ("measurePosition", zero.smobbed_copy ());
- }
- else
- {
- SCM lf = tr->get_property ("barCheckLastFail");
- if (unsmob_moment (lf)
- && *unsmob_moment (lf) == *where)
- warn = false;
- else
- tr->set_property ("barCheckLastFail", mp);
- }
+ {
+ bool warn = true;
+ if (to_boolean (sync))
+ {
+ SCM mp;
+ tr = tr->where_defined (ly_symbol2scm ("measurePosition"), &mp);
+ Moment zero;
+ tr->set_property ("measurePosition", zero.smobbed_copy ());
+ }
+ else
+ {
+ SCM lf = tr->get_property ("barCheckLastFail");
+ if (unsmob_moment (lf)
+ && *unsmob_moment (lf) == *where)
+ warn = false;
+ else
+ tr->set_property ("barCheckLastFail", mp);
+ }
- if (warn)
- get_music ()->origin ()->warning (_f ("barcheck failed at: %s",
- where->to_string ()));
- }
+ if (warn)
+ get_music ()->origin ()->warning (_f ("barcheck failed at: %s",
+ where->to_string ()));
+ }
}
}
void create_bar ();
Item *bar_;
- vector<Spanner*> spanners_;
+ vector<Spanner *> spanners_;
};
Bar_engraver::Bar_engraver ()
bar_ = make_item ("BarLine", SCM_EOL);
SCM gl = get_property ("whichBar");
if (scm_equal_p (gl, bar_->get_property ("glyph")) != SCM_BOOL_T)
- bar_->set_property ("glyph", gl);
+ bar_->set_property ("glyph", gl);
}
}
Grob *g = gi.grob ();
if (to_boolean (g->get_property ("to-barline")))
- spanners_.push_back (dynamic_cast<Spanner*> (g));
+ spanners_.push_back (dynamic_cast<Spanner *> (g));
}
ADD_END_ACKNOWLEDGER (Bar_engraver, spanner);
ADD_TRANSLATOR (Bar_engraver,
- /* doc */
- "Create barlines. This engraver is controlled through the"
- " @code{whichBar} property. If it has no bar line to create,"
- " it will forbid a linebreak at this point.",
+ /* doc */
+ "Create barlines. This engraver is controlled through the"
+ " @code{whichBar} property. If it has no bar line to create,"
+ " it will forbid a linebreak at this point.",
- /* create */
- "BarLine ",
+ /* create */
+ "BarLine ",
- /* read */
- "whichBar ",
+ /* read */
+ "whichBar ",
- /* write */
- "forbidBreak "
- );
+ /* write */
+ "forbidBreak "
+ );
string str = ly_scm2string (s);
Interval ex = ly_scm2interval (extent);
if (ex.length () > 0)
- {
- Stencil result = compound_barline (me, str, ex, false);
+ {
+ Stencil result = compound_barline (me, str, ex, false);
- return result.smobbed_copy ();
- }
+ return result.smobbed_copy ();
+ }
}
return SCM_EOL;
}
Stencil
Bar_line::compound_barline (Grob *me, string str, Interval const &extent,
- bool rounded)
+ bool rounded)
{
Real kern = robust_scm2double (me->get_property ("kern"), 1);
Real thinkern = robust_scm2double (me->get_property ("thin-kern"), 1);
else if (str == "||")
{
/*
- should align to other side? this never appears
- on the system-start?
- m.add_at_edge (X_AXIS, RIGHT, thin, 0);
- m.add_at_edge (X_AXIS, RIGHT, thin, thinkern);
+ should align to other side? this never appears
+ on the system-start?
+ m.add_at_edge (X_AXIS, RIGHT, thin, 0);
+ m.add_at_edge (X_AXIS, RIGHT, thin, thinkern);
*/
m.add_at_edge (X_AXIS, LEFT, thin, thinkern);
m.add_at_edge (X_AXIS, RIGHT, thin, thinkern);
segno.add_stencil (Font_interface::get_default_font (me)->find_by_name ("scripts.varsegno"));
if (str == "S")
- m.add_stencil (segno);
+ m.add_stencil (segno);
else if (str == "S|:" || str == ".S|:")
- {
- m.add_at_edge (X_AXIS, RIGHT, thick, 0);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- m.add_at_edge (X_AXIS, LEFT, segno, thinkern);
- }
+ {
+ m.add_at_edge (X_AXIS, RIGHT, thick, 0);
+ m.add_at_edge (X_AXIS, RIGHT, thin, kern);
+ m.add_at_edge (X_AXIS, RIGHT, colon, kern);
+ m.add_at_edge (X_AXIS, LEFT, segno, thinkern);
+ }
else if (str == ":|S" || str == ":|S.")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- m.add_at_edge (X_AXIS, RIGHT, segno, thinkern);
- }
+ {
+ m.add_at_edge (X_AXIS, LEFT, thick, 0);
+ m.add_at_edge (X_AXIS, LEFT, thin, kern);
+ m.add_at_edge (X_AXIS, LEFT, colon, kern);
+ m.add_at_edge (X_AXIS, RIGHT, segno, thinkern);
+ }
else if (str == ":|S|:" || str == ":|S.|:")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- m.add_at_edge (X_AXIS, RIGHT, segno, thinkern);
- m.add_at_edge (X_AXIS, RIGHT, thick, thinkern);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- }
+ {
+ m.add_at_edge (X_AXIS, LEFT, thick, 0);
+ m.add_at_edge (X_AXIS, LEFT, thin, kern);
+ m.add_at_edge (X_AXIS, LEFT, colon, kern);
+ m.add_at_edge (X_AXIS, RIGHT, segno, thinkern);
+ m.add_at_edge (X_AXIS, RIGHT, thick, thinkern);
+ m.add_at_edge (X_AXIS, RIGHT, thin, kern);
+ m.add_at_edge (X_AXIS, RIGHT, colon, kern);
+ }
else if (str == "|._.|") // :|S|: or :|S.|: without segno and colon
- {
- // get the width of the segno sign
- Real segno_width = segno.extent (X_AXIS).length ();
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, thick, segno_width + 2 * thinkern);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- }
+ {
+ // get the width of the segno sign
+ Real segno_width = segno.extent (X_AXIS).length ();
+ m.add_at_edge (X_AXIS, LEFT, thick, 0);
+ m.add_at_edge (X_AXIS, LEFT, thin, kern);
+ m.add_at_edge (X_AXIS, RIGHT, thick, segno_width + 2 * thinkern);
+ m.add_at_edge (X_AXIS, RIGHT, thin, kern);
+ }
// end varsegno block
}
else if (str == ":")
{
if (Grob *staff = Staff_symbol_referencer::get_staff_symbol (me))
- {
- Interval staff_extent = staff->extent (staff, Y_AXIS);
-
- /*
- assume staff lines are disposed equally at unit space;
- put a dot into each space within extent (may extend staff_extent).
-
- staff_extent is an interval of two integers or two half-integers;
- in the former case dots are to be placed at half-integers,
- in the latter at integers.
-
- these integers are not exact due to staff line thickness.
- */
- int const pos = int (rint (staff_extent.at (UP) * 2));
- Real const correction = pos & 1 ? 0.0 : 0.5;
-
- for (int i = int (rint (extent.at (DOWN) + (0.5 - correction))),
- e = int (rint (extent.at (UP) + (0.5 - correction)));
- i < e;
- ++i)
- {
- Stencil d (dot);
-
- d.translate_axis (i + correction, Y_AXIS);
- m.add_stencil (d);
- }
- }
+ {
+ Interval staff_extent = staff->extent (staff, Y_AXIS);
+
+ /*
+ assume staff lines are disposed equally at unit space;
+ put a dot into each space within extent (may extend staff_extent).
+
+ staff_extent is an interval of two integers or two half-integers;
+ in the former case dots are to be placed at half-integers,
+ in the latter at integers.
+
+ these integers are not exact due to staff line thickness.
+ */
+ int const pos = int (rint (staff_extent.at (UP) * 2));
+ Real const correction = pos & 1 ? 0.0 : 0.5;
+
+ for (int i = int (rint (extent.at (DOWN) + (0.5 - correction))),
+ e = int (rint (extent.at (UP) + (0.5 - correction)));
+ i < e;
+ ++i)
+ {
+ Stencil d (dot);
+
+ d.translate_axis (i + correction, Y_AXIS);
+ m.add_stencil (d);
+ }
+ }
}
else if (str == "dashed")
m = dashed_bar_line (me, extent, hair);
Stencil
Bar_line::simple_barline (Grob *me,
- Real w,
- Interval const &extent,
- bool rounded)
+ Real w,
+ Interval const &extent,
+ bool rounded)
{
Real blot
= rounded
- ? me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"))
- : 0.0;
+ ? me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"))
+ : 0.0;
return Lookup::round_filled_box (Box (Interval (0, w), extent), blot);
}
Real blot
= rounded
- ? me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"))
- : 0.0;
+ ? me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"))
+ : 0.0;
return Lookup::round_filled_box (Box (Interval (0, line_thick),
- Interval (h - th, h + th)), blot);
+ Interval (h - th, h + th)), blot);
}
Stencil
if (fabs (h / ss - dashes) < 0.1)
{
Real blot
- = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
+ = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
Real const half_dash = dash_size / 2;
Stencil bar;
for (int i = 0; i <= dashes; ++i)
- {
- Real top_y = extent.at (DOWN)
- + (i == dashes ? h : (i + half_dash) * ss);
- Real bot_y = extent.at (DOWN) + (i ? (i - half_dash) * ss : 0.0);
-
- bar.add_stencil (Lookup::round_filled_box (Box (Interval (0, thick),
- Interval (bot_y, top_y)),
- blot));
- }
+ {
+ Real top_y = extent.at (DOWN)
+ + (i == dashes ? h : (i + half_dash) * ss);
+ Real bot_y = extent.at (DOWN) + (i ? (i - half_dash) * ss : 0.0);
+
+ bar.add_stencil (Lookup::round_filled_box (Box (Interval (0, thick),
+ Interval (bot_y, top_y)),
+ blot));
+ }
return bar;
}
else
{
/*
- We have to scale the dashing so it starts and ends with half a
- dash exactly.
+ We have to scale the dashing so it starts and ends with half a
+ dash exactly.
*/
Real total_dash_size = h / dashes;
Real factor = (dash_size - thick) / ss;
SCM at = scm_list_n (ly_symbol2scm ("dashed-line"),
- scm_from_double (thick),
- scm_from_double (factor * total_dash_size),
- scm_from_double ((1 - factor) * total_dash_size),
- scm_from_double (0),
- scm_from_double (h),
- scm_from_double (factor * total_dash_size * 0.5),
- SCM_UNDEFINED);
+ scm_from_double (thick),
+ scm_from_double (factor * total_dash_size),
+ scm_from_double ((1 - factor) * total_dash_size),
+ scm_from_double (0),
+ scm_from_double (h),
+ scm_from_double (factor * total_dash_size * 0.5),
+ SCM_UNDEFINED);
Box box;
box.add_point (Offset (0, 0));
}
ADD_INTERFACE (Bar_line,
- "Bar line.\n"
- "\n"
- "Print a special bar symbol. It replaces the regular bar"
- " symbol with a special symbol. The argument @var{bartype}"
- " is a string which specifies the kind of bar line to print."
- " Options are @code{|}, @code{:|}, @code{|:}, @code{:|:}, @code{:|.|:},"
- " @code{:|.:}, @code{.}, @code{||}, @code{|.}, @code{.|}, @code{.|.},"
- " @code{|.|}, @code{:}, @code{dashed}, @code{'} and @code{S}.\n"
- "\n"
- "These produce, respectively, a normal bar line, a right repeat, a left repeat,"
- " a thick double repeat, a thin-thick-thin double repeat,"
- " a thin-thick double repeat, a thick bar, a double bar, a start bar,"
- " an end bar, a thick double bar, a thin-thick-thin bar,"
- " a dotted bar, a dashed bar, a tick as bar line and a segno bar.\n"
- "\n"
- "In addition, there is an option"
- " @code{||:} which is equivalent to @code{|:} except at line"
- " breaks, where it produces a double bar (@code{||}) at the"
- " end of the line and a repeat sign (@code{|:}) at the"
- " beginning of the new line.\n"
- "\n"
- "For segno, @code{S} produces a segno sign except at line breaks,"
- " where it produces a double bar (@code{||}) at the"
- " end of the line and a segno sign at the beginning of the new line."
- " @code{|S} is equivalent to @code{S} but produces a simple bar line"
- " (@code{|}) instead of a double bar line (@code{||}) at line breaks."
- " @code{S|} produces the segno sign at line breaks and starts the following"
- " line without special bar lines.\n"
- "\n"
- "@code{S|:} and @code{:|S} are used for repeat/segno combinations that are"
- " separated at line breaks. Alternatively, @code{.S|:} and @code{:|S.}"
- " may be used which combine repeat signs and segno at the same line in"
- " case of a line break. @code{:|S|:} is a combination of a left repeat"
- " (@code{:|}), a segno (@code{S}) and a right repeat @code{|:} which"
- " splits before the segno at line breaks; @code{:|S.|:} splits after"
- " the segno sign.\n"
- "\n"
- "If @var{bartype} is set to @code{empty} then nothing is"
- " printed, but a line break is allowed at that spot.\n"
- "\n"
- "@code{gap} is used for the gaps in dashed bar lines.",
-
- /* properties */
- "allow-span-bar "
- "gap "
- "kern "
- "thin-kern "
- "hair-thickness "
- "thick-thickness "
- "glyph "
- "glyph-name "
- "bar-extent "
- );
+ "Bar line.\n"
+ "\n"
+ "Print a special bar symbol. It replaces the regular bar"
+ " symbol with a special symbol. The argument @var{bartype}"
+ " is a string which specifies the kind of bar line to print."
+ " Options are @code{|}, @code{:|}, @code{|:}, @code{:|:}, @code{:|.|:},"
+ " @code{:|.:}, @code{.}, @code{||}, @code{|.}, @code{.|}, @code{.|.},"
+ " @code{|.|}, @code{:}, @code{dashed}, @code{'} and @code{S}.\n"
+ "\n"
+ "These produce, respectively, a normal bar line, a right repeat, a left repeat,"
+ " a thick double repeat, a thin-thick-thin double repeat,"
+ " a thin-thick double repeat, a thick bar, a double bar, a start bar,"
+ " an end bar, a thick double bar, a thin-thick-thin bar,"
+ " a dotted bar, a dashed bar, a tick as bar line and a segno bar.\n"
+ "\n"
+ "In addition, there is an option"
+ " @code{||:} which is equivalent to @code{|:} except at line"
+ " breaks, where it produces a double bar (@code{||}) at the"
+ " end of the line and a repeat sign (@code{|:}) at the"
+ " beginning of the new line.\n"
+ "\n"
+ "For segno, @code{S} produces a segno sign except at line breaks,"
+ " where it produces a double bar (@code{||}) at the"
+ " end of the line and a segno sign at the beginning of the new line."
+ " @code{|S} is equivalent to @code{S} but produces a simple bar line"
+ " (@code{|}) instead of a double bar line (@code{||}) at line breaks."
+ " @code{S|} produces the segno sign at line breaks and starts the following"
+ " line without special bar lines.\n"
+ "\n"
+ "@code{S|:} and @code{:|S} are used for repeat/segno combinations that are"
+ " separated at line breaks. Alternatively, @code{.S|:} and @code{:|S.}"
+ " may be used which combine repeat signs and segno at the same line in"
+ " case of a line break. @code{:|S|:} is a combination of a left repeat"
+ " (@code{:|}), a segno (@code{S}) and a right repeat @code{|:} which"
+ " splits before the segno at line breaks; @code{:|S.|:} splits after"
+ " the segno sign.\n"
+ "\n"
+ "If @var{bartype} is set to @code{empty} then nothing is"
+ " printed, but a line break is allowed at that spot.\n"
+ "\n"
+ "@code{gap} is used for the gaps in dashed bar lines.",
+
+ /* properties */
+ "allow-span-bar "
+ "gap "
+ "kern "
+ "thin-kern "
+ "hair-thickness "
+ "thick-thickness "
+ "glyph "
+ "glyph-name "
+ "bar-extent "
+ );
{
Moment mp (robust_scm2moment (get_property ("measurePosition"), Moment (0)));
if (mp.main_part_ == Rational (0))
- {
- SCM bn = get_property ("currentBarNumber");
- SCM proc = get_property ("barNumberVisibility");
- if (scm_is_number (bn) && ly_is_procedure (proc)
- && to_boolean (scm_call_1 (proc, bn)))
- {
- create_items ();
- // guh.
- text_->set_property
- ("text", scm_number_to_string (bn, scm_from_int (10)));
- }
- }
+ {
+ SCM bn = get_property ("currentBarNumber");
+ SCM proc = get_property ("barNumberVisibility");
+ if (scm_is_number (bn) && ly_is_procedure (proc)
+ && to_boolean (scm_call_1 (proc, bn)))
+ {
+ create_items ();
+ // guh.
+ text_->set_property
+ ("text", scm_number_to_string (bn, scm_from_int (10)));
+ }
+ }
}
}
if (text_)
{
text_->set_object ("side-support-elements",
- grob_list_to_grob_array (get_property ("stavesFound")));
+ grob_list_to_grob_array (get_property ("stavesFound")));
text_ = 0;
}
}
text_ = make_item ("BarNumber", SCM_EOL);
}
-
ADD_ACKNOWLEDGER (Bar_number_engraver, break_alignment);
ADD_TRANSLATOR (Bar_number_engraver,
- /* doc */
- "A bar number is created whenever @code{measurePosition} is"
- " zero and when there is a bar line (i.e., when"
- " @code{whichBar} is set). It is put on top of all staves,"
- " and appears only at the left side of the staff. The staves"
- " are taken from @code{stavesFound}, which is maintained by"
- " @ref{Staff_collecting_engraver}.",
-
- /* create */
- "BarNumber ",
-
- /* read */
- "currentBarNumber "
- "whichBar "
- "stavesFound "
- "barNumberVisibility ",
-
- /* write */
- ""
- );
+ /* doc */
+ "A bar number is created whenever @code{measurePosition} is"
+ " zero and when there is a bar line (i.e., when"
+ " @code{whichBar} is set). It is put on top of all staves,"
+ " and appears only at the left side of the staff. The staves"
+ " are taken from @code{stavesFound}, which is maintained by"
+ " @ref{Staff_collecting_engraver}.",
+
+ /* create */
+ "BarNumber ",
+
+ /* read */
+ "currentBarNumber "
+ "whichBar "
+ "stavesFound "
+ "barNumberVisibility ",
+
+ /* write */
+ ""
+ );
ADD_ACKNOWLEDGER (Beam_collision_engraver, beam);
ADD_TRANSLATOR (Beam_collision_engraver,
- /* doc */
- "Help beams avoid colliding with notes and clefs in other voices.",
+ /* doc */
+ "Help beams avoid colliding with notes and clefs in other voices.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
{
int inner_dy = positions[i] - positions[i - 1];
if (sign (inner_dy) != sign (dy)
- && (beam_dir * positions[i] >= closest
- || beam_dir * positions[i - 1] >= closest))
- concave = true;
+ && (beam_dir * positions[i] >= closest
+ || beam_dir * positions[i - 1] >= closest))
+ concave = true;
}
bool all_closer = true;
for (vsize i = 1; all_closer && i + 1 < positions.size (); i++)
{
all_closer = all_closer
- && (beam_dir * positions[i] > closest);
+ && (beam_dir * positions[i] > closest);
}
concave = concave || all_closer;
return concaveness;
}
-
MAKE_SCHEME_CALLBACK (Beam, calc_concaveness, 1);
SCM
Beam::calc_concaveness (SCM smob)
{
Grob *me = unsmob_grob (smob);
- vector<Grob*> stems
+ vector<Grob *> stems
= extract_grob_array (me, "stems");
if (is_knee (me))
for (vsize i = stems.size (); i--;)
{
if (Stem::is_normal_stem (stems[i]))
- {
- if (Direction dir = get_grob_direction (stems[i]))
- beam_dir = dir;
- }
+ {
+ if (Direction dir = get_grob_direction (stems[i]))
+ beam_dir = dir;
+ }
else
- stems.erase (stems.begin () + i);
+ stems.erase (stems.begin () + i);
}
if (stems.size () <= 2)
for (vsize i = 0; i < stems.size (); i++)
{
/*
- For chords, we take the note head that is closest to the beam.
+ For chords, we take the note head that is closest to the beam.
- Hmmm.. wait, for the beams in the last measure of morgenlied,
- this doesn't look so good. Let's try the heads farthest from
- the beam.
+ Hmmm.. wait, for the beams in the last measure of morgenlied,
+ this doesn't look so good. Let's try the heads farthest from
+ the beam.
*/
Interval posns = Stem::head_positions (stems[i]);
else
{
concaveness = (calc_positions_concaveness (far_positions, beam_dir)
- + calc_positions_concaveness (close_positions, beam_dir)) / 2;
+ + calc_positions_concaveness (close_positions, beam_dir)) / 2;
}
return scm_from_double (concaveness);
}
-
-
Direction updown = to_dir (ev->get_property ("direction"));
if (updown)
- forced_direction_ = updown;
+ forced_direction_ = updown;
}
else if (d == STOP && valid_end_point ())
ASSIGN_EVENT_ONCE (stop_ev_, ev);
if (start_ev_)
{
if (beam_)
- {
- start_ev_->origin ()->warning (_ ("already have a beam"));
- return;
- }
+ {
+ start_ev_->origin ()->warning (_ ("already have a beam"));
+ return;
+ }
set_melisma (true);
prev_start_ev_ = start_ev_;
beam_ = make_spanner ("Beam", start_ev_->self_scm ());
Moment mp (robust_scm2moment (get_property ("measurePosition"),
- Moment (0)));
+ Moment (0)));
beam_start_location_ = mp;
beam_start_mom_ = now_mom ();
if (finished_beam_)
{
if (!finished_beam_->get_bound (RIGHT))
- finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
+ finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
if (forced_direction_)
- {
- Grob *stem = finished_beam_->get_bound (RIGHT);
- set_grob_direction (stem, forced_direction_);
- forced_direction_ = CENTER;
- }
+ {
+ Grob *stem = finished_beam_->get_bound (RIGHT);
+ set_grob_direction (stem, forced_direction_);
+ forced_direction_ = CENTER;
+ }
finished_beam_info_->beamify (finished_beaming_options_);
Beam::set_beaming (finished_beam_, finished_beam_info_);
prev_start_ev_->origin ()->warning (_ ("unterminated beam"));
/*
- we don't typeset it, (we used to, but it was commented
- out. Reason unknown) */
+ we don't typeset it, (we used to, but it was commented
+ out. Reason unknown) */
beam_->suicide ();
delete beam_info_;
}
if (beam_
&& !scm_is_number (info.grob ()->get_property_data ("staff-position")))
chain_offset_callback (info.grob (),
- Beam::rest_collision_callback_proc, Y_AXIS);
+ Beam::rest_collision_callback_proc, Y_AXIS);
}
void
ev->origin ()->warning (_ ("stem does not fit in beam"));
prev_start_ev_->origin ()->warning (_ ("beam was started here"));
/*
- don't return, since
+ don't return, since
- [r4 c8] can just as well be modern notation.
+ [r4 c8] can just as well be modern notation.
*/
}
stem->set_property ("duration-log", scm_from_int (durlog));
Moment stem_location = now - beam_start_mom_ + beam_start_location_;
beam_info_->add_stem (stem_location,
- max (durlog- 2, 0),
- Stem::is_invisible (stem));
+ max (durlog - 2, 0),
+ Stem::is_invisible (stem));
Beam::add_stem (beam_, stem);
}
ADD_ACKNOWLEDGER (Beam_engraver, rest);
ADD_TRANSLATOR (Beam_engraver,
- /* doc */
- "Handle @code{Beam} events by engraving beams. If omitted,"
- " then notes are printed with flags instead of beams.",
+ /* doc */
+ "Handle @code{Beam} events by engraving beams. If omitted,"
+ " then notes are printed with flags instead of beams.",
- /* create */
- "Beam ",
+ /* create */
+ "Beam ",
- /* read */
+ /* read */
"baseMoment "
- "beamMelismaBusy "
- "beatStructure "
- "subdivideBeams ",
+ "beamMelismaBusy "
+ "beatStructure "
+ "subdivideBeams ",
- /* write */
- "forbidBreak"
- );
+ /* write */
+ "forbidBreak"
+ );
class Grace_beam_engraver : public Beam_engraver
{
stop_ev_ = ev;
}
-
ADD_ACKNOWLEDGER (Grace_beam_engraver, stem);
ADD_ACKNOWLEDGER (Grace_beam_engraver, rest);
ADD_TRANSLATOR (Grace_beam_engraver,
- /* doc */
- "Handle @code{Beam} events by engraving beams. If omitted,"
- " then notes are printed with flags instead of beams. Only"
- " engraves beams when we are at grace points in time.",
+ /* doc */
+ "Handle @code{Beam} events by engraving beams. If omitted,"
+ " then notes are printed with flags instead of beams. Only"
+ " engraves beams when we are at grace points in time.",
- /* create */
- "Beam ",
+ /* create */
+ "Beam ",
- /* read */
+ /* read */
"baseMoment "
- "beamMelismaBusy "
- "beatStructure "
- "subdivideBeams ",
+ "beamMelismaBusy "
+ "beatStructure "
+ "subdivideBeams ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "beam-scoring-problem.hh"
#include <algorithm>
-#include <queue>
+#include <queue>
#include <set>
using namespace std;
demerits += demerit;
#if DEBUG_BEAM_SCORING
- if (demerit)
+ if (demerit)
score_card_ += to_string (" %s %.2f", reason.c_str (), demerit);
#endif
}
-
-Beam_configuration* Beam_configuration::new_config (Interval start,
+
+Beam_configuration *Beam_configuration::new_config (Interval start,
Interval offset)
{
- Beam_configuration* qs = new Beam_configuration;
+ Beam_configuration *qs = new Beam_configuration;
qs->y = Interval (int (start[LEFT]) + offset[LEFT],
int (start[RIGHT]) + offset[RIGHT]);
Real start_score = abs (offset[RIGHT]) + abs (offset[LEFT]);
qs->demerits = start_score / 1000.0;
qs->next_scorer_todo = ORIGINAL_DISTANCE + 1;
-
+
return qs;
}
Real
-Beam_scoring_problem::y_at (Real x, Beam_configuration const* p) const {
- return p->y[LEFT] + (x - x_span[LEFT]) * p->y.delta() / x_span.delta();
+Beam_scoring_problem::y_at (Real x, Beam_configuration const *p) const
+{
+ return p->y[LEFT] + (x - x_span[LEFT]) * p->y.delta () / x_span.delta ();
}
/****************************************************************/
// priority queue on the beams to score.
static int score_count = 0;
LY_DEFINE (ly_beam_score_count, "ly:beam-score-count", 0, 0, 0,
- (),
- "count number of beam scores.") {
+ (),
+ "count number of beam scores.")
+{
return scm_from_int (score_count);
}
void Beam_scoring_problem::add_collision (Real x, Interval y,
Real score_factor)
{
- if (edge_dirs[LEFT] == edge_dirs[RIGHT]) {
- Direction d = edge_dirs[LEFT];
+ if (edge_dirs[LEFT] == edge_dirs[RIGHT])
+ {
+ Direction d = edge_dirs[LEFT];
- Real quant_range_y = quant_range[LEFT][-d] +
- (x - x_span[LEFT]) * (quant_range[RIGHT][-d] - quant_range[LEFT][-d]) / x_span.delta();
+ Real quant_range_y = quant_range[LEFT][-d]
+ + (x - x_span[LEFT]) * (quant_range[RIGHT][-d] - quant_range[LEFT][-d]) / x_span.delta ();
- if (d*(quant_range_y - minmax(d, y[UP], y[DOWN])) > 0) {
- return;
+ if (d * (quant_range_y - minmax (d, y[UP], y[DOWN])) > 0)
+ {
+ return;
+ }
}
- }
Beam_collision c;
c.beam_y_.set_empty ();
for (vsize j = 0; j < segments_.size (); j++)
{
- if (segments_[j].horizontal_.contains(x))
+ if (segments_[j].horizontal_.contains (x))
c.beam_y_.add_point (segments_[j].vertical_count_ * beam_translation);
if (segments_[j].horizontal_[LEFT] > x)
break;
}
c.beam_y_.widen (0.5 * beam_thickness);
-
+
c.x_ = x;
- y *= 1/staff_space;
+ y *= 1 / staff_space;
c.y_ = y;
c.base_penalty_ = score_factor;
collisions_.push_back (c);
}
-void Beam_scoring_problem::init_collisions (vector<Grob*> grobs)
+void Beam_scoring_problem::init_collisions (vector<Grob *> grobs)
{
- Grob* common_x = NULL;
+ Grob *common_x = NULL;
segments_ = Beam::get_beam_segments (beam, &common_x);
vector_sort (segments_, beam_segment_less);
if (common[X_AXIS] != common_x)
return;
}
- set<Grob*> stems;
- for (vsize i = 0; i < grobs.size (); i++) {
- Box b;
- for (Axis a = X_AXIS; a < NO_AXES; incr (a))
- b[a] = grobs[i]->extent(common[a], a);
+ set<Grob *> stems;
+ for (vsize i = 0; i < grobs.size (); i++)
+ {
+ Box b;
+ for (Axis a = X_AXIS; a < NO_AXES; incr (a))
+ b[a] = grobs[i]->extent (common[a], a);
- Real width = b[X_AXIS].length ();
- Real width_factor = sqrt (width / staff_space);
+ Real width = b[X_AXIS].length ();
+ Real width_factor = sqrt (width / staff_space);
- Direction d = LEFT;
- do
- add_collision (b[X_AXIS][d], b[Y_AXIS], width_factor);
- while (flip (&d) != LEFT);
+ Direction d = LEFT;
+ do
+ add_collision (b[X_AXIS][d], b[Y_AXIS], width_factor);
+ while (flip (&d) != LEFT);
- Grob* stem = unsmob_grob (grobs[i]->get_object ("stem"));
- if (stem && Stem::has_interface (stem) && Stem::is_normal_stem (stem))
- {
- stems.insert (stem);
- }
- }
-
- for (set<Grob*>::const_iterator it(stems.begin ()); it != stems.end (); it++)
+ Grob *stem = unsmob_grob (grobs[i]->get_object ("stem"));
+ if (stem && Stem::has_interface (stem) && Stem::is_normal_stem (stem))
+ {
+ stems.insert (stem);
+ }
+ }
+
+ for (set<Grob *>::const_iterator it (stems.begin ()); it != stems.end (); it++)
{
Grob *s = *it;
- Real x = s->extent (common[X_AXIS], X_AXIS).center();
+ Real x = s->extent (common[X_AXIS], X_AXIS).center ();
Direction stem_dir = get_grob_direction (*it);
Interval y;
y.set_full ();
y[-stem_dir] = Stem::chord_start_y (*it) + (*it)->relative_coordinate (common[Y_AXIS], Y_AXIS)
- - beam->relative_coordinate (common[Y_AXIS], Y_AXIS);
+ - beam->relative_coordinate (common[Y_AXIS], Y_AXIS);
Real factor = parameters.STEM_COLLISION_FACTOR;
if (!unsmob_grob (s->get_object ("beam"))
&& !Stem::flag (s).is_empty ())
- factor = 1.0;
+ factor = 1.0;
add_collision (x, y, factor);
}
}
-
+
void Beam_scoring_problem::init_stems ()
{
extract_grob_set (beam, "covered-grobs", collisions);
common[a] = common_refpoint_of_array (stems, beam, Axis (a));
common[a] = common_refpoint_of_array (collisions, common[a], Axis (a));
}
-
- Drul_array<Grob *> edge_stems(Beam::first_normal_stem (beam),
- Beam::last_normal_stem (beam));
+
+ Drul_array<Grob *> edge_stems (Beam::first_normal_stem (beam),
+ Beam::last_normal_stem (beam));
Direction d = LEFT;
do
x_span[d] = edge_stems[d] ? edge_stems[d]->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0;
while (flip (&d) != LEFT);
-
+
Drul_array<bool> dirs_found (0, 0);
for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
if (!Stem::is_normal_stem (s))
continue;
-
+
Stem_info si (Stem::get_stem_info (s));
si.scale (1 / staff_space);
stem_infos.push_back (si);
dirs_found[si.dir_] = true;
bool f = to_boolean (s->get_property ("french-beaming"))
- && s != edge_stems[LEFT] && s != edge_stems[RIGHT];
+ && s != edge_stems[LEFT] && s != edge_stems[RIGHT];
- Real y = Beam::calc_stem_y (beam, s, common, x_span[LEFT], x_span[RIGHT], CENTER,
+ Real y = Beam::calc_stem_y (beam, s, common, x_span[LEFT], x_span[RIGHT], CENTER,
Interval (0, 0), f);
base_lengths.push_back (y / staff_space);
stem_xpositions.push_back (s->relative_coordinate (common[X_AXIS], X_AXIS));
}
-
+
edge_dirs = Drul_array<Direction> (CENTER, CENTER);
if (stem_infos.size ())
{
edge_dirs = Drul_array<Direction> (stem_infos[0].dir_,
- stem_infos.back().dir_);
+ stem_infos.back ().dir_);
}
is_xstaff = Align_interface::has_interface (common[Y_AXIS]);
is_knee = dirs_found[LEFT] && dirs_found[RIGHT];
-
+
staff_radius = Staff_symbol_referencer::staff_radius (beam);
- edge_beam_counts = Drul_array<int>
- (Stem::beam_multiplicity (stems[0]).length () + 1,
- Stem::beam_multiplicity (stems.back ()).length () + 1);
+ edge_beam_counts = Drul_array<int>
+ (Stem::beam_multiplicity (stems[0]).length () + 1,
+ Stem::beam_multiplicity (stems.back ()).length () + 1);
// TODO - why are we dividing by staff_space?
beam_translation = Beam::get_beam_translation (beam) / staff_space;
quant_range[d].set_full ();
if (!edge_stems[d])
continue;
-
+
Real stem_offset = edge_stems[d]->relative_coordinate (common[Y_AXIS], Y_AXIS)
- - beam->relative_coordinate (common[Y_AXIS], Y_AXIS);
- Interval heads = Stem::head_positions(edge_stems[d]) * 0.5 * staff_space;
+ - beam->relative_coordinate (common[Y_AXIS], Y_AXIS);
+ Interval heads = Stem::head_positions (edge_stems[d]) * 0.5 * staff_space;
Direction ed = edge_dirs[d];
- heads.widen(0.5 * staff_space
- + (edge_beam_counts[d] - 1) * beam_translation + beam_thickness * .5);
+ heads.widen (0.5 * staff_space
+ + (edge_beam_counts[d] - 1) * beam_translation + beam_thickness * .5);
quant_range[d][-ed] = heads[ed] + stem_offset;
}
while (flip (&d) != LEFT);
{
beam = me;
unquanted_y = ys;
-
+
/*
Calculations are relative to a unit-scaled staff, i.e. the quants are
divided by the current staff_space.
}
void
-Beam_scoring_problem::generate_quants (vector<Beam_configuration*> *scores) const
+Beam_scoring_problem::generate_quants (vector<Beam_configuration *> *scores) const
{
int region_size = (int) parameters.REGION_SIZE;
region_size += 2;
if (collisions_.size ())
region_size += 2;
-
+
Real straddle = 0.0;
Real sit = (beam_thickness - line_thickness) / 2;
Real inter = 0.5;
for (vsize i = 0; i < unshifted_quants.size (); i++)
for (vsize j = 0; j < unshifted_quants.size (); j++)
{
- Beam_configuration *c =
- Beam_configuration::new_config (unquanted_y,
- Interval (unshifted_quants[i],
- unshifted_quants[j]));
-
+ Beam_configuration *c
+ = Beam_configuration::new_config (unquanted_y,
+ Interval (unshifted_quants[i],
+ unshifted_quants[j]));
+
Direction d = LEFT;
do
{
}
}
while (flip (&d) != LEFT);
- if (c)
+ if (c)
scores->push_back (c);
}
-
-}
+}
-void Beam_scoring_problem::one_scorer (Beam_configuration* config) const
+void Beam_scoring_problem::one_scorer (Beam_configuration *config) const
{
- score_count ++;
- switch (config->next_scorer_todo) {
- case SLOPE_IDEAL:
- score_slope_ideal (config);
- break;
- case SLOPE_DIRECTION:
- score_slope_direction (config);
- break;
- case SLOPE_MUSICAL:
- score_slope_musical (config);
- break;
- case FORBIDDEN:
- score_forbidden_quants (config);
- break;
- case STEM_LENGTHS:
- score_stem_lengths (config);
- break;
- case COLLISIONS:
- score_collisions (config);
- break;
- case HORIZONTAL_INTER:
- score_horizontal_inter_quants (config);
- break;
-
- case NUM_SCORERS:
- case ORIGINAL_DISTANCE:
- default:
- assert (false);
- }
+ score_count++;
+ switch (config->next_scorer_todo)
+ {
+ case SLOPE_IDEAL:
+ score_slope_ideal (config);
+ break;
+ case SLOPE_DIRECTION:
+ score_slope_direction (config);
+ break;
+ case SLOPE_MUSICAL:
+ score_slope_musical (config);
+ break;
+ case FORBIDDEN:
+ score_forbidden_quants (config);
+ break;
+ case STEM_LENGTHS:
+ score_stem_lengths (config);
+ break;
+ case COLLISIONS:
+ score_collisions (config);
+ break;
+ case HORIZONTAL_INTER:
+ score_horizontal_inter_quants (config);
+ break;
+
+ case NUM_SCORERS:
+ case ORIGINAL_DISTANCE:
+ default:
+ assert (false);
+ }
config->next_scorer_todo++;
-}
-
+}
Beam_configuration *
-Beam_scoring_problem::force_score (SCM inspect_quants, const vector<Beam_configuration*> &configs) const
+Beam_scoring_problem::force_score (SCM inspect_quants, const vector<Beam_configuration *> &configs) const
{
Drul_array<Real> ins = ly_scm2interval (inspect_quants);
Real mindist = 1e6;
- Beam_configuration *best = NULL;
+ Beam_configuration *best = NULL;
for (vsize i = 0; i < configs.size (); i++)
{
- Real d = fabs (configs[i]->y[LEFT]- ins[LEFT]) + fabs (configs[i]->y[RIGHT] - ins[RIGHT]);
+ Real d = fabs (configs[i]->y[LEFT] - ins[LEFT]) + fabs (configs[i]->y[RIGHT] - ins[RIGHT]);
if (d < mindist)
{
best = configs[i];
while (!best->done ())
one_scorer (best);
-
+
return best;
}
Drul_array<Real>
-Beam_scoring_problem::solve () const {
- vector<Beam_configuration*> configs;
+Beam_scoring_problem::solve () const
+{
+ vector<Beam_configuration *> configs;
generate_quants (&configs);
if (configs.empty ())
return unquanted_y;
}
- Beam_configuration *best = NULL;
+ Beam_configuration *best = NULL;
- bool debug =
- to_boolean (beam->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-scoring")));
+ bool debug
+ = to_boolean (beam->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-scoring")));
SCM inspect_quants = beam->get_property ("inspect-quants");
- if (scm_is_pair (inspect_quants))
+ if (scm_is_pair (inspect_quants))
{
debug = true;
best = force_score (inspect_quants, configs);
}
else
{
- std::priority_queue<Beam_configuration*, std::vector<Beam_configuration*>,
- Beam_configuration_less> queue;
- for (vsize i = 0; i < configs.size(); i++)
- queue.push(configs[i]);
+ std::priority_queue < Beam_configuration *, std::vector<Beam_configuration *>,
+ Beam_configuration_less > queue;
+ for (vsize i = 0; i < configs.size (); i++)
+ queue.push (configs[i]);
/*
TODO
that would allow us to do away with region_size altogether.
*/
- while (true) {
- best = queue.top ();
- if (best->done ())
- break;
-
- queue.pop ();
- one_scorer (best);
- queue.push (best);
- }
+ while (true)
+ {
+ best = queue.top ();
+ if (best->done ())
+ break;
+
+ queue.pop ();
+ one_scorer (best);
+ queue.push (best);
+ }
}
Interval final_positions = best->y;
completed++;
}
- string card = best->score_card_ + to_string (" c%d/%d", completed, configs.size());
+ string card = best->score_card_ + to_string (" c%d/%d", completed, configs.size ());
beam->set_property ("annotation", ly_string2scm (card));
}
#endif
}
void
-Beam_scoring_problem::score_stem_lengths (Beam_configuration* config) const
+Beam_scoring_problem::score_stem_lengths (Beam_configuration *config) const
{
Real limit_penalty = parameters.STEM_LENGTH_LIMIT_PENALTY;
Drul_array<Real> score (0, 0);
Real x = stem_xpositions[i];
Real dx = x_span.delta ();
Real beam_y = dx
- ? config->y[RIGHT] * (x - x_span[LEFT]) / dx + config->y[LEFT] * (x_span[RIGHT] - x) / dx
- : (config->y[RIGHT] + config->y[LEFT]) / 2;
+ ? config->y[RIGHT] * (x - x_span[LEFT]) / dx + config->y[LEFT] * (x_span[RIGHT] - x) / dx
+ : (config->y[RIGHT] + config->y[LEFT]) / 2;
Real current_y = beam_y + base_lengths[i];
Real length_pen = parameters.STEM_LENGTH_DEMERIT_FACTOR;
convex. Otherwise a symmetric knee beam (up/down/up/down)
does not have an optimum in the middle. */
if (is_knee)
- ideal_score = pow (ideal_score, 1.1);
+ ideal_score = pow (ideal_score, 1.1);
score[d] += length_pen * ideal_score;
count[d]++;
Beam_scoring_problem::score_slope_direction (Beam_configuration *config) const
{
Real dy = config->y.delta ();
- Real damped_dy = unquanted_y.delta();
+ Real damped_dy = unquanted_y.delta ();
Real dem = 0.0;
/*
DAMPING_DIRECTION_PENALTY is a very harsh measure, while for
if (sign (damped_dy) != sign (dy))
{
if (!dy)
- {
- if (fabs (damped_dy / x_span.delta ()) > parameters.ROUND_TO_ZERO_SLOPE)
- dem += parameters.DAMPING_DIRECTION_PENALTY;
- else
- dem += parameters.HINT_DIRECTION_PENALTY;
- }
+ {
+ if (fabs (damped_dy / x_span.delta ()) > parameters.ROUND_TO_ZERO_SLOPE)
+ dem += parameters.DAMPING_DIRECTION_PENALTY;
+ else
+ dem += parameters.HINT_DIRECTION_PENALTY;
+ }
else
- dem += parameters.DAMPING_DIRECTION_PENALTY;
+ dem += parameters.DAMPING_DIRECTION_PENALTY;
}
config->add (dem, "Sd");
}
-// Score for going against the direction of the musical pattern
+// Score for going against the direction of the musical pattern
void
Beam_scoring_problem::score_slope_musical (Beam_configuration *config) const
{
Real dy = config->y.delta ();
Real dem = parameters.MUSICAL_DIRECTION_FACTOR
- * max (0.0, (fabs (dy) - fabs (musical_dy)));
+ * max (0.0, (fabs (dy) - fabs (musical_dy)));
config->add (dem, "Sm");
}
Beam_scoring_problem::score_slope_ideal (Beam_configuration *config) const
{
Real dy = config->y.delta ();
- Real damped_dy = unquanted_y.delta();
+ Real damped_dy = unquanted_y.delta ();
Real dem = 0.0;
-
+
Real slope_penalty = parameters.IDEAL_SLOPE_FACTOR;
/* Xstaff beams tend to use extreme slopes to get short stems. We
/* Huh, why would a too steep beam be better than a too flat one ? */
dem += shrink_extra_weight (fabs (damped_dy) - fabs (dy), 1.5)
- * slope_penalty;
+ * slope_penalty;
config->add (dem, "Si");
}
{
Real dy = config->y.delta ();
- Real extra_demerit = parameters.SECONDARY_BEAM_DEMERIT /
- max (edge_beam_counts[LEFT], edge_beam_counts[RIGHT]);
+ Real extra_demerit = parameters.SECONDARY_BEAM_DEMERIT
+ / max (edge_beam_counts[LEFT], edge_beam_counts[RIGHT]);
Direction d = LEFT;
Real dem = 0.0;
Real eps = parameters.BEAM_EPS;
-
+
do
{
for (int j = 1; j <= edge_beam_counts[d]; j++)
- {
- Direction stem_dir = edge_dirs[d];
-
- /*
- The 2.2 factor is to provide a little leniency for
- borderline cases. If we do 2.0, then the upper outer line
- will be in the gap of the (2, sit) quant, leading to a
- false demerit.
- */
- Real gap1 = config->y[d] - stem_dir * ((j - 1) * beam_translation + beam_thickness / 2 - line_thickness / 2.2);
- Real gap2 = config->y[d] - stem_dir * (j * beam_translation - beam_thickness / 2 + line_thickness / 2.2);
-
- Interval gap;
- gap.add_point (gap1);
- gap.add_point (gap2);
-
- for (Real k = -staff_radius;
- k <= staff_radius + eps; k += 1.0)
- if (gap.contains (k))
- {
- Real dist = min (fabs (gap[UP] - k), fabs (gap[DOWN] - k));
-
- /*
- this parameter is tuned to grace-stem-length.ly
- */
- Real fixed_demerit = 0.4;
-
- dem += extra_demerit
- * (fixed_demerit
- + (1 - fixed_demerit) * (dist / gap.length ()) * 2);
- }
- }
+ {
+ Direction stem_dir = edge_dirs[d];
+
+ /*
+ The 2.2 factor is to provide a little leniency for
+ borderline cases. If we do 2.0, then the upper outer line
+ will be in the gap of the (2, sit) quant, leading to a
+ false demerit.
+ */
+ Real gap1 = config->y[d] - stem_dir * ((j - 1) * beam_translation + beam_thickness / 2 - line_thickness / 2.2);
+ Real gap2 = config->y[d] - stem_dir * (j * beam_translation - beam_thickness / 2 + line_thickness / 2.2);
+
+ Interval gap;
+ gap.add_point (gap1);
+ gap.add_point (gap2);
+
+ for (Real k = -staff_radius;
+ k <= staff_radius + eps; k += 1.0)
+ if (gap.contains (k))
+ {
+ Real dist = min (fabs (gap[UP] - k), fabs (gap[DOWN] - k));
+
+ /*
+ this parameter is tuned to grace-stem-length.ly
+ */
+ Real fixed_demerit = 0.4;
+
+ dem += extra_demerit
+ * (fixed_demerit
+ + (1 - fixed_demerit) * (dist / gap.length ()) * 2);
+ }
+ }
}
while ((flip (&d)) != LEFT);
Direction d = LEFT;
do
- {
- if (edge_beam_counts[d] >= 2
- && fabs (config->y[d] - edge_dirs[d] * beam_translation) < staff_radius + inter)
- {
+ {
+ if (edge_beam_counts[d] >= 2
+ && fabs (config->y[d] - edge_dirs[d] * beam_translation) < staff_radius + inter)
+ {
// TODO up/down symmetry.
- if (edge_dirs[d] == UP && dy <= eps
- && fabs (my_modf (config->y[d]) - sit) < eps)
- dem += extra_demerit;
-
- if (edge_dirs[d] == DOWN && dy >= eps
- && fabs (my_modf (config->y[d]) - hang) < eps)
- dem += extra_demerit;
- }
-
- if (edge_beam_counts[d] >= 3
- && fabs (config->y[d] - 2 * edge_dirs[d] * beam_translation) < staff_radius + inter)
- {
+ if (edge_dirs[d] == UP && dy <= eps
+ && fabs (my_modf (config->y[d]) - sit) < eps)
+ dem += extra_demerit;
+
+ if (edge_dirs[d] == DOWN && dy >= eps
+ && fabs (my_modf (config->y[d]) - hang) < eps)
+ dem += extra_demerit;
+ }
+
+ if (edge_beam_counts[d] >= 3
+ && fabs (config->y[d] - 2 * edge_dirs[d] * beam_translation) < staff_radius + inter)
+ {
// TODO up/down symmetry.
- if (edge_dirs[d] == UP && dy <= eps
- && fabs (my_modf (config->y[d]) - straddle) < eps)
- dem += extra_demerit;
-
- if (edge_dirs[d] == DOWN && dy >= eps
- && fabs (my_modf (config->y[d]) - straddle) < eps)
- dem += extra_demerit;
- }
- }
+ if (edge_dirs[d] == UP && dy <= eps
+ && fabs (my_modf (config->y[d]) - straddle) < eps)
+ dem += extra_demerit;
+
+ if (edge_dirs[d] == DOWN && dy >= eps
+ && fabs (my_modf (config->y[d]) - straddle) < eps)
+ dem += extra_demerit;
+ }
+ }
while (flip (&d) != LEFT);
}
void
Beam_scoring_problem::score_collisions (Beam_configuration *config) const
-{
+{
Real demerits = 0.0;
for (vsize i = 0; i < collisions_.size (); i++)
{
dist = min (beam_y.distance (collision_y[DOWN]),
beam_y.distance (collision_y[UP]));
- Real scale_free =
- max (parameters.COLLISION_PADDING - dist, 0.0)/
- parameters.COLLISION_PADDING;
- demerits +=
- collisions_[i].base_penalty_ *
- pow (scale_free, 3) * parameters.COLLISION_PENALTY;
+ Real scale_free
+ = max (parameters.COLLISION_PADDING - dist, 0.0) /
+ parameters.COLLISION_PADDING;
+ demerits
+ += collisions_[i].base_penalty_ *
+ pow (scale_free, 3) * parameters.COLLISION_PENALTY;
}
config->add (demerits, "C");
-}
+}
#include <map>
-
Beam_stem_segment::Beam_stem_segment ()
{
- max_connect_ = 1000; // infinity
+ max_connect_ = 1000; // infinity
stem_ = 0;
width_ = 0.0;
stem_x_ = 0.0;
}
bool
-beam_segment_less (Beam_segment const& a, Beam_segment const& b)
+beam_segment_less (Beam_segment const &a, Beam_segment const &b)
{
return a.horizontal_[LEFT] < b.horizontal_[LEFT];
}
if (Stem::get_beam (s))
{
programming_error ("Stem already has beam");
- return ;
+ return;
}
Pointer_group_interface::add_grob (me, ly_symbol2scm ("stems"), s);
Beam::get_beam_thickness (Grob *me)
{
return robust_scm2double (me->get_property ("beam-thickness"), 0)
- * Staff_symbol_referencer::staff_space (me);
+ * Staff_symbol_referencer::staff_space (me);
}
/* Return the translation between 2 adjoining beams. */
Real fract = robust_scm2double (me->get_property ("length-fraction"), 1.0);
Real beam_translation = beam_count < 4
- ? (2 * staff_space + line - beam_thickness) / 2.0
- : (3 * staff_space + line - beam_thickness) / 3.0;
+ ? (2 * staff_space + line - beam_thickness) / 2.0
+ : (3 * staff_space + line - beam_thickness) / 3.0;
return fract * beam_translation;
}
extract_grob_set (me, "stems", stems);
SCM val = Grob_array::make_array ();
Grob_array *ga = unsmob_grob_array (val);
- for (vsize i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
if (Stem::is_normal_stem (stems[i]))
ga->add (stems[i]);
{
extract_grob_set (me, "stems", stems);
if (stems.size () == 0)
- {
- me->warning (_ ("removing beam with no stems"));
- me->suicide ();
+ {
+ me->warning (_ ("removing beam with no stems"));
+ me->suicide ();
- return SCM_UNSPECIFIED;
- }
+ return SCM_UNSPECIFIED;
+ }
else
- {
- Grob *stem = first_normal_stem (me);
-
- /*
- This happens for chord tremolos.
- */
- if (!stem)
- stem = stems[0];
-
- if (is_direction (stem->get_property_data ("direction")))
- dir = to_dir (stem->get_property_data ("direction"));
- else
- dir = to_dir (stem->get_property ("default-direction"));
- }
+ {
+ Grob *stem = first_normal_stem (me);
+
+ /*
+ This happens for chord tremolos.
+ */
+ if (!stem)
+ stem = stems[0];
+
+ if (is_direction (stem->get_property_data ("direction")))
+ dir = to_dir (stem->get_property_data ("direction"));
+ else
+ dir = to_dir (stem->get_property ("default-direction"));
+ }
}
if (count >= 1)
{
if (!dir)
- dir = get_default_dir (me);
+ dir = get_default_dir (me);
consider_auto_knees (me);
}
return scm_from_int (dir);
}
-
-
/* We want a maximal number of shared beams, but if there is choice, we
* take the one that is closest to the end of the stem. This is for
* situations like
*/
int
position_with_maximal_common_beams (SCM left_beaming, SCM right_beaming,
- Direction left_dir,
- Direction right_dir)
+ Direction left_dir,
+ Direction right_dir)
{
Slice lslice = int_list_to_slice (scm_cdr (left_beaming));
{
int count = 0;
for (SCM s = scm_car (right_beaming); scm_is_pair (s); s = scm_cdr (s))
- {
- int k = -right_dir * scm_to_int (scm_car (s)) + i;
- if (scm_c_memq (scm_from_int (k), left_beaming) != SCM_BOOL_F)
- count++;
- }
+ {
+ int k = -right_dir * scm_to_int (scm_car (s)) + i;
+ if (scm_c_memq (scm_from_int (k), left_beaming) != SCM_BOOL_F)
+ count++;
+ }
if (count >= best_count)
- {
- best_count = count;
- best_start = i;
- }
+ {
+ best_count = count;
+ best_start = i;
+ }
}
return best_start;
Direction this_dir = get_grob_direction (this_stem);
if (scm_is_pair (last_beaming) && scm_is_pair (this_beaming))
- {
- int start_point = position_with_maximal_common_beams
- (last_beaming, this_beaming,
- last_dir ? last_dir : this_dir,
- this_dir);
-
- Direction d = LEFT;
- Slice new_slice;
- do
- {
- new_slice.set_empty ();
- SCM s = index_get_cell (this_beaming, d);
- for (; scm_is_pair (s); s = scm_cdr (s))
- {
- int new_beam_pos
- = start_point - this_dir * scm_to_int (scm_car (s));
-
- new_slice.add_point (new_beam_pos);
- scm_set_car_x (s, scm_from_int (new_beam_pos));
- }
- }
- while (flip (&d) != LEFT);
-
- if (!new_slice.is_empty ())
- last_int = new_slice;
- }
+ {
+ int start_point = position_with_maximal_common_beams
+ (last_beaming, this_beaming,
+ last_dir ? last_dir : this_dir,
+ this_dir);
+
+ Direction d = LEFT;
+ Slice new_slice;
+ do
+ {
+ new_slice.set_empty ();
+ SCM s = index_get_cell (this_beaming, d);
+ for (; scm_is_pair (s); s = scm_cdr (s))
+ {
+ int new_beam_pos
+ = start_point - this_dir * scm_to_int (scm_car (s));
+
+ new_slice.add_point (new_beam_pos);
+ scm_set_car_x (s, scm_from_int (new_beam_pos));
+ }
+ }
+ while (flip (&d) != LEFT);
+
+ if (!new_slice.is_empty ())
+ last_int = new_slice;
+ }
else
- {
- /*
- FIXME: what's this for?
- */
- SCM s = scm_cdr (this_beaming);
- for (; scm_is_pair (s); s = scm_cdr (s))
- {
- int np = -this_dir * scm_to_int (scm_car (s));
- scm_set_car_x (s, scm_from_int (np));
- last_int.add_point (np);
- }
- }
+ {
+ /*
+ FIXME: what's this for?
+ */
+ SCM s = scm_cdr (this_beaming);
+ for (; scm_is_pair (s); s = scm_cdr (s))
+ {
+ int np = -this_dir * scm_to_int (scm_car (s));
+ scm_set_car_x (s, scm_from_int (np));
+ last_int.add_point (np);
+ }
+ }
if (scm_ilength (scm_cdr (this_beaming)) > 0)
- {
- last_beaming = this_beaming;
- last_dir = this_dir;
- }
+ {
+ last_beaming = this_beaming;
+ last_dir = this_dir;
+ }
}
return SCM_EOL;
bool
operator <(Beam_stem_segment const &a,
- Beam_stem_segment const &b)
+ Beam_stem_segment const &b)
{
return a.rank_ < b.rank_;
}
-typedef map<int, vector<Beam_stem_segment> > Position_stem_segments_map;
+typedef map<int, vector<Beam_stem_segment> > Position_stem_segments_map;
// TODO - should store result in a property?
vector<Beam_segment>
Stem #'beaming is correct */
(void) me_grob->get_property ("beaming");
- Spanner *me = dynamic_cast<Spanner*> (me_grob);
+ Spanner *me = dynamic_cast<Spanner *> (me_grob);
extract_grob_set (me, "stems", stems);
Grob *commonx = common_refpoint_of_array (stems, me, X_AXIS);
SCM beaming = stem->get_property ("beaming");
Direction d = LEFT;
do
- {
- // Find the maximum and minimum beam ranks.
- // Given that RANKS is never reset to empty, the interval will always be
- // smallest for the left beamlet of the first stem, and then it might grow.
- // Do we really want this? (It only affects the tremolo gaps) --jneem
- for (SCM s = index_get_cell (beaming, d);
- scm_is_pair (s); s = scm_cdr (s))
- {
- if (!scm_is_integer (scm_car (s)))
- continue;
-
- int beam_rank = scm_to_int (scm_car (s));
- ranks.add_point (beam_rank);
- }
-
- for (SCM s = index_get_cell (beaming, d);
- scm_is_pair (s); s = scm_cdr (s))
- {
- if (!scm_is_integer (scm_car (s)))
- continue;
-
- int beam_rank = scm_to_int (scm_car (s));
- Beam_stem_segment seg;
- seg.stem_ = stem;
- seg.stem_x_ = stem_x;
- seg.rank_ = 2 * i + (d+1)/2;
- seg.width_ = stem_width;
- seg.stem_index_ = i;
- seg.dir_ = d;
- seg.max_connect_ = robust_scm2int (stem->get_property ("max-beam-connect"), 1000);
-
- Direction stem_dir = get_grob_direction (stem);
-
- seg.gapped_
- = (stem_dir * beam_rank < (stem_dir * ranks[-stem_dir] + gap_count));
- stem_segments[beam_rank].push_back (seg);
- }
- }
+ {
+ // Find the maximum and minimum beam ranks.
+ // Given that RANKS is never reset to empty, the interval will always be
+ // smallest for the left beamlet of the first stem, and then it might grow.
+ // Do we really want this? (It only affects the tremolo gaps) --jneem
+ for (SCM s = index_get_cell (beaming, d);
+ scm_is_pair (s); s = scm_cdr (s))
+ {
+ if (!scm_is_integer (scm_car (s)))
+ continue;
+
+ int beam_rank = scm_to_int (scm_car (s));
+ ranks.add_point (beam_rank);
+ }
+
+ for (SCM s = index_get_cell (beaming, d);
+ scm_is_pair (s); s = scm_cdr (s))
+ {
+ if (!scm_is_integer (scm_car (s)))
+ continue;
+
+ int beam_rank = scm_to_int (scm_car (s));
+ Beam_stem_segment seg;
+ seg.stem_ = stem;
+ seg.stem_x_ = stem_x;
+ seg.rank_ = 2 * i + (d + 1) / 2;
+ seg.width_ = stem_width;
+ seg.stem_index_ = i;
+ seg.dir_ = d;
+ seg.max_connect_ = robust_scm2int (stem->get_property ("max-beam-connect"), 1000);
+
+ Direction stem_dir = get_grob_direction (stem);
+
+ seg.gapped_
+ = (stem_dir * beam_rank < (stem_dir * ranks[-stem_dir] + gap_count));
+ stem_segments[beam_rank].push_back (seg);
+ }
+ }
while (flip (&d) != LEFT);
}
Drul_array<Real> break_overshoot
= robust_scm2drul (me->get_property ("break-overshoot"),
- Drul_array<Real> (-0.5, 0.0));
+ Drul_array<Real> (-0.5, 0.0));
vector<Beam_segment> segments;
for (Position_stem_segments_map::const_iterator i (stem_segments.begin ());
// Iterate over all of the segments of the current beam rank,
// merging the adjacent Beam_stem_segments into one Beam_segment
// when appropriate.
- int vertical_count = (*i).first;
+ int vertical_count = (*i).first;
for (vsize j = 0; j < segs.size (); j++)
- {
- // Keeping track of the different directions here is a little tricky.
- // segs[j].dir_ is the direction of the beam segment relative to the stem
- // (ie. segs[j].dir_ == LEFT if the beam segment sticks out to the left of
- // its stem) whereas event_dir refers to the edge of the beam segment that
- // we are currently looking at (ie. if segs[j].dir_ == event_dir then we
- // are looking at that edge of the beam segment that is furthest from its
- // stem).
- Direction event_dir = LEFT;
- Beam_stem_segment const& seg = segs[j];
- do
- {
- Beam_stem_segment const& neighbor_seg = segs[j + event_dir];
- // TODO: make names clearer? --jneem
- // on_line_bound: whether the current segment is on the boundary of the WHOLE beam
- // on_beam_bound: whether the current segment is on the boundary of just that part
- // of the beam with the current beam_rank
- bool on_line_bound = (seg.dir_ == LEFT) ? seg.stem_index_ == 0
- : seg.stem_index_ == stems.size() - 1;
- bool on_beam_bound = (event_dir == LEFT) ? j == 0 :
- j == segs.size () - 1;
- bool inside_stem = (event_dir == LEFT)
- ? seg.stem_index_ > 0
- : seg.stem_index_ + 1 < stems.size () ;
-
- bool event = on_beam_bound
- || abs (seg.rank_ - neighbor_seg.rank_) > 1
- || (abs (vertical_count) >= seg.max_connect_
- || abs (vertical_count) >= neighbor_seg.max_connect_);
-
- if (!event)
- // Then this edge of the current segment is irrelevent because it will
- // be connected with the next segment in the event_dir direction.
- continue;
-
- current.vertical_count_ = vertical_count;
- current.horizontal_[event_dir] = seg.stem_x_;
- if (seg.dir_ == event_dir)
- // then we are examining the edge of a beam segment that is furthest
- // from its stem.
- {
- if (on_line_bound
- && me->get_bound (event_dir)->break_status_dir ())
- {
- current.horizontal_[event_dir]
- = (robust_relative_extent (me->get_bound (event_dir),
- commonx, X_AXIS)[RIGHT]
- + event_dir * break_overshoot[event_dir]);
- }
- else
- {
- Grob *stem = stems[seg.stem_index_];
- Drul_array<Real> beamlet_length =
- robust_scm2interval (stem->get_property ("beamlet-default-length"), Interval (1.1, 1.1));
- Drul_array<Real> max_proportion =
- robust_scm2interval (stem->get_property ("beamlet-max-length-proportion"), Interval (0.75, 0.75));
- Real length = beamlet_length[seg.dir_];
-
- if (inside_stem)
- {
- Grob *neighbor_stem = stems[seg.stem_index_ + event_dir];
- Real neighbor_stem_x = neighbor_stem->relative_coordinate (commonx, X_AXIS);
-
- length = min (length,
- fabs (neighbor_stem_x - seg.stem_x_) * max_proportion[seg.dir_]);
- }
- current.horizontal_[event_dir] += event_dir * length;
- }
- }
- else
- // we are examining the edge of a beam segment that is closest
- // (ie. touching, unless there is a gap) its stem.
- {
- current.horizontal_[event_dir] += event_dir * seg.width_/2;
- if (seg.gapped_)
- {
- current.horizontal_[event_dir] -= event_dir * gap_length;
-
- if (Stem::is_invisible (seg.stem_))
- {
- /*
- Need to do this in case of whole notes. We don't want the
- heads to collide with the beams.
- */
- extract_grob_set (seg.stem_, "note-heads", heads);
-
- for (vsize k = 0; k < heads.size (); k ++)
- current.horizontal_[event_dir]
- = event_dir * min (event_dir * current.horizontal_[event_dir],
- - gap_length/2
- + event_dir
- * heads[k]->extent (commonx,
- X_AXIS)[-event_dir]);
- }
- }
- }
-
- if (event_dir == RIGHT)
- {
- segments.push_back (current);
- current = Beam_segment ();
- }
- }
- while (flip (&event_dir) != LEFT);
- }
+ {
+ // Keeping track of the different directions here is a little tricky.
+ // segs[j].dir_ is the direction of the beam segment relative to the stem
+ // (ie. segs[j].dir_ == LEFT if the beam segment sticks out to the left of
+ // its stem) whereas event_dir refers to the edge of the beam segment that
+ // we are currently looking at (ie. if segs[j].dir_ == event_dir then we
+ // are looking at that edge of the beam segment that is furthest from its
+ // stem).
+ Direction event_dir = LEFT;
+ Beam_stem_segment const &seg = segs[j];
+ do
+ {
+ Beam_stem_segment const &neighbor_seg = segs[j + event_dir];
+ // TODO: make names clearer? --jneem
+ // on_line_bound: whether the current segment is on the boundary of the WHOLE beam
+ // on_beam_bound: whether the current segment is on the boundary of just that part
+ // of the beam with the current beam_rank
+ bool on_line_bound = (seg.dir_ == LEFT) ? seg.stem_index_ == 0
+ : seg.stem_index_ == stems.size () - 1;
+ bool on_beam_bound = (event_dir == LEFT) ? j == 0
+ : j == segs.size () - 1;
+ bool inside_stem = (event_dir == LEFT)
+ ? seg.stem_index_ > 0
+ : seg.stem_index_ + 1 < stems.size ();
+
+ bool event = on_beam_bound
+ || abs (seg.rank_ - neighbor_seg.rank_) > 1
+ || (abs (vertical_count) >= seg.max_connect_
+ || abs (vertical_count) >= neighbor_seg.max_connect_);
+
+ if (!event)
+ // Then this edge of the current segment is irrelevent because it will
+ // be connected with the next segment in the event_dir direction.
+ continue;
+
+ current.vertical_count_ = vertical_count;
+ current.horizontal_[event_dir] = seg.stem_x_;
+ if (seg.dir_ == event_dir)
+ // then we are examining the edge of a beam segment that is furthest
+ // from its stem.
+ {
+ if (on_line_bound
+ && me->get_bound (event_dir)->break_status_dir ())
+ {
+ current.horizontal_[event_dir]
+ = (robust_relative_extent (me->get_bound (event_dir),
+ commonx, X_AXIS)[RIGHT]
+ + event_dir * break_overshoot[event_dir]);
+ }
+ else
+ {
+ Grob *stem = stems[seg.stem_index_];
+ Drul_array<Real> beamlet_length
+ = robust_scm2interval (stem->get_property ("beamlet-default-length"), Interval (1.1, 1.1));
+ Drul_array<Real> max_proportion
+ = robust_scm2interval (stem->get_property ("beamlet-max-length-proportion"), Interval (0.75, 0.75));
+ Real length = beamlet_length[seg.dir_];
+
+ if (inside_stem)
+ {
+ Grob *neighbor_stem = stems[seg.stem_index_ + event_dir];
+ Real neighbor_stem_x = neighbor_stem->relative_coordinate (commonx, X_AXIS);
+
+ length = min (length,
+ fabs (neighbor_stem_x - seg.stem_x_) * max_proportion[seg.dir_]);
+ }
+ current.horizontal_[event_dir] += event_dir * length;
+ }
+ }
+ else
+ // we are examining the edge of a beam segment that is closest
+ // (ie. touching, unless there is a gap) its stem.
+ {
+ current.horizontal_[event_dir] += event_dir * seg.width_ / 2;
+ if (seg.gapped_)
+ {
+ current.horizontal_[event_dir] -= event_dir * gap_length;
+
+ if (Stem::is_invisible (seg.stem_))
+ {
+ /*
+ Need to do this in case of whole notes. We don't want the
+ heads to collide with the beams.
+ */
+ extract_grob_set (seg.stem_, "note-heads", heads);
+
+ for (vsize k = 0; k < heads.size (); k++)
+ current.horizontal_[event_dir]
+ = event_dir * min (event_dir * current.horizontal_[event_dir],
+ - gap_length / 2
+ + event_dir
+ * heads[k]->extent (commonx,
+ X_AXIS)[-event_dir]);
+ }
+ }
+ }
+
+ if (event_dir == RIGHT)
+ {
+ segments.push_back (current);
+ current = Beam_segment ();
+ }
+ }
+ while (flip (&event_dir) != LEFT);
+ }
}
scale_drul (&pos, Staff_symbol_referencer::staff_space (me));
Real dy = pos[RIGHT] - pos[LEFT];
- Real slope = (dy && span.length ()) ? dy / span.length () : 0;
+ Real slope = (dy && span.length ()) ? dy / span.length () : 0;
Real beam_thickness = get_beam_thickness (me);
Real beam_dy = get_beam_translation (me);
? segments[0].vertical_count_
: segments.back ().vertical_count_);
- for (vsize i = 0; i < segments.size (); i ++)
+ for (vsize i = 0; i < segments.size (); i++)
{
Real local_slope = slope;
/*
*/
if (feather_dir)
local_slope += (feather_dir * segments[i].vertical_count_
- * beam_dy
- * placements.length ()
+ * beam_dy
+ * placements.length ()
/ span.length ());
Stencil b = Lookup::beam (local_slope, segments[i].horizontal_.length (), beam_thickness, blot);
extract_grob_set (me, "stems", stems);
/*
- This code prints the demerits for each beam. Perhaps this
- should be switchable for those who want to twiddle with the
- parameters.
+ This code prints the demerits for each beam. Perhaps this
+ should be switchable for those who want to twiddle with the
+ parameters.
*/
string str;
SCM properties = Font_interface::text_font_alist_chain (me);
- properties = scm_cons(scm_acons (ly_symbol2scm ("font-size"), scm_from_int (-5), SCM_EOL),
- properties);
+ properties = scm_cons (scm_acons (ly_symbol2scm ("font-size"), scm_from_int (-5), SCM_EOL),
+ properties);
Direction stem_dir = stems.size () ? to_dir (stems[0]->get_property ("direction")) : UP;
(me->layout ()->self_scm (), properties, annotation));
if (!score.is_empty ())
- {
- score.translate_axis (me->relative_coordinate(commonx, X_AXIS), X_AXIS);
- the_beam.add_at_edge (Y_AXIS, stem_dir, score, 1.0);
- }
+ {
+ score.translate_axis (me->relative_coordinate (commonx, X_AXIS), X_AXIS);
+ the_beam.add_at_edge (Y_AXIS, stem_dir, score, 1.0);
+ }
}
#endif
Interval positions = Stem::head_positions (*s);
Direction d = DOWN;
do
- {
- if (sign (positions[d]) == d)
- extremes[d] = d * max (d * positions[d], d * extremes[d]);
- }
+ {
+ if (sign (positions[d]) == d)
+ extremes[d] = d * max (d * positions[d], d * extremes[d]);
+ }
while (flip (&d) != DOWN);
}
Direction stem_dir = CENTER;
SCM stem_dir_scm = s->get_property_data ("direction");
if (is_direction (stem_dir_scm))
- {
- stem_dir = to_dir (stem_dir_scm);
- force_dir = true;
- }
+ {
+ stem_dir = to_dir (stem_dir_scm);
+ force_dir = true;
+ }
else
- stem_dir = to_dir (s->get_property ("default-direction"));
+ stem_dir = to_dir (s->get_property ("default-direction"));
if (!stem_dir)
- stem_dir = to_dir (s->get_property ("neutral-direction"));
+ stem_dir = to_dir (s->get_property ("neutral-direction"));
if (stem_dir)
- {
- count[stem_dir] ++;
- total[stem_dir] += max (int (- stem_dir * Stem::head_positions (s) [-stem_dir]), 0);
- }
+ {
+ count[stem_dir]++;
+ total[stem_dir] += max (int (- stem_dir * Stem::head_positions (s) [-stem_dir]), 0);
+ }
}
-
if (!force_dir)
{
if (abs (extremes[UP]) > -extremes[DOWN])
- return DOWN;
+ return DOWN;
else if (extremes[UP] < -extremes[DOWN])
- return UP;
+ return UP;
}
Direction dir = CENTER;
if ((d = (Direction) sign (count[UP] - count[DOWN])))
dir = d;
else if (count[UP]
- && count[DOWN]
- && (d = (Direction) sign (total[UP] / count[UP] - total[DOWN]/count[DOWN])))
+ && count[DOWN]
+ && (d = (Direction) sign (total[UP] / count[UP] - total[DOWN] / count[DOWN])))
dir = d;
- else if ((d = (Direction) sign (total[UP] - total[DOWN])))
+ else if ((d = (Direction) sign (total[UP] - total[DOWN])))
dir = d;
else
dir = to_dir (me->get_property ("neutral-direction"));
SCM forcedir = s->get_property_data ("direction");
if (!to_dir (forcedir))
- set_grob_direction (s, d);
+ set_grob_direction (s, d);
}
}
Interval head_extents = Stem::head_positions (stem);
if (!head_extents.is_empty ())
- {
- head_extents[LEFT] += -1;
- head_extents[RIGHT] += 1;
- head_extents *= staff_space * 0.5;
-
- /*
- We could subtract beam Y position, but this routine only
- sets stem directions, a constant shift does not have an
- influence.
- */
- head_extents += stem->pure_relative_y_coordinate (common, 0, INT_MAX);
-
- if (to_dir (stem->get_property_data ("direction")))
- {
- Direction stemdir = to_dir (stem->get_property ("direction"));
- head_extents[-stemdir] = -stemdir * infinity_f;
- }
- }
+ {
+ head_extents[LEFT] += -1;
+ head_extents[RIGHT] += 1;
+ head_extents *= staff_space * 0.5;
+
+ /*
+ We could subtract beam Y position, but this routine only
+ sets stem directions, a constant shift does not have an
+ influence.
+ */
+ head_extents += stem->pure_relative_y_coordinate (common, 0, INT_MAX);
+
+ if (to_dir (stem->get_property_data ("direction")))
+ {
+ Direction stemdir = to_dir (stem->get_property ("direction"));
+ head_extents[-stemdir] = -stemdir * infinity_f;
+ }
+ }
head_extents_array.push_back (head_extents);
gaps.remove_interval (head_extents);
Interval max_gap;
Real max_gap_len = 0.0;
- for (vsize i = gaps.allowed_regions_.size () -1; i != VPOS ;i--)
+ for (vsize i = gaps.allowed_regions_.size () - 1; i != VPOS; i--)
{
Interval gap = gaps.allowed_regions_[i];
/*
- the outer gaps are not knees.
+ the outer gaps are not knees.
*/
if (isinf (gap[LEFT]) || isinf (gap[RIGHT]))
- continue;
+ continue;
if (gap.length () >= max_gap_len)
- {
- max_gap_len = gap.length ();
- max_gap = gap;
- }
+ {
+ max_gap_len = gap.length ();
+ max_gap = gap;
+ }
}
Real beam_translation = get_beam_translation (me);
Real beam_thickness = Beam::get_beam_thickness (me);
int beam_count = Beam::get_beam_count (me);
Real height_of_beams = beam_thickness / 2
- + (beam_count - 1) * beam_translation;
+ + (beam_count - 1) * beam_translation;
Real threshold = scm_to_double (scm) + height_of_beams;
if (max_gap_len > threshold)
{
int j = 0;
for (vsize i = 0; i < stems.size (); i++)
- {
- Grob *stem = stems[i];
- Interval head_extents = head_extents_array[j++];
+ {
+ Grob *stem = stems[i];
+ Interval head_extents = head_extents_array[j++];
- Direction d = (head_extents.center () < max_gap.center ())
- ? UP : DOWN;
+ Direction d = (head_extents.center () < max_gap.center ())
+ ? UP : DOWN;
- stem->set_property ("direction", scm_from_int (d));
+ stem->set_property ("direction", scm_from_int (d));
- head_extents.intersect (max_gap);
- assert (head_extents.is_empty () || head_extents.length () < 1e-6);
- }
+ head_extents.intersect (max_gap);
+ assert (head_extents.is_empty () || head_extents.length () < 1e-6);
+ }
}
}
entire beam.
*/
-
-
void
set_minimum_dy (Grob *me, Real *dy)
{
if (*dy)
{
/*
- If dy is smaller than the smallest quant, we
- get absurd direction-sign penalties.
+ If dy is smaller than the smallest quant, we
+ get absurd direction-sign penalties.
*/
Real ss = Staff_symbol_referencer::staff_space (me);
Real hang = 1.0 - (beam_thickness - slt) / 2;
*dy = sign (*dy) * max (fabs (*dy),
- min (min (sit, inter), hang));
+ min (min (sit, inter), hang));
}
}
-
-
MAKE_SCHEME_CALLBACK (Beam, calc_stem_shorten, 1)
SCM
Beam::calc_stem_shorten (SCM smob)
return scm_from_int (0);
Real forced_fraction = 1.0 * forced_stem_count (me)
- / normal_stem_count (me);
+ / normal_stem_count (me);
int beam_count = get_beam_count (me);
Real staff_space = Staff_symbol_referencer::staff_space (me);
SCM shorten_elt
- = robust_list_ref (beam_count -1, shorten_list);
+ = robust_list_ref (beam_count - 1, shorten_list);
Real shorten = scm_to_double (shorten_elt) * staff_space;
shorten *= forced_fraction;
-
if (shorten)
return scm_from_double (shorten);
return scm_from_double (0.0);
}
-
Interval
Beam::no_visible_stem_positions (Grob *me, Interval default_value)
{
Interval head_positions;
Slice multiplicity;
- for (vsize i = 0; i < stems.size(); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
head_positions.unite (Stem::head_positions (stems[i]));
multiplicity.unite (Stem::beam_multiplicity (stems[i]));
programming_error ("The beam should have a direction by now.");
Real y = head_positions.linear_combination (dir)
- * 0.5 * Staff_symbol_referencer::staff_space (me)
- + dir * get_beam_translation (me) * (multiplicity.length () + 1);
+ * 0.5 * Staff_symbol_referencer::staff_space (me)
+ + dir * get_beam_translation (me) * (multiplicity.length () + 1);
y /= Staff_symbol_referencer::staff_space (me);
- return Interval (y,y);
+ return Interval (y, y);
}
-
/*
Compute a first approximation to the beam slope.
*/
Grob *me = unsmob_grob (smob);
int count = normal_stem_count (me);
- Interval pos (0,0);
+ Interval pos (0, 0);
if (count < 1)
return ly_interval2scm (no_visible_stem_positions (me, pos));
Grob *lvs = last_normal_stem (me);
Interval ideal (Stem::get_stem_info (fvs).ideal_y_
- + fvs->relative_coordinate (commony, Y_AXIS) - my_y,
- Stem::get_stem_info (lvs).ideal_y_
- + lvs->relative_coordinate (commony, Y_AXIS) - my_y);
+ + fvs->relative_coordinate (commony, Y_AXIS) - my_y,
+ Stem::get_stem_info (lvs).ideal_y_
+ + lvs->relative_coordinate (commony, Y_AXIS) - my_y);
Real x0 = first_normal_stem (me)->relative_coordinate (commonx, X_AXIS);
for (vsize i = 0; i < stems.size (); i++)
if (!ideal.delta ())
{
Interval chord (Stem::chord_start_y (stems[0]),
- Stem::chord_start_y (stems.back ()));
+ Stem::chord_start_y (stems.back ()));
/* Simple beams (2 stems) on middle line should be allowed to be
- slightly sloped.
+ slightly sloped.
- However, if both stems reach middle line,
- ideal[LEFT] == ideal[RIGHT] and ideal.delta () == 0.
+ However, if both stems reach middle line,
+ ideal[LEFT] == ideal[RIGHT] and ideal.delta () == 0.
- For that case, we apply artificial slope */
+ For that case, we apply artificial slope */
if (!ideal[LEFT] && chord.delta () && count == 2)
- {
- /* FIXME. -> UP */
- Direction d = (Direction) (sign (chord.delta ()) * UP);
- pos[d] = get_beam_thickness (me) / 2;
- pos[-d] = -pos[d];
- }
+ {
+ /* FIXME. -> UP */
+ Direction d = (Direction) (sign (chord.delta ()) * UP);
+ pos[d] = get_beam_thickness (me) / 2;
+ pos[-d] = -pos[d];
+ }
else
- pos = ideal;
+ pos = ideal;
/*
- For broken beams this doesn't work well. In this case, the
- slope esp. of the first part of a broken beam should predict
- where the second part goes.
+ For broken beams this doesn't work well. In this case, the
+ slope esp. of the first part of a broken beam should predict
+ where the second part goes.
*/
ldy = pos[RIGHT] - pos[LEFT];
}
{
vector<Offset> ideals;
for (vsize i = 0; i < stems.size (); i++)
- {
- Grob *s = stems[i];
- ideals.push_back (Offset (x_posns[i],
- Stem::get_stem_info (s).ideal_y_
- + s->relative_coordinate (commony, Y_AXIS)
- - my_y));
- }
+ {
+ Grob *s = stems[i];
+ ideals.push_back (Offset (x_posns[i],
+ Stem::get_stem_info (s).ideal_y_
+ + s->relative_coordinate (commony, Y_AXIS)
+ - my_y));
+ }
minimise_least_squares (&slope, &y, ideals);
*/
scale_drul (&pos, 1 / Staff_symbol_referencer::staff_space (me));
- me->set_property ("least-squares-dy", scm_from_double (ldy));
+ me->set_property ("least-squares-dy", scm_from_double (ldy));
return ly_interval2scm (pos);
}
-
// Assuming V is not empty, pick a 'reasonable' point inside V.
static Real
point_in_interval (Interval v, Real dist)
extract_grob_set (me, "covered-grobs", covered);
Grob *common[NO_AXES] = { me, me };
- for (Axis a = X_AXIS; a < NO_AXES; incr (a)) {
- common[a] = common_refpoint_of_array (stems, me, a);
- common[a] = common_refpoint_of_array (covered, common[a], a);
- }
+ for (Axis a = X_AXIS; a < NO_AXES; incr (a))
+ {
+ common[a] = common_refpoint_of_array (stems, me, a);
+ common[a] = common_refpoint_of_array (covered, common[a], a);
+ }
Grob *fvs = first_normal_stem (me);
if (!fvs)
{
Grob *s = stems[i];
if (Stem::is_invisible (s))
- continue;
+ continue;
Direction d = get_grob_direction (s);
Real left_y
- = Stem::get_stem_info (s).shortest_y_
- - slope * x_posns [i];
+ = Stem::get_stem_info (s).shortest_y_
+ - slope * x_posns [i];
/*
- left_y is now relative to the stem S. We want relative to
- ourselves, so translate:
+ left_y is now relative to the stem S. We want relative to
+ ourselves, so translate:
*/
left_y
- += + s->relative_coordinate (common[Y_AXIS], Y_AXIS)
- - me->relative_coordinate (common[Y_AXIS], Y_AXIS);
+ += + s->relative_coordinate (common[Y_AXIS], Y_AXIS)
+ - me->relative_coordinate (common[Y_AXIS], Y_AXIS);
Interval flp;
flp.set_full ();
feasible_left_point.intersect (flp);
}
- vector<Grob*> filtered;
+ vector<Grob *> filtered;
/*
We only update these for objects that are too large for quanting
to find a workaround. Typically, these are notes with
// A list of intervals into which beams may not fall
vector<Interval> forbidden_intervals;
- for (vsize i = 0; i < covered.size(); i++)
+ for (vsize i = 0; i < covered.size (); i++)
{
- if (!covered[i]->is_live())
+ if (!covered[i]->is_live ())
continue;
if (Beam::has_interface (covered[i]) && is_cross_staff (covered[i]))
would resolve the problem, eg.
x x
- | |
+ | |
=====
=====
- | |
+ | |
x x
-
+
Such beams would need a coordinating grob to resolve
the collision, since both will likely want to occupy
the centerline.
while (flip (&d) != LEFT);
}
- Grob_array *arr =
- Pointer_group_interface::get_grob_array (me,
- ly_symbol2scm ("covered-grobs"));
+ Grob_array *arr
+ = Pointer_group_interface::get_grob_array (me,
+ ly_symbol2scm ("covered-grobs"));
arr->set_array (filtered);
vector_sort (forbidden_intervals, Interval::left_less);
do
{
if (!feasible_left_point.contains (feasible_beam_placements[d]))
- feasible_beam_placements[d] = d*infinity_f;
+ feasible_beam_placements[d] = d * infinity_f;
}
while (flip (&d) != DOWN);
Grob *commonx = fvs->common_refpoint (lvs, X_AXIS);
Real dx = last_normal_stem (me)->relative_coordinate (commonx, X_AXIS)
- - first_normal_stem (me)->relative_coordinate (commonx, X_AXIS);
+ - first_normal_stem (me)->relative_coordinate (commonx, X_AXIS);
Real slope = dy && dx ? dy / dx : 0;
return ly_interval2scm (pos);
}
-
MAKE_SCHEME_CALLBACK (Beam, quanting, 2);
SCM
Beam::quanting (SCM smob, SCM posns)
{
Grob *me = unsmob_grob (smob);
- Drul_array<Real> ys(0, 0);
+ Drul_array<Real> ys (0, 0);
ys = robust_scm2drul (posns, ys);
Beam_scoring_problem problem (me, ys);
return ly_interval2scm (ys);
}
-
/*
Report slice containing the numbers that are both in (car BEAMING)
and (cdr BEAMING)
{
if (scm_c_memq (scm_car (s), scm_cdr (beaming)) != SCM_BOOL_F)
- l.add_point (scm_to_int (scm_car (s)));
+ l.add_point (scm_to_int (scm_car (s)));
}
return l;
in POS for stem S. This Y position is relative to S. */
Real
Beam::calc_stem_y (Grob *me, Grob *stem, Grob **common,
- Real xl, Real xr, Direction feather_dir,
- Drul_array<Real> pos, bool french)
+ Real xl, Real xr, Direction feather_dir,
+ Drul_array<Real> pos, bool french)
{
Real beam_translation = get_beam_translation (me);
Direction stem_dir = get_grob_direction (stem);
Real dx = xr - xl;
- Real relx = dx ? (stem->relative_coordinate (common[X_AXIS], X_AXIS) - xl)/dx : 0;
- Real xdir = 2*relx-1;
+ Real relx = dx ? (stem->relative_coordinate (common[X_AXIS], X_AXIS) - xl) / dx : 0;
+ Real xdir = 2 * relx - 1;
- Real stem_y = linear_combination(pos, xdir);
+ Real stem_y = linear_combination (pos, xdir);
SCM beaming = stem->get_property ("beaming");
Slice beam_slice (french
- ? where_are_the_whole_beams (beaming)
- : Stem::beam_multiplicity (stem));
+ ? where_are_the_whole_beams (beaming)
+ : Stem::beam_multiplicity (stem));
if (beam_slice.is_empty ())
- beam_slice = Slice (0,0);
- Interval beam_multiplicity(beam_slice[LEFT],
- beam_slice[RIGHT]);
+ beam_slice = Slice (0, 0);
+ Interval beam_multiplicity (beam_slice[LEFT],
+ beam_slice[RIGHT]);
/*
feather dir = 1 , relx 0->1 : factor 0 -> 1
feather_factor = 1 - relx;
stem_y += feather_factor * beam_translation
- * beam_multiplicity[Direction(((french) ? DOWN : UP)*stem_dir)];
+ * beam_multiplicity[Direction (((french) ? DOWN : UP) * stem_dir)];
Real id = me->relative_coordinate (common[Y_AXIS], Y_AXIS)
- - stem->relative_coordinate (common[Y_AXIS], Y_AXIS);
+ - stem->relative_coordinate (common[Y_AXIS], Y_AXIS);
return stem_y + id;
}
bool french = to_boolean (s->get_property ("french-beaming"));
Real stem_y = calc_stem_y (me, s, common,
- xl, xr, feather_dir,
- pos, french && s != lvs && s!= fvs);
+ xl, xr, feather_dir,
+ pos, french && s != lvs && s != fvs);
/*
- Make the stems go up to the end of the beam. This doesn't matter
- for normal beams, but for tremolo beams it looks silly otherwise.
+ Make the stems go up to the end of the beam. This doesn't matter
+ for normal beams, but for tremolo beams it looks silly otherwise.
*/
if (gap
- && !Stem::is_invisible (s))
- stem_y += thick * 0.5 * get_grob_direction (s);
+ && !Stem::is_invisible (s))
+ stem_y += thick * 0.5 * get_grob_direction (s);
/*
- Do set_stemend for invisible stems too, so tuplet brackets
- have a reference point for sloping
+ Do set_stemend for invisible stems too, so tuplet brackets
+ have a reference point for sloping
*/
Stem::set_stemend (s, 2 * stem_y / staff_space);
}
for (vsize i = 0; i < stems.size (); i++)
{
/*
- Don't overwrite user settings.
+ Don't overwrite user settings.
*/
do
- {
- Grob *stem = stems[i];
- SCM beaming_prop = stem->get_property ("beaming");
- if (beaming_prop == SCM_EOL
- || index_get_cell (beaming_prop, d) == SCM_EOL)
- {
- int count = beaming->beamlet_count (i, d);
- if (i > 0
- && i + 1 < stems.size ()
- && Stem::is_invisible (stem))
- count = min (count, beaming->beamlet_count (i,-d));
-
- if ( ((i == 0 && d == LEFT)
- || (i == stems.size ()-1 && d == RIGHT))
- && stems.size () > 1
- && to_boolean (me->get_property ("clip-edges")))
- count = 0;
-
- Stem::set_beaming (stem, count, d);
- }
- }
+ {
+ Grob *stem = stems[i];
+ SCM beaming_prop = stem->get_property ("beaming");
+ if (beaming_prop == SCM_EOL
+ || index_get_cell (beaming_prop, d) == SCM_EOL)
+ {
+ int count = beaming->beamlet_count (i, d);
+ if (i > 0
+ && i + 1 < stems.size ()
+ && Stem::is_invisible (stem))
+ count = min (count, beaming->beamlet_count (i, -d));
+
+ if ( ((i == 0 && d == LEFT)
+ || (i == stems.size () - 1 && d == RIGHT))
+ && stems.size () > 1
+ && to_boolean (me->get_property ("clip-edges")))
+ count = 0;
+
+ Stem::set_beaming (stem, count, d);
+ }
+ }
while (flip (&d) != LEFT);
}
}
Grob *s = stems[i];
/* I can imagine counting those boundaries as a half forced stem,
- but let's count them full for now. */
+ but let's count them full for now. */
Direction defdir = to_dir (s->get_property ("default-direction"));
if (abs (Stem::chord_start_y (s)) > 0.1
- && defdir
- && get_grob_direction (s) != defdir)
- f++;
+ && defdir
+ && get_grob_direction (s) != defdir)
+ f++;
}
return f;
}
return scm_from_double (0.0);
Drul_array<Real> pos (robust_scm2drul (beam->get_property ("positions"),
- Drul_array<Real> (0,0)));
+ Drul_array<Real> (0, 0)));
Real staff_space = Staff_symbol_referencer::staff_space (rest);
Real dy = pos[RIGHT] - pos[LEFT];
- Drul_array<Grob*> visible_stems (first_normal_stem (beam),
- last_normal_stem (beam));
+ Drul_array<Grob *> visible_stems (first_normal_stem (beam),
+ last_normal_stem (beam));
extract_grob_set (beam, "stems", stems);
Grob *common = common_refpoint_of_array (stems, beam, X_AXIS);
Direction d = get_grob_direction (stem);
Real stem_y = pos[LEFT]
- + (stem->relative_coordinate (common, X_AXIS) - x0) * slope;
+ + (stem->relative_coordinate (common, X_AXIS) - x0) * slope;
Real beam_translation = get_beam_translation (beam);
Real beam_thickness = Beam::get_beam_thickness (beam);
= Stem::beam_multiplicity (stem).length () + 1;
Real height_of_my_beams = beam_thickness / 2
- + (beam_count - 1) * beam_translation;
+ + (beam_count - 1) * beam_translation;
Real beam_y = stem_y - d * height_of_my_beams;
Grob *common_y = rest->common_refpoint (beam, Y_AXIS);
Real rest_dim = rest_extent[d];
Real minimum_distance
= staff_space * (robust_scm2double (stem->get_property ("stemlet-length"), 0.0)
- + robust_scm2double (rest->get_property ("minimum-distance"), 0.0));
+ + robust_scm2double (rest->get_property ("minimum-distance"), 0.0));
Real shift = d * min (d * (beam_y - d * minimum_distance - rest_dim), 0.0);
{
Direction dir = get_grob_direction (stems[i]);
if (d && d != dir)
- {
- knee = true;
- break;
- }
+ {
+ knee = true;
+ break;
+ }
d = dir;
}
for (vsize i = stems.size (); i--;)
{
/*
- Should we take invisible stems into account?
+ Should we take invisible stems into account?
*/
if (get_grob_direction (stems[i]) == d)
- bc = max (bc, (Stem::beam_multiplicity (stems[i]).length () + 1));
+ bc = max (bc, (Stem::beam_multiplicity (stems[i]).length () + 1));
}
return bc;
}
ADD_INTERFACE (Beam,
- "A beam.\n"
- "\n"
- "The @code{beam-thickness} property is the weight of beams,"
- " measured in staffspace. The @code{direction} property is"
- " not user-serviceable. Use the @code{direction} property"
- " of @code{Stem} instead.\n"
+ "A beam.\n"
+ "\n"
+ "The @code{beam-thickness} property is the weight of beams,"
+ " measured in staffspace. The @code{direction} property is"
+ " not user-serviceable. Use the @code{direction} property"
+ " of @code{Stem} instead.\n"
"\n"
"The following properties may be set in the @code{details}"
" list.\n"
" calculating direction penalties.\n"
"@end table\n",
- /* properties */
- "annotation "
- "auto-knee-gap "
- "beamed-stem-shorten "
- "beaming "
- "beam-thickness "
- "break-overshoot "
- "clip-edges "
- "concaveness "
- "collision-interfaces "
- "collision-voice-only "
- "covered-grobs "
- "damping "
- "details "
- "direction "
- "gap "
- "gap-count "
- "grow-direction "
- "inspect-quants "
- "knee "
- "length-fraction "
- "least-squares-dy "
- "neutral-direction "
- "normal-stems "
- "positions "
- "quantized-positions "
- "shorten "
- "stems "
- );
+ /* properties */
+ "annotation "
+ "auto-knee-gap "
+ "beamed-stem-shorten "
+ "beaming "
+ "beam-thickness "
+ "break-overshoot "
+ "clip-edges "
+ "concaveness "
+ "collision-interfaces "
+ "collision-voice-only "
+ "covered-grobs "
+ "damping "
+ "details "
+ "direction "
+ "gap "
+ "gap-count "
+ "grow-direction "
+ "inspect-quants "
+ "knee "
+ "length-fraction "
+ "least-squares-dy "
+ "neutral-direction "
+ "normal-stems "
+ "positions "
+ "quantized-positions "
+ "shorten "
+ "stems "
+ );
return CENTER;
int count = infos_[i].count (LEFT); // Both directions should still be the same
- int left_count = infos_[i-1].count (RIGHT);
- int right_count = infos_[i+1].count (LEFT);
+ int left_count = infos_[i - 1].count (RIGHT);
+ int right_count = infos_[i + 1].count (LEFT);
// If we are told to subdivide beams and we are next to a beat, point the
// beamlet away from the beat.
if (options.subdivide_beams_)
{
if (infos_[i].rhythmic_importance_ < 0)
- return RIGHT;
- else if (infos_[i+1].rhythmic_importance_ < 0)
- return LEFT;
+ return RIGHT;
+ else if (infos_[i + 1].rhythmic_importance_ < 0)
+ return LEFT;
}
if (count <= left_count && count <= right_count)
return LEFT;
// If all else fails, point the beamlet away from the important moment.
- return (infos_[i].rhythmic_importance_ <= infos_[i+1].rhythmic_importance_) ? RIGHT : LEFT;
+ return (infos_[i].rhythmic_importance_ <= infos_[i + 1].rhythmic_importance_) ? RIGHT : LEFT;
}
void
Beaming_pattern::de_grace ()
{
- for (vsize i = 0; i < infos_.size (); i ++)
+ for (vsize i = 0; i < infos_.size (); i++)
{
infos_[i].de_grace ();
}
{
Direction non_flag_dir = other_dir (flag_direction (options, i));
if (non_flag_dir)
- {
- int importance = (non_flag_dir == LEFT)
- ? infos_[i].rhythmic_importance_ : infos_[i+1].rhythmic_importance_;
- int count = (importance < 0 && options.subdivide_beams_)
- ? 1 : min (infos_[i].count (non_flag_dir),
- infos_[i+non_flag_dir].count (-non_flag_dir));
-
- infos_[i].beam_count_drul_[non_flag_dir] = count;
- }
+ {
+ int importance = (non_flag_dir == LEFT)
+ ? infos_[i].rhythmic_importance_ : infos_[i + 1].rhythmic_importance_;
+ int count = (importance < 0 && options.subdivide_beams_)
+ ? 1 : min (infos_[i].count (non_flag_dir),
+ infos_[i + non_flag_dir].count (-non_flag_dir));
+
+ infos_[i].beam_count_drul_[non_flag_dir] = count;
+ }
}
}
// If a beat grouping is not specified, default to 2 beats per group.
int count = 2;
if (scm_is_pair (grouping))
- {
- count = scm_to_int (scm_car (grouping));
- grouping = scm_cdr (grouping);
- }
+ {
+ count = scm_to_int (scm_car (grouping));
+ grouping = scm_cdr (grouping);
+ }
// Mark the start of this beat group
if (infos_[i].start_moment_ == measure_pos)
- infos_[i].rhythmic_importance_ = -2;
+ infos_[i].rhythmic_importance_ = -2;
// Mark the start of each unit up to the end of this beat group.
for (int unit = 1; unit <= count; unit++)
- {
- Moment next_measure_pos = measure_pos + options.base_moment_;
-
- while (i < infos_.size () && infos_[i].start_moment_ < next_measure_pos)
- {
- Moment dt = infos_[i].start_moment_ - measure_pos;
-
- // The rhythmic importance of a stem between beats depends on its fraction
- // of a beat: those stems with a lower denominator are deemed more
- // important.
- // FIXME: This is not the right way to do things for tuplets. For example,
- // in an 8th-note triplet with a quarter-note beat, 1/3 of a beat should be
- // more important than 1/2.
- if (infos_[i].rhythmic_importance_ >= 0)
- infos_[i].rhythmic_importance_ = (int) (dt / options.base_moment_).den ();
-
- i++;
- }
-
- measure_pos = next_measure_pos;
- if (i < infos_.size () && infos_[i].start_moment_ == measure_pos)
- infos_[i].rhythmic_importance_ = -1;
- }
+ {
+ Moment next_measure_pos = measure_pos + options.base_moment_;
+
+ while (i < infos_.size () && infos_[i].start_moment_ < next_measure_pos)
+ {
+ Moment dt = infos_[i].start_moment_ - measure_pos;
+
+ // The rhythmic importance of a stem between beats depends on its fraction
+ // of a beat: those stems with a lower denominator are deemed more
+ // important.
+ // FIXME: This is not the right way to do things for tuplets. For example,
+ // in an 8th-note triplet with a quarter-note beat, 1/3 of a beat should be
+ // more important than 1/2.
+ if (infos_[i].rhythmic_importance_ >= 0)
+ infos_[i].rhythmic_importance_ = (int) (dt / options.base_moment_).den ();
+
+ i++;
+ }
+
+ measure_pos = next_measure_pos;
+ if (i < infos_.size () && infos_[i].start_moment_ == measure_pos)
+ infos_[i].rhythmic_importance_ = -1;
+ }
}
}
-
/*
Invisible stems should be treated as though they have the same number of
beams as their least-beamed neighbour. Here we go through the stems and
for (vsize i = 1; i < infos_.size (); i++)
if (infos_[i].invisible_)
{
- int b = min (infos_[i].count (LEFT), infos_[i-1].count (LEFT));
- infos_[i].beam_count_drul_[LEFT] = b;
- infos_[i].beam_count_drul_[RIGHT] = b;
+ int b = min (infos_[i].count (LEFT), infos_[i - 1].count (LEFT));
+ infos_[i].beam_count_drul_[LEFT] = b;
+ infos_[i].beam_count_drul_[RIGHT] = b;
}
for (vsize i = infos_.size (); i--;)
if (infos_[i].invisible_)
{
- int b = min (infos_[i].count (LEFT), infos_[i+1].count (LEFT));
- infos_[i].beam_count_drul_[LEFT] = b;
- infos_[i].beam_count_drul_[RIGHT] = b;
+ int b = min (infos_[i].count (LEFT), infos_[i + 1].count (LEFT));
+ infos_[i].beam_count_drul_[LEFT] = b;
+ infos_[i].beam_count_drul_[RIGHT] = b;
}
}
-
void
Beaming_pattern::add_stem (Moment m, int b, bool invisible)
{
Beaming_pattern::end_moment (int i) const
{
Duration *dur = new Duration (2 + max (beamlet_count (i, LEFT),
- beamlet_count (i, RIGHT)),
- 0);
+ beamlet_count (i, RIGHT)),
+ 0);
- return infos_.at (i).start_moment_ + dur->get_length();
+ return infos_.at (i).start_moment_ + dur->get_length ();
}
bool
Beaming_pattern *
Beaming_pattern::split_pattern (int i)
{
- Beaming_pattern* new_pattern=0;
+ Beaming_pattern *new_pattern = 0;
int count;
new_pattern = new Beaming_pattern ();
- for (vsize j=i+1; j<infos_.size (); j++)
+ for (vsize j = i + 1; j < infos_.size (); j++)
{
- count = max(beamlet_count (j, LEFT), beamlet_count(j, RIGHT));
+ count = max (beamlet_count (j, LEFT), beamlet_count (j, RIGHT));
new_pattern->add_stem (start_moment (j),
count,
invisibility (j));
}
- for (vsize j=i+1; j<infos_.size (); )
+ for (vsize j = i + 1; j < infos_.size ();)
infos_.pop_back ();
return (new_pattern);
}
void stop_translation_timestep ();
void start_translation_timestep ();
void stop_fall ();
-
+
private:
Moment stop_moment_;
Stream_event *fall_event_;
Bend_engraver::stop_fall ()
{
bool bar = scm_is_string (get_property ("whichBar"));
-
-
+
fall_->set_bound (RIGHT, unsmob_grob (bar
- ? get_property ("currentCommandColumn")
- : get_property ("currentMusicalColumn")));
+ ? get_property ("currentCommandColumn")
+ : get_property ("currentMusicalColumn")));
last_fall_ = fall_;
fall_ = 0;
note_head_ = 0;
void
Bend_engraver::stop_translation_timestep ()
{
- if (fall_ && !fall_->get_bound (LEFT))
+ if (fall_ && !fall_->get_bound (LEFT))
{
fall_->set_bound (LEFT, note_head_);
- fall_->set_parent (note_head_, Y_AXIS);
+ fall_->set_parent (note_head_, Y_AXIS);
}
}
{
if (!fall_event_)
return;
-
+
if (note_head_ && fall_)
{
stop_fall ();
note_head_ = info.grob ();
stop_moment_ = now_mom () + get_event_length (info.event_cause (),
- now_mom ());
+ now_mom ());
}
Bend_engraver::Bend_engraver ()
{
fall_ = make_spanner ("BendAfter", fall_event_->self_scm ());
fall_->set_property ("delta-position",
- scm_from_double (robust_scm2double (fall_event_->get_property ("delta-step"), 0)));
+ scm_from_double (robust_scm2double (fall_event_->get_property ("delta-step"), 0)));
}
}
ADD_ACKNOWLEDGER (Bend_engraver, note_head);
ADD_TRANSLATOR (Bend_engraver,
- /* doc */
- "Create fall spanners.",
+ /* doc */
+ "Create fall spanners.",
- /* create */
- "BendAfter ",
+ /* create */
+ "BendAfter ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
static Real
F0_1 (Real x)
{
- return 2 / M_PI *atan (M_PI *x / 2);
+ return 2 / M_PI * atan (M_PI * x / 2);
}
Real
void
get_slur_indent_height (Real *indent, Real *height,
- Real width, Real h_inf, Real r_0)
+ Real width, Real h_inf, Real r_0)
{
Real max_fraction = 1.0 / 3.1;
*height = slur_height (width, h_inf, r_0);
Real height;
get_slur_indent_height (&indent, &height,
- width, h_inf, r_0);
+ width, h_inf, r_0);
Bezier curve;
curve.control_[0] = Offset (0, 0);
#include "warn.hh"
#include "libc-extension.hh"
-Real binomial_coefficient_3[] = {
+Real binomial_coefficient_3[] =
+{
1, 3, 3, 1
};
Real
Bezier::get_other_coordinate (Axis a, Real x) const
{
- Axis other = Axis ((a +1) % NO_AXES);
+ Axis other = Axis ((a + 1) % NO_AXES);
vector<Real> ts = solve_point (a, x);
if (ts.size () == 0)
for (int j = 0; j < 4; j++)
{
r += control_[j][a] * binomial_coefficient_3[j]
- * tj * one_min_tj[3 - j];
+ * tj * one_min_tj[3 - j];
tj *= t;
}
for (int j = 0; j < 4; j++)
{
o += control_[j] * binomial_coefficient_3[j]
- * tj * one_min_tj[3 - j];
+ * tj * one_min_tj[3 - j];
tj *= t;
}
/*
Cache binom (3, j) t^j (1-t)^{3-j}
*/
-struct Polynomial_cache {
+struct Polynomial_cache
+{
Polynomial terms_[4];
Polynomial_cache ()
{
for (int j = 0; j <= 3; j++)
terms_[j]
- = binomial_coefficient_3[j]
- * Polynomial::power (j, Polynomial (0, 1))
- * Polynomial::power (3 - j, Polynomial (1, -1));
+ = binomial_coefficient_3[j]
+ * Polynomial::power (j, Polynomial (0, 1))
+ * Polynomial::power (3 - j, Polynomial (1, -1));
}
};
Interval
Bezier::extent (Axis a) const
{
- int o = (a + 1)%NO_AXES;
+ int o = (a + 1) % NO_AXES;
Offset d;
d[Axis (o)] = 1.0;
Interval iv;
for (int i = CONTROL_COUNT; i--;)
ext.add_point (control_[i][a]);
- return ext;
+ return ext;
}
-
/**
Flip around axis A
*/
{
for (int i = 0; i < CONTROL_COUNT; i++)
assert (!isnan (control_[i].length ())
- && !isinf (control_[i].length ()));
+ && !isinf (control_[i].length ()));
}
void
*this = b2;
}
-
/*
Subdivide a bezier at T into LEFT_PART and RIGHT_PART
using deCasteljau's algorithm.
{
Offset p[CONTROL_COUNT][CONTROL_COUNT];
- for (int i = 0; i < CONTROL_COUNT ; i++)
+ for (int i = 0; i < CONTROL_COUNT; i++)
p[i][CONTROL_COUNT - 1 ] = control_[i];
- for (int j = CONTROL_COUNT - 2; j >= 0 ; j--)
- for (int i = 0; i < CONTROL_COUNT -1; i++)
- p[i][j] = p[i][j+1] + t * (p[i+1][j+1] - p[i][j+1]);
+ for (int j = CONTROL_COUNT - 2; j >= 0; j--)
+ for (int i = 0; i < CONTROL_COUNT - 1; i++)
+ p[i][j] = p[i][j + 1] + t * (p[i + 1][j + 1] - p[i][j + 1]);
for (int i = 0; i < CONTROL_COUNT; i++)
{
- left_part->control_[i]=p[0][CONTROL_COUNT - 1 - i];
- right_part->control_[i]=p[i][i];
+ left_part->control_[i] = p[0][CONTROL_COUNT - 1 - i];
+ right_part->control_[i] = p[i][i];
}
}
{
if ((t_min < 0) || (t_max) > 1)
programming_error
- ("bezier extract arguments outside of limits: curve may have bad shape");
+ ("bezier extract arguments outside of limits: curve may have bad shape");
if (t_min >= t_max)
- programming_error
- ("lower bezier extract value not less than upper value: curve may have bad shape");
+ programming_error
+ ("lower bezier extract value not less than upper value: curve may have bad shape");
Bezier bez1, bez2, bez3, bez4;
if (t_min == 0.0)
bez2 = *this;
else
- subdivide (t_min, &bez1, &bez2);
+ subdivide (t_min, &bez1, &bez2);
if (t_max == 1.0)
- return bez2;
+ return bez2;
else
- {
- bez2.subdivide ((t_max-t_min)/(1-t_min), &bez3, &bez4);
- return bez3;
- }
+ {
+ bez2.subdivide ((t_max - t_min) / (1 - t_min), &bez3, &bez4);
+ return bez3;
+ }
}
#include "ly-module.hh"
LY_DEFINE (ly_make_book, "ly:make-book",
- 2, 0, 1, (SCM paper, SCM header, SCM scores),
- "Make a @code{\\book} of @var{paper} and @var{header}"
- " (which may be @code{#f} as well) containing @code{\\scores}.")
+ 2, 0, 1, (SCM paper, SCM header, SCM scores),
+ "Make a @code{\\book} of @var{paper} and @var{header}"
+ " (which may be @code{#f} as well) containing @code{\\scores}.")
{
Output_def *odef = unsmob_output_def (paper);
LY_ASSERT_SMOB (Output_def, paper, 1);
}
LY_DEFINE (ly_make_book_part, "ly:make-book-part",
- 1, 0, 0, (SCM scores),
- "Make a @code{\\bookpart} containing @code{\\scores}.")
+ 1, 0, 0, (SCM scores),
+ "Make a @code{\\bookpart} containing @code{\\scores}.")
{
Book *book = new Book;
book->scores_ = scm_append (scm_list_2 (scores, book->scores_));
}
LY_DEFINE (ly_book_process, "ly:book-process",
- 4, 0, 0, (SCM book_smob,
- SCM default_paper,
- SCM default_layout,
- SCM output),
- "Print book. @var{output} is passed to the backend unchanged."
- " For example, it may be a string (for file based outputs)"
- " or a socket (for network based output).")
+ 4, 0, 0, (SCM book_smob,
+ SCM default_paper,
+ SCM default_layout,
+ SCM output),
+ "Print book. @var{output} is passed to the backend unchanged."
+ " For example, it may be a string (for file based outputs)"
+ " or a socket (for network based output).")
{
Book *book = unsmob_book (book_smob);
LY_ASSERT_SMOB (Output_def, default_layout, 3);
Paper_book *pb = book->process (unsmob_output_def (default_paper),
- unsmob_output_def (default_layout));
+ unsmob_output_def (default_layout));
if (pb)
{
pb->output (output);
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_book_process_to_systems, "ly:book-process-to-systems",
- 4, 0, 0, (SCM book_smob,
- SCM default_paper,
- SCM default_layout,
- SCM output),
- "Print book. @var{output} is passed to the backend unchanged."
- " For example, it may be a string (for file based outputs)"
- " or a socket (for network based output).")
+ 4, 0, 0, (SCM book_smob,
+ SCM default_paper,
+ SCM default_layout,
+ SCM output),
+ "Print book. @var{output} is passed to the backend unchanged."
+ " For example, it may be a string (for file based outputs)"
+ " or a socket (for network based output).")
{
LY_ASSERT_SMOB (Book, book_smob, 1);
LY_ASSERT_SMOB (Output_def, default_paper, 2);
LY_ASSERT_SMOB (Output_def, default_layout, 3);
- Book *book = unsmob_book (book_smob);
+ Book *book = unsmob_book (book_smob);
Paper_book *pb = book->process (unsmob_output_def (default_paper),
- unsmob_output_def (default_layout));
+ unsmob_output_def (default_layout));
if (pb)
{
pb->classic_output (output);
}
LY_DEFINE (ly_book_add_score_x, "ly:book-add-score!",
- 2, 0, 0, (SCM book_smob, SCM score),
- "Add @var{score} to @var{book-smob} score list.")
+ 2, 0, 0, (SCM book_smob, SCM score),
+ "Add @var{score} to @var{book-smob} score list.")
{
LY_ASSERT_SMOB (Book, book_smob, 1);
- Book *book = unsmob_book (book_smob);
+ Book *book = unsmob_book (book_smob);
book->add_score (score);
return SCM_UNSPECIFIED;
}
LY_DEFINE (ly_book_add_bookpart_x, "ly:book-add-bookpart!",
- 2, 0, 0, (SCM book_smob, SCM book_part),
- "Add @var{book-part} to @var{book-smob} book part list.")
+ 2, 0, 0, (SCM book_smob, SCM book_part),
+ "Add @var{book-part} to @var{book-smob} book part list.")
{
LY_ASSERT_SMOB (Book, book_smob, 1);
- Book *book = unsmob_book (book_smob);
+ Book *book = unsmob_book (book_smob);
book->add_bookpart (book_part);
return SCM_UNSPECIFIED;
}
LY_DEFINE (ly_book_book_parts, "ly:book-book-parts",
- 1, 0, 0, (SCM book),
- "Return book parts in @var{book}.")
+ 1, 0, 0, (SCM book),
+ "Return book parts in @var{book}.")
{
LY_ASSERT_SMOB (Book, book, 1);
Book *b = unsmob_book (book);
}
LY_DEFINE (ly_book_paper, "ly:book-paper",
- 1, 0, 0, (SCM book),
- "Return paper in @var{book}.")
+ 1, 0, 0, (SCM book),
+ "Return paper in @var{book}.")
{
LY_ASSERT_SMOB (Book, book, 1);
Book *b = unsmob_book (book);
}
LY_DEFINE (ly_book_header, "ly:book-header",
- 1, 0, 0, (SCM book),
- "Return header in @var{book}.")
+ 1, 0, 0, (SCM book),
+ "Return header in @var{book}.")
{
LY_ASSERT_SMOB (Book, book, 1);
Book *b = unsmob_book (book);
}
LY_DEFINE (ly_book_scores, "ly:book-scores",
- 1, 0, 0, (SCM book),
- "Return scores in @var{book}.")
+ 1, 0, 0, (SCM book),
+ "Return scores in @var{book}.")
{
LY_ASSERT_SMOB (Book, book, 1);
Book *b = unsmob_book (book);
SCM entry = scm_car (p);
if (Score *newscore = unsmob_score (entry))
- *t = scm_cons (newscore->clone ()->unprotect (), SCM_EOL);
+ * t = scm_cons (newscore->clone ()->unprotect (), SCM_EOL);
else if (Page_marker *marker = unsmob_page_marker (entry))
- *t = scm_cons (marker->clone ()->unprotect (), SCM_EOL);
+ * t = scm_cons (marker->clone ()->unprotect (), SCM_EOL);
else
- {
- /* This entry is a markup list */
- *t = scm_cons (entry, SCM_EOL);
- }
+ {
+ /* This entry is a markup list */
+ *t = scm_cons (entry, SCM_EOL);
+ }
t = SCM_CDRLOC (*t);
}
}
int
-Book::print_smob (SCM, SCM p, scm_print_state*)
+Book::print_smob (SCM, SCM p, scm_print_state *)
{
scm_puts ("#<Book>", p);
return 1;
for (SCM s = scores_; scm_is_pair (s); s = scm_cdr (s))
if (Score *score = unsmob_score (scm_car (s)))
if (score->error_found_)
- return true;
+ return true;
for (SCM part = bookparts_; scm_is_pair (part); part = scm_cdr (part))
if (Book *bookpart = unsmob_book (scm_car (part)))
if (bookpart->error_found ())
- return true;
+ return true;
return false;
}
Paper_book *
Book::process (Output_def *default_paper,
- Output_def *default_layout)
+ Output_def *default_layout)
{
return process (default_paper, default_layout, 0);
}
{
Paper_book *paper_book_part = book->process (paper, layout, output_paper_book);
if (paper_book_part)
- {
- output_paper_book->add_bookpart (paper_book_part->self_scm ());
- paper_book_part->unprotect ();
- }
+ {
+ output_paper_book->add_bookpart (paper_book_part->self_scm ());
+ paper_book_part->unprotect ();
+ }
}
}
/* In a Paper_book, bookparts are stored in straight order */
if (Score *score = unsmob_score (scm_car (s)))
{
SCM outputs = score
- ->book_rendering (output_paper_book->paper_, layout);
+ ->book_rendering (output_paper_book->paper_, layout);
while (scm_is_pair (outputs))
- {
- Music_output *output = unsmob_music_output (scm_car (outputs));
-
- if (Performance *perf = dynamic_cast<Performance *> (output))
- output_paper_book->add_performance (perf->self_scm ());
- else if (Paper_score *pscore = dynamic_cast<Paper_score *> (output))
- {
- if (ly_is_module (score->get_header ()))
- output_paper_book->add_score (score->get_header ());
- output_paper_book->add_score (pscore->self_scm ());
- }
-
- outputs = scm_cdr (outputs);
- }
+ {
+ Music_output *output = unsmob_music_output (scm_car (outputs));
+
+ if (Performance *perf = dynamic_cast<Performance *> (output))
+ output_paper_book->add_performance (perf->self_scm ());
+ else if (Paper_score *pscore = dynamic_cast<Paper_score *> (output))
+ {
+ if (ly_is_module (score->get_header ()))
+ output_paper_book->add_score (score->get_header ());
+ output_paper_book->add_score (pscore->self_scm ());
+ }
+
+ outputs = scm_cdr (outputs);
+ }
}
else if (Text_interface::is_markup_list (scm_car (s))
- || unsmob_page_marker (scm_car (s)))
+ || unsmob_page_marker (scm_car (s)))
output_paper_book->add_score (scm_car (s));
else
assert (0);
*/
Paper_book *
Book::process (Output_def *default_paper,
- Output_def *default_layout,
- Paper_book *parent_part)
+ Output_def *default_layout,
+ Paper_book *parent_part)
{
Output_def *paper = paper_ ? paper_ : default_paper;
Box::center () const
{
return Offset (interval_a_[X_AXIS].center (),
- interval_a_[Y_AXIS].center ());
+ interval_a_[Y_AXIS].center ());
}
void
}
int
-Box::print_smob (SCM /* x */, SCM p, scm_print_state*)
+Box::print_smob (SCM /* x */, SCM p, scm_print_state *)
{
scm_puts ("#<Box>", p);
return 1;
if (Item *item = dynamic_cast<Item *> (inf.grob ()))
{
/*
- Removed check for item->empty (X_AXIS). --hwn 20/1/04
+ Removed check for item->empty (X_AXIS). --hwn 20/1/04
*/
if (item->get_parent (X_AXIS))
- return;
+ return;
if (!Item::is_non_musical (item))
- return;
+ return;
SCM align_name = item->get_property ("break-align-symbol");
if (!scm_is_symbol (align_name))
- return;
+ return;
if (!align_)
- create_alignment (inf);
+ create_alignment (inf);
add_to_group (align_name, item);
}
*/
left_edge_ = random_source->make_item ("LeftEdge", SCM_EOL);
add_to_group (left_edge_->get_property ("break-align-symbol"),
- left_edge_);
+ left_edge_);
}
void
ADD_ACKNOWLEDGER (Break_align_engraver, break_aligned);
ADD_ACKNOWLEDGER (Break_align_engraver, break_alignable);
ADD_TRANSLATOR (Break_align_engraver,
- /* doc */
- "Align grobs with corresponding @code{break-align-symbols}"
- " into groups, and order the groups according to"
- " @code{breakAlignOrder}. The left edge of the alignment gets"
- " a separate group, with a symbol @code{left-edge}.",
-
- /* create */
- "BreakAlignment "
- "BreakAlignGroup "
- "LeftEdge ",
-
- /* read */
- "",
-
- /* write */
- ""
- );
+ /* doc */
+ "Align grobs with corresponding @code{break-align-symbols}"
+ " into groups, and order the groups according to"
+ " @code{breakAlignOrder}. The left edge of the alignment gets"
+ " a separate group, with a symbol @code{left-edge}.",
+
+ /* create */
+ "BreakAlignment "
+ "BreakAlignGroup "
+ "LeftEdge ",
+
+ /* read */
+ "",
+
+ /* write */
+ ""
+ );
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "break-align-interface.hh"
#include "align-interface.hh"
#include "side-position-interface.hh"
#include "warn.hh"
-
-
/*
This is tricky: we cannot modify 'elements, since callers are
iterating the same list. Reordering the list in-place, or resetting
return SCM_BOOL_F;
SCM order = scm_vector_ref (order_vec,
- scm_from_int (me->break_status_dir () + 1));
-
+ scm_from_int (me->break_status_dir () + 1));
return order;
}
-
-vector<Grob*>
+vector<Grob *>
Break_alignment_interface::ordered_elements (Grob *grob)
{
Item *me = dynamic_cast<Item *> (grob);
extract_grob_set (me, "elements", elts);
-
SCM order = break_align_order (me);
if (order == SCM_BOOL_F)
return elts;
-
- vector<Grob*> writable_elts (elts);
- /*
- Copy in order specified in BREAK-ALIGN-ORDER.
+
+ vector<Grob *> writable_elts (elts);
+ /*
+ Copy in order specified in BREAK-ALIGN-ORDER.
*/
- vector<Grob*> new_elts;
+ vector<Grob *> new_elts;
for (; scm_is_pair (order); order = scm_cdr (order))
{
SCM sym = scm_car (order);
for (vsize i = writable_elts.size (); i--;)
- {
- Grob *g = writable_elts[i];
- if (g && sym == g->get_property ("break-align-symbol"))
- {
- new_elts.push_back (g);
- writable_elts.erase (writable_elts.begin () + i);
- }
- }
+ {
+ Grob *g = writable_elts[i];
+ if (g && sym == g->get_property ("break-align-symbol"))
+ {
+ new_elts.push_back (g);
+ writable_elts.erase (writable_elts.begin () + i);
+ }
+ }
}
return new_elts;
SCM
Break_alignment_interface::calc_positioning_done (SCM smob)
{
- Grob *grob = unsmob_grob (smob);
+ Grob *grob = unsmob_grob (smob);
Item *me = dynamic_cast<Item *> (grob);
-
me->set_property ("positioning-done", SCM_BOOL_T);
- vector<Grob*> elems = ordered_elements (me);
+ vector<Grob *> elems = ordered_elements (me);
vector<Interval> extents;
int last_nonempty = -1;
Interval y = elems[i]->extent (elems[i], X_AXIS);
extents.push_back (y);
if (!y.is_empty ())
- last_nonempty = i;
+ last_nonempty = i;
}
vsize idx = 0;
vector<Real> offsets;
offsets.resize (elems.size ());
- for (vsize i = 0; i < offsets.size ();i++)
+ for (vsize i = 0; i < offsets.size (); i++)
offsets[i] = 0.0;
Real extra_right_space = 0.0;
{
vsize next_idx = idx + 1;
while (next_idx < elems.size ()
- && extents[next_idx].is_empty ())
- next_idx++;
+ && extents[next_idx].is_empty ())
+ next_idx++;
Grob *l = elems[idx];
Grob *r = 0;
if (next_idx < elems.size ())
- r = elems[next_idx];
+ r = elems[next_idx];
SCM alist = SCM_EOL;
/*
- Find the first grob with a space-alist entry.
+ Find the first grob with a space-alist entry.
*/
extract_grob_set (l, "elements", elts);
for (vsize i = elts.size (); i--;)
- {
- Grob *elt = elts[i];
-
- if (edge_idx == VPOS
- && (elt->get_property ("break-align-symbol")
- == ly_symbol2scm ("left-edge")))
- edge_idx = idx;
-
- SCM l = elt->get_property ("space-alist");
- if (scm_is_pair (l))
- {
- alist = l;
- break;
- }
- }
+ {
+ Grob *elt = elts[i];
+
+ if (edge_idx == VPOS
+ && (elt->get_property ("break-align-symbol")
+ == ly_symbol2scm ("left-edge")))
+ edge_idx = idx;
+
+ SCM l = elt->get_property ("space-alist");
+ if (scm_is_pair (l))
+ {
+ alist = l;
+ break;
+ }
+ }
SCM rsym = r ? SCM_EOL : ly_symbol2scm ("right-edge");
/*
- We used to use #'cause to find out the symbol and the spacing
- table, but that gets icky when that grob is suicided for some
- reason.
+ We used to use #'cause to find out the symbol and the spacing
+ table, but that gets icky when that grob is suicided for some
+ reason.
*/
if (r)
- {
- extract_grob_set (r, "elements", elts);
- for (vsize i = elts.size ();
- !scm_is_symbol (rsym) && i--;)
- {
- Grob *elt = elts[i];
- rsym = elt->get_property ("break-align-symbol");
- }
- }
+ {
+ extract_grob_set (r, "elements", elts);
+ for (vsize i = elts.size ();
+ !scm_is_symbol (rsym) && i--;)
+ {
+ Grob *elt = elts[i];
+ rsym = elt->get_property ("break-align-symbol");
+ }
+ }
if (rsym == ly_symbol2scm ("left-edge"))
- edge_idx = next_idx;
+ edge_idx = next_idx;
SCM entry = SCM_EOL;
if (scm_is_symbol (rsym))
- entry = scm_assq (rsym, alist);
+ entry = scm_assq (rsym, alist);
bool entry_found = scm_is_pair (entry);
if (!entry_found)
- {
- string sym_string;
- if (scm_is_symbol (rsym))
- sym_string = ly_symbol2string (rsym);
+ {
+ string sym_string;
+ if (scm_is_symbol (rsym))
+ sym_string = ly_symbol2string (rsym);
- string orig_string;
- if (unsmob_grob (l->get_property ("cause")))
- orig_string = unsmob_grob (l->get_property ("cause"))->name ();
+ string orig_string;
+ if (unsmob_grob (l->get_property ("cause")))
+ orig_string = unsmob_grob (l->get_property ("cause"))->name ();
- programming_error (_f ("No spacing entry from %s to `%s'",
- orig_string.c_str (),
- sym_string.c_str ()));
- }
+ programming_error (_f ("No spacing entry from %s to `%s'",
+ orig_string.c_str (),
+ sym_string.c_str ()));
+ }
Real distance = 1.0;
SCM type = ly_symbol2scm ("extra-space");
if (entry_found)
- {
- entry = scm_cdr (entry);
+ {
+ entry = scm_cdr (entry);
- distance = scm_to_double (scm_cdr (entry));
- type = scm_car (entry);
- }
+ distance = scm_to_double (scm_cdr (entry));
+ type = scm_car (entry);
+ }
if (r)
- {
- if (type == ly_symbol2scm ("extra-space"))
- offsets[next_idx] = extents[idx][RIGHT] + distance
- - extents[next_idx][LEFT];
- /* should probably junk minimum-space */
- else if (type == ly_symbol2scm ("minimum-space"))
- offsets[next_idx] = max (extents[idx][RIGHT], distance);
- }
+ {
+ if (type == ly_symbol2scm ("extra-space"))
+ offsets[next_idx] = extents[idx][RIGHT] + distance
+ - extents[next_idx][LEFT];
+ /* should probably junk minimum-space */
+ else if (type == ly_symbol2scm ("minimum-space"))
+ offsets[next_idx] = max (extents[idx][RIGHT], distance);
+ }
else
- {
- extra_right_space = distance;
- if (idx + 1 < offsets.size ())
- offsets[idx+1] = extents[idx][RIGHT] + distance;
- }
+ {
+ extra_right_space = distance;
+ if (idx + 1 < offsets.size ())
+ offsets[idx + 1] = extents[idx][RIGHT] + distance;
+ }
idx = next_idx;
}
{
here += offsets[i];
if (i == edge_idx)
- alignment_off = -here;
+ alignment_off = -here;
total_extent.unite (extents[i] + here);
}
return SCM_BOOL_T;
}
-
-
MAKE_SCHEME_CALLBACK (Break_alignable_interface, self_align_callback, 1)
SCM
Break_alignable_interface::self_align_callback (SCM grob)
{
Grob *me = unsmob_grob (grob);
- Item *alignment = dynamic_cast<Item*> (me->get_parent (X_AXIS));
+ Item *alignment = dynamic_cast<Item *> (me->get_parent (X_AXIS));
if (!Break_alignment_interface::has_interface (alignment))
return scm_from_int (0);
SCM symbol_list = me->get_property ("break-align-symbols");
- vector<Grob*> elements = Break_alignment_interface::ordered_elements (alignment);
+ vector<Grob *> elements = Break_alignment_interface::ordered_elements (alignment);
if (elements.size () == 0)
return scm_from_int (0);
-
+
int break_aligned_grob = -1;
for (; scm_is_pair (symbol_list); symbol_list = scm_cdr (symbol_list))
{
SCM sym = scm_car (symbol_list);
for (vsize i = 0; i < elements.size (); i++)
- {
- if (elements[i]->get_property ("break-align-symbol") == sym)
- {
- if (Item::break_visible (elements[i])
- && !elements[i]->extent (elements[i], X_AXIS).is_empty ())
- {
- break_aligned_grob = i;
- goto found_break_aligned_grob; /* ugh. need to break out of 2 loops */
- }
- else if (break_aligned_grob == -1)
- break_aligned_grob = i;
- }
- }
+ {
+ if (elements[i]->get_property ("break-align-symbol") == sym)
+ {
+ if (Item::break_visible (elements[i])
+ && !elements[i]->extent (elements[i], X_AXIS).is_empty ())
+ {
+ break_aligned_grob = i;
+ goto found_break_aligned_grob; /* ugh. need to break out of 2 loops */
+ }
+ else if (break_aligned_grob == -1)
+ break_aligned_grob = i;
+ }
+ }
}
found_break_aligned_grob:
Real anchor = robust_scm2double (alignment_parent->get_property ("break-align-anchor"), 0);
return scm_from_double (alignment_parent->relative_coordinate (common, X_AXIS)
- - me->relative_coordinate (common, X_AXIS)
- + anchor);
+ - me->relative_coordinate (common, X_AXIS)
+ + anchor);
}
MAKE_SCHEME_CALLBACK (Break_aligned_interface, calc_average_anchor, 1)
{
SCM anchor = elts[i]->get_property ("break-align-anchor");
if (scm_is_number (anchor))
- {
- count++;
- avg += scm_to_double (anchor);
- }
+ {
+ count++;
+ avg += scm_to_double (anchor);
+ }
}
return scm_from_double (count > 0 ? avg / count : 0);
{
bool visible = false;
for (vsize i = 0; i < elts.size (); i++)
- {
- SCM vis = elts[i]->get_property ("break-visibility");
- if (scm_is_vector (vis) && to_boolean (scm_c_vector_ref (vis, dir)))
- visible = true;
- }
+ {
+ SCM vis = elts[i]->get_property ("break-visibility");
+ if (scm_is_vector (vis) && to_boolean (scm_c_vector_ref (vis, dir)))
+ visible = true;
+ }
scm_c_vector_set_x (ret, dir, scm_from_bool (visible));
}
return ret;
}
ADD_INTERFACE (Break_alignable_interface,
- "Object that is aligned on a break alignment.",
+ "Object that is aligned on a break alignment.",
- /* properties */
- "break-align-symbols "
- "non-break-align-symbols "
- );
+ /* properties */
+ "break-align-symbols "
+ "non-break-align-symbols "
+ );
ADD_INTERFACE (Break_aligned_interface,
- "Items that are aligned in prefatory matter.\n"
- "\n"
- "The spacing of these items is controlled by the"
- " @code{space-alist} property. It contains a list"
- " @code{break-align-symbol}s with a specification of the"
- " associated space. The space specification can be\n"
- "\n"
- "@table @code\n"
- "@item (minimum-space . @var{spc}))\n"
- "Pad space until the distance is @var{spc}.\n"
- "@item (fixed-space . @var{spc})\n"
- "Set a fixed space.\n"
- "@item (semi-fixed-space . @var{spc})\n"
- "Set a space. Half of it is fixed and half is stretchable."
- " (does not work at start of line. fixme)\n"
- "@item (extra-space . @var{spc})\n"
- "Add @var{spc} amount of space.\n"
- "@end table\n"
- "\n"
- "Special keys for the alist are @code{first-note} and"
- " @code{next-note}, signifying the first note on a line, and"
- " the next note halfway a line.\n"
- "\n"
- "Rules for this spacing are much more complicated than this."
- " See [Wanske] page 126--134, [Ross] page 143--147.",
-
- /* properties */
- "break-align-anchor "
- "break-align-anchor-alignment "
- "break-align-symbol "
- "space-alist "
- );
+ "Items that are aligned in prefatory matter.\n"
+ "\n"
+ "The spacing of these items is controlled by the"
+ " @code{space-alist} property. It contains a list"
+ " @code{break-align-symbol}s with a specification of the"
+ " associated space. The space specification can be\n"
+ "\n"
+ "@table @code\n"
+ "@item (minimum-space . @var{spc}))\n"
+ "Pad space until the distance is @var{spc}.\n"
+ "@item (fixed-space . @var{spc})\n"
+ "Set a fixed space.\n"
+ "@item (semi-fixed-space . @var{spc})\n"
+ "Set a space. Half of it is fixed and half is stretchable."
+ " (does not work at start of line. fixme)\n"
+ "@item (extra-space . @var{spc})\n"
+ "Add @var{spc} amount of space.\n"
+ "@end table\n"
+ "\n"
+ "Special keys for the alist are @code{first-note} and"
+ " @code{next-note}, signifying the first note on a line, and"
+ " the next note halfway a line.\n"
+ "\n"
+ "Rules for this spacing are much more complicated than this."
+ " See [Wanske] page 126--134, [Ross] page 143--147.",
+
+ /* properties */
+ "break-align-anchor "
+ "break-align-anchor-alignment "
+ "break-align-symbol "
+ "space-alist "
+ );
ADD_INTERFACE (Break_alignment_interface,
- "The object that performs break alignment. See"
- " @ref{break-aligned-interface}.",
+ "The object that performs break alignment. See"
+ " @ref{break-aligned-interface}.",
- /* properties */
- "positioning-done "
- "break-align-orders "
- );
+ /* properties */
+ "positioning-done "
+ "break-align-orders "
+ );
Item *i = dynamic_cast<Item *> (sc);
Direction d = to_dir (break_criterion);
if (i && i->break_status_dir () != d)
- {
- Item *br = i->find_prebroken_piece (d);
- return br;
- }
+ {
+ Item *br = i->find_prebroken_piece (d);
+ return br;
+ }
}
else
{
System *line
- = dynamic_cast<System *> (unsmob_grob (break_criterion));
+ = dynamic_cast<System *> (unsmob_grob (break_criterion));
if (sc->get_system () != line)
- sc = sc->find_broken_piece (line);
+ sc = sc->find_broken_piece (line);
/* now: !sc || (sc && sc->get_system () == line) */
if (!sc)
- return 0;
+ return 0;
/* now: sc && sc->get_system () == line */
if (!line)
- return sc;
+ return sc;
/*
- We don't return SCM_UNDEFINED for
- suicided grobs, for two reasons
+ We don't return SCM_UNDEFINED for
+ suicided grobs, for two reasons
- - it doesn't work (strange disappearing objects)
+ - it doesn't work (strange disappearing objects)
- - it forces us to mark the parents of a grob, leading to
- a huge recursion in the GC routine.
+ - it forces us to mark the parents of a grob, leading to
+ a huge recursion in the GC routine.
*/
if (sc->common_refpoint (line, X_AXIS)
- && sc->common_refpoint (line, Y_AXIS))
- return sc;
+ && sc->common_refpoint (line, Y_AXIS))
+ return sc;
return 0;
}
SCM
do_break_substitution (SCM src)
{
- again:
+again:
if (unsmob_grob (src))
{
int len = scm_c_vector_length (src);
SCM nv = scm_c_make_vector (len, SCM_UNDEFINED);
for (int i = 0; i < len; i++)
- {
- SCM si = scm_from_int (i);
- scm_vector_set_x (nv, si,
- do_break_substitution (scm_vector_ref (src, si)));
- }
+ {
+ SCM si = scm_from_int (i);
+ scm_vector_set_x (nv, si,
+ do_break_substitution (scm_vector_ref (src, si)));
+ }
}
else if (scm_is_pair (src))
{
/*
- UGH! breaks on circular lists.
+ UGH! breaks on circular lists.
*/
SCM newcar = do_break_substitution (scm_car (src));
SCM oldcdr = scm_cdr (src);
if (newcar == SCM_UNDEFINED
- && (scm_is_pair (oldcdr) || oldcdr == SCM_EOL))
- {
- /*
- This is tail-recursion, ie.
+ && (scm_is_pair (oldcdr) || oldcdr == SCM_EOL))
+ {
+ /*
+ This is tail-recursion, ie.
- return do_break_substution (cdr);
+ return do_break_substution (cdr);
- We don't want to rely on the compiler to do this. Without
- tail-recursion, this easily crashes with a stack overflow. */
- src = oldcdr;
- goto again;
- }
+ We don't want to rely on the compiler to do this. Without
+ tail-recursion, this easily crashes with a stack overflow. */
+ src = oldcdr;
+ goto again;
+ }
return scm_cons (newcar, do_break_substitution (oldcdr));
}
/*
Perform substitution on GROB_LIST using a constant amount of stack.
*/
-vector<Grob*> temporary_substition_array;
+vector<Grob *> temporary_substition_array;
void
substitute_grob_array (Grob_array *grob_arr, Grob_array *new_arr)
{
- vector<Grob*> &old_grobs (grob_arr->array_reference ());
- vector<Grob*> *new_grobs (new_arr == grob_arr
- ? & temporary_substition_array
- : &new_arr->array_reference ());
+ vector<Grob *> &old_grobs (grob_arr->array_reference ());
+ vector<Grob *> *new_grobs (new_arr == grob_arr
+ ? & temporary_substition_array
+ : &new_arr->array_reference ());
new_grobs->resize (old_grobs.size ());
Grob **array = (Grob **) new_grobs->data ();
Grob *orig = old_grobs[i];
Grob *new_grob = substitute_grob (orig);
if (new_grob)
- *ptr++ = new_grob;
+ *ptr++ = new_grob;
}
new_grobs->resize (ptr - array);
else
{
if (sp->broken_intos_.size ())
- rv = Slice (sp->broken_intos_[0]->get_system ()->get_rank (),
- sp->broken_intos_.back ()->get_system ()->get_rank ());
+ rv = Slice (sp->broken_intos_[0]->get_system ()->get_rank (),
+ sp->broken_intos_.back ()->get_system ()->get_rank ());
}
return rv;
}
{
Item *bi = it->find_prebroken_piece (d);
if (bi && bi->get_system ())
- sr.add_point (bi->get_system ()->get_rank ());
+ sr.add_point (bi->get_system ()->get_rank ());
}
while (flip (&d) != LEFT);
*/
if (sr.is_empty ())
{
- /*
- overflow if we don't treat this specially.
- */
- left_ = 1;
- right_ = -1;
+ /*
+ overflow if we don't treat this specially.
+ */
+ left_ = 1;
+ right_ = -1;
}
else
{
- left_ = (short) sr[LEFT];
- right_ = (short) sr[RIGHT];
+ left_ = (short) sr[LEFT];
+ right_ = (short) sr[RIGHT];
}
}
Substitution_entry ()
item_compare (void const *a, void const *b)
{
return ((Substitution_entry *)a)->left_
- - ((Substitution_entry *)b)->left_;
+ - ((Substitution_entry *)b)->left_;
}
static int
spanner_compare (void const *a, void const *b)
{
return ((Substitution_entry *)a)->length ()
- - ((Substitution_entry *)b)->length ();
+ - ((Substitution_entry *)b)->length ();
}
};
bool
Spanner::fast_substitute_grob_array (SCM sym,
- Grob_array *grob_array)
+ Grob_array *grob_array)
{
int len = grob_array->size ();
int idx = 0;
if (dynamic_cast<Spanner *> (g))
- idx = --spanner_index;
+ idx = --spanner_index;
else if (dynamic_cast<Item *> (g))
- idx = item_index++;
+ idx = item_index++;
vec[idx].set (g, sr);
}
qsort (vec, item_index,
- sizeof (Substitution_entry), &Substitution_entry::item_compare);
+ sizeof (Substitution_entry), &Substitution_entry::item_compare);
vector<Slice> item_indices;
vector<Slice> spanner_indices;
}
vector<Slice> *arrs[]
- = {
+ =
+ {
&item_indices, &spanner_indices
};
- for (int i = 0; i < item_index;i++)
+ for (int i = 0; i < item_index; i++)
{
for (int j = vec[i].left_; j <= vec[i].right_; j++)
- item_indices[j - system_range[LEFT]].add_point (i);
+ item_indices[j - system_range[LEFT]].add_point (i);
}
/*
assert (item_index <= spanner_index);
assert ((broken_intos_.size () == (vsize)system_range.length () + 1)
- || (broken_intos_.empty () && system_range.length () == 0));
+ || (broken_intos_.empty () && system_range.length () == 0));
for (vsize i = 0; i < broken_intos_.size (); i++)
{
Grob *sc = broken_intos_[i];
SCM newval = sc->internal_get_object (sym);
if (!unsmob_grob_array (newval))
- {
- newval = Grob_array::make_array ();
- sc->set_object (sym, newval);
- }
+ {
+ newval = Grob_array::make_array ();
+ sc->set_object (sym, newval);
+ }
Grob_array *new_array = unsmob_grob_array (newval);
- for (int k = 0; k < 2;k++)
- for (int j = (*arrs[k])[i][LEFT]; j <= (*arrs[k])[i][RIGHT]; j++)
- {
- Grob *substituted = substitute_grob (vec[j].grob_);
- if (substituted)
- new_array->add (substituted);
- }
+ for (int k = 0; k < 2; k++)
+ for (int j = (*arrs[k])[i][LEFT]; j <= (*arrs[k])[i][RIGHT]; j++)
+ {
+ Grob *substituted = substitute_grob (vec[j].grob_);
+ if (substituted)
+ new_array->add (substituted);
+ }
#ifdef PARANOIA
printf ("%d (%d), sp %d (%d)\n",
- item_indices [i].length (), item_index,
- spanner_indices[i].length (), len -spanner_index);
+ item_indices [i].length (), item_index,
+ spanner_indices[i].length (), len - spanner_index);
{
- SCM l1 = substitute_grob_list (grob_list);
- assert (scm_ilength (l1) == scm_ilength (newval));
+ SCM l1 = substitute_grob_list (grob_list);
+ assert (scm_ilength (l1) == scm_ilength (newval));
}
#endif
}
SCM val = scm_cdar (s);
if (Grob_array *orig = unsmob_grob_array (val))
- {
- SCM handle = scm_assq (sym, dest);
- SCM newval
- = (scm_is_pair (handle))
- ? scm_cdr (handle)
- : Grob_array::make_array ();
-
- Grob_array *new_arr = unsmob_grob_array (newval);
-
- substitute_grob_array (orig, new_arr);
- val = newval;
- }
+ {
+ SCM handle = scm_assq (sym, dest);
+ SCM newval
+ = (scm_is_pair (handle))
+ ? scm_cdr (handle)
+ : Grob_array::make_array ();
+
+ Grob_array *new_arr = unsmob_grob_array (newval);
+
+ substitute_grob_array (orig, new_arr);
+ val = newval;
+ }
else
- val = do_break_substitution (val);
+ val = do_break_substitution (val);
if (val != SCM_UNDEFINED)
- {
- /*
- for ly:grob? properties, SCM_UNDEFINED could leak out
- through ly:grob-property
- */
- *tail = scm_cons (scm_cons (sym, val), SCM_EOL);
- tail = SCM_CDRLOC (*tail);
- }
+ {
+ /*
+ for ly:grob? properties, SCM_UNDEFINED could leak out
+ through ly:grob-property
+ */
+ *tail = scm_cons (scm_cons (sym, val), SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ }
}
return l;
}
void
Spanner::substitute_one_mutable_property (SCM sym,
- SCM val)
+ SCM val)
{
Spanner *s = this;
if (!fast_done)
for (vsize i = 0; i < s->broken_intos_.size (); i++)
{
- Grob *sc = s->broken_intos_[i];
- System *l = sc->get_system ();
- set_break_subsititution (l ? l->self_scm () : SCM_UNDEFINED);
-
- if (grob_array)
- {
- SCM newval = sc->internal_get_object (sym);
- if (!unsmob_grob_array (newval))
- {
- newval = Grob_array::make_array ();
- sc->set_object (sym, newval);
- }
- substitute_grob_array (grob_array, unsmob_grob_array (newval));
- }
- else
- {
- SCM newval = do_break_substitution (val);
- sc->set_object (sym, newval);
- }
+ Grob *sc = s->broken_intos_[i];
+ System *l = sc->get_system ();
+ set_break_subsititution (l ? l->self_scm () : SCM_UNDEFINED);
+
+ if (grob_array)
+ {
+ SCM newval = sc->internal_get_object (sym);
+ if (!unsmob_grob_array (newval))
+ {
+ newval = Grob_array::make_array ();
+ sc->set_object (sym, newval);
+ }
+ substitute_grob_array (grob_array, unsmob_grob_array (newval));
+ }
+ else
+ {
+ SCM newval = do_break_substitution (val);
+ sc->set_object (sym, newval);
+ }
}
}
}
ADD_TRANSLATOR (Breathing_sign_engraver,
- /* doc */
- "Create a breathing sign.",
+ /* doc */
+ "Create a breathing sign.",
- /* create */
- "BreathingSign ",
+ /* create */
+ "BreathingSign ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
}
ADD_INTERFACE (Breathing_sign,
- "A breathing sign.",
+ "A breathing sign.",
- /* properties */
- "direction "
- );
+ /* properties */
+ "direction "
+ );
string to_id = ly_scm2string (get_music ()->get_property ("change-to-id"));
string warn1 = _f ("cannot change `%s' to `%s'", to_type, to_id)
- + ": " + reason;
+ + ": " + reason;
/*
GUHG!
*/
- string warn2= "Change_iterator::process (): "
- + get_outlet ()->context_name () + " = `"
- + get_outlet ()->id_string () + "': ";
+ string warn2 = "Change_iterator::process (): "
+ + get_outlet ()->context_name () + " = `"
+ + get_outlet ()->id_string () + "': ";
warning (warn2);
get_music ()->origin ()->warning (warn1);
}
if (current)
if (last)
{
- Context *dest = 0;
- Context *where = get_outlet ();
- while (!dest && where)
- {
- dest = find_context_below (where, to_type, to_id);
- where = where->get_parent_context ();
- }
-
- if (dest)
- {
- send_stream_event (last, "ChangeParent", get_music ()->origin (),
- ly_symbol2scm ("context"), dest->self_scm ());
- }
- else
- /* FIXME: constant error message. */
- get_music ()->origin ()->warning (_ ("cannot find context to switch to"));
+ Context *dest = 0;
+ Context *where = get_outlet ();
+ while (!dest && where)
+ {
+ dest = find_context_below (where, to_type, to_id);
+ where = where->get_parent_context ();
+ }
+
+ if (dest)
+ {
+ send_stream_event (last, "ChangeParent", get_music ()->origin (),
+ ly_symbol2scm ("context"), dest->self_scm ());
+ }
+ else
+ /* FIXME: constant error message. */
+ get_music ()->origin ()->warning (_ ("cannot find context to switch to"));
}
else
{
- /* We could change the current translator's id, but that would make
- errors hard to catch.
+ /* We could change the current translator's id, but that would make
+ errors hard to catch.
- last->translator_id_string () = get_change
- ()->change_to_id_string (); */
- error (_f ("not changing to same context type: %s", ly_symbol2string (to_type).c_str ()));
+ last->translator_id_string () = get_change
+ ()->change_to_id_string (); */
+ error (_f ("not changing to same context type: %s", ly_symbol2string (to_type).c_str ()));
}
else
/* FIXME: uncomprehensable message */
DECLARE_TRANSLATOR_LISTENER (rest);
private:
Item *chord_name_;
- vector<Stream_event*> notes_;
-
+ vector<Stream_event *> notes_;
+
SCM last_chord_;
Stream_event *rest_event_;
};
void
Chord_name_engraver::process_music ()
-{
+{
SCM markup;
SCM bass = SCM_EOL;
SCM inversion = SCM_EOL;
markup = no_chord_markup;
}
else
- {
+ {
if (!notes_.size ())
return;
Stream_event *inversion_event = 0;
for (vsize i = 0; i < notes_.size (); i++)
- {
- Stream_event *n = notes_[i];
- SCM p = n->get_property ("pitch");
- if (!unsmob_pitch (p))
- continue;
-
- if (n->get_property ("inversion") == SCM_BOOL_T)
{
- inversion_event = n;
- inversion = p;
+ Stream_event *n = notes_[i];
+ SCM p = n->get_property ("pitch");
+ if (!unsmob_pitch (p))
+ continue;
+
+ if (n->get_property ("inversion") == SCM_BOOL_T)
+ {
+ inversion_event = n;
+ inversion = p;
+ }
+ else if (n->get_property ("bass") == SCM_BOOL_T)
+ bass = p;
+ else
+ pitches = scm_cons (p, pitches);
}
- else if (n->get_property ("bass") == SCM_BOOL_T)
- bass = p;
- else
- pitches = scm_cons (p, pitches);
- }
if (inversion_event)
- {
- SCM oct = inversion_event->get_property ("octavation");
- if (scm_is_number (oct))
{
- Pitch *p = unsmob_pitch (inversion_event->get_property ("pitch"));
- int octavation = scm_to_int (oct);
- Pitch orig = p->transposed (Pitch (-octavation, 0, 0));
-
- pitches = scm_cons (orig.smobbed_copy (), pitches);
+ SCM oct = inversion_event->get_property ("octavation");
+ if (scm_is_number (oct))
+ {
+ Pitch *p = unsmob_pitch (inversion_event->get_property ("pitch"));
+ int octavation = scm_to_int (oct);
+ Pitch orig = p->transposed (Pitch (-octavation, 0, 0));
+
+ pitches = scm_cons (orig.smobbed_copy (), pitches);
+ }
+ else
+ programming_error ("inversion does not have original pitch");
}
- else
- programming_error ("inversion does not have original pitch");
- }
pitches = scm_sort_list (pitches, Pitch::less_p_proc);
SCM name_proc = get_property ("chordNameFunction");
markup = scm_call_4 (name_proc, pitches, bass, inversion,
- context ()->self_scm ());
+ context ()->self_scm ());
}
/*
Ugh.
*/
SCM chord_as_scm = scm_cons (pitches, scm_cons (bass, inversion));
- chord_name_ = make_item ("ChordName",
- rest_event_ ? rest_event_->self_scm () : notes_[0]->self_scm ());
+ chord_name_ = make_item ("ChordName",
+ rest_event_ ? rest_event_->self_scm () : notes_[0]->self_scm ());
chord_name_->set_property ("text", markup);
- SCM chord_changes = get_property("chordChanges");
+ SCM chord_changes = get_property ("chordChanges");
if (to_boolean (chord_changes) && scm_is_pair (last_chord_)
&& ly_is_equal (chord_as_scm, last_chord_))
chord_name_->set_property ("begin-of-line-visible", SCM_BOOL_T);
void
Chord_name_engraver::listen_rest (Stream_event *ev)
{
- ASSIGN_EVENT_ONCE(rest_event_, ev);
+ ASSIGN_EVENT_ONCE (rest_event_, ev);
}
-
+
void
Chord_name_engraver::stop_translation_timestep ()
{
which properties are read depend on the chord naming function active.
*/
ADD_TRANSLATOR (Chord_name_engraver,
- /* doc */
- "Catch note and rest events and generate the appropriate chordname.",
-
- /* create */
- "ChordName ",
-
- /* read */
- "chordChanges "
- "chordNameExceptions "
- "chordNameFunction "
- "chordNoteNamer "
- "chordRootNamer "
- "chordNameExceptions "
- "majorSevenSymbol "
+ /* doc */
+ "Catch note and rest events and generate the appropriate chordname.",
+
+ /* create */
+ "ChordName ",
+
+ /* read */
+ "chordChanges "
+ "chordNameExceptions "
+ "chordNameFunction "
+ "chordNoteNamer "
+ "chordRootNamer "
+ "chordNameExceptions "
+ "majorSevenSymbol "
"noChordSymbol ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
if (to_boolean (s))
{
if (me->get_column ()->get_rank ()
- - me->get_system ()->spanned_rank_interval ()[LEFT] > 1)
- me->suicide ();
+ - me->get_system ()->spanned_rank_interval ()[LEFT] > 1)
+ me->suicide ();
}
return SCM_UNSPECIFIED;
}
ADD_INTERFACE (Chord_name,
- "A chord label (name or fretboard).",
+ "A chord label (name or fretboard).",
- /* properties */
- "begin-of-line-visible "
- );
+ /* properties */
+ "begin-of-line-visible "
+ );
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2000--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
- Erik Sandberg <mandolaerik@gmail.com>
+ Erik Sandberg <mandolaerik@gmail.com>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
if (Stem::duration_log (s) != 1)
beam_->set_property ("gap-count", scm_from_int (gap_count));
-
if (info.ultimate_event_cause ()->in_event_class ("rhythmic-event"))
- Beam::add_stem (beam_, s);
+ Beam::add_stem (beam_, s);
else
- {
- string s = _ ("stem must have Rhythmic structure");
- if (info.event_cause ())
- info.event_cause ()->origin ()->warning (s);
- else
- ::warning (s);
- }
+ {
+ string s = _ ("stem must have Rhythmic structure");
+ if (info.event_cause ())
+ info.event_cause ()->origin ()->warning (s);
+ else
+ ::warning (s);
+ }
// Store current grob, so we can possibly end the spanner here (and
// reset the beam direction to RIGHT)
previous_stem_ = s;
ADD_ACKNOWLEDGER (Chord_tremolo_engraver, stem);
ADD_TRANSLATOR (Chord_tremolo_engraver,
- /* doc */
- "Generate beams for tremolo repeats.",
+ /* doc */
+ "Generate beams for tremolo repeats.",
- /* create */
- "Beam ",
+ /* create */
+ "Beam ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2000--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
- Erik Sandberg <mandolaerik@gmail.com>
+ Erik Sandberg <mandolaerik@gmail.com>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
SCM cpos = get_property ("clefPosition");
if (scm_is_number (cpos))
- clef_->set_property ("staff-position", cpos);
+ clef_->set_property ("staff-position", cpos);
SCM oct = get_property ("clefOctavation");
if (scm_is_number (oct) && scm_to_int (oct))
- {
- Item *g = make_item ("OctavateEight", SCM_EOL);
-
- int abs_oct = scm_to_int (oct);
- int dir = sign (abs_oct);
- abs_oct = abs (abs_oct) + 1;
-
- SCM txt = scm_number_to_string (scm_from_int (abs_oct),
- scm_from_int (10));
-
- g->set_property ("text",
- scm_list_n (ly_lily_module_constant ("vcenter-markup"),
- txt, SCM_UNDEFINED));
- Side_position_interface::add_support (g, clef_);
-
- g->set_parent (clef_, Y_AXIS);
- g->set_parent (clef_, X_AXIS);
- g->set_property ("direction", scm_from_int (dir));
- octavate_ = g;
- }
+ {
+ Item *g = make_item ("OctavateEight", SCM_EOL);
+
+ int abs_oct = scm_to_int (oct);
+ int dir = sign (abs_oct);
+ abs_oct = abs (abs_oct) + 1;
+
+ SCM txt = scm_number_to_string (scm_from_int (abs_oct),
+ scm_from_int (10));
+
+ g->set_property ("text",
+ scm_list_n (ly_lily_module_constant ("vcenter-markup"),
+ txt, SCM_UNDEFINED));
+ Side_position_interface::add_support (g, clef_);
+
+ g->set_parent (clef_, Y_AXIS);
+ g->set_parent (clef_, X_AXIS);
+ g->set_property ("direction", scm_from_int (dir));
+ octavate_ = g;
+ }
}
}
void
static void apply_on_children (Context *context, SCM fun)
{
- scm_call_1(fun, context->self_scm());
+ scm_call_1 (fun, context->self_scm ());
for (SCM s = context->children_contexts ();
- scm_is_pair(s); s = scm_cdr (s))
- apply_on_children(unsmob_context (scm_car(s)), fun);
+ scm_is_pair (s); s = scm_cdr (s))
+ apply_on_children (unsmob_context (scm_car (s)), fun);
}
-
void
Clef_engraver::inspect_clef_properties ()
|| scm_equal_p (octavation, prev_octavation_) == SCM_BOOL_F
|| to_boolean (force_clef))
{
- apply_on_children(context (),
- ly_lily_module_constant ("invalidate-alterations"));
-
+ apply_on_children (context (),
+ ly_lily_module_constant ("invalidate-alterations"));
+
set_glyph ();
if (prev_cpos_ != SCM_BOOL_F || to_boolean (get_property ("firstClef")))
- create_clef ();
+ create_clef ();
if (clef_)
- clef_->set_property ("non-default", SCM_BOOL_T);
+ clef_->set_property ("non-default", SCM_BOOL_T);
prev_cpos_ = clefpos;
prev_glyph_ = glyph;
{
SCM vis = 0;
if (to_boolean (clef_->get_property ("non-default")))
- vis = get_property ("explicitClefVisibility");
+ vis = get_property ("explicitClefVisibility");
if (vis)
- clef_->set_property ("break-visibility", vis);
+ clef_->set_property ("break-visibility", vis);
clef_ = 0;
ADD_ACKNOWLEDGER (Clef_engraver, bar_line);
ADD_TRANSLATOR (Clef_engraver,
- /* doc */
- "Determine and set reference point for pitches.",
-
- /* create */
- "Clef "
- "OctavateEight ",
-
- /* read */
- "clefGlyph "
- "clefOctavation "
- "clefPosition "
- "explicitClefVisibility "
- "forceClef ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Determine and set reference point for pitches.",
+
+ /* create */
+ "Clef "
+ "OctavateEight ",
+
+ /* read */
+ "clefGlyph "
+ "clefOctavation "
+ "clefPosition "
+ "explicitClefVisibility "
+ "forceClef ",
+
+ /* write */
+ ""
+ );
string str = ly_scm2string (glyph);
if (to_boolean (s->get_property ("non-default"))
- && s->break_status_dir () != RIGHT
- && !to_boolean (s->get_property ("full-size-change")))
- {
- str += "_change";
- }
+ && s->break_status_dir () != RIGHT
+ && !to_boolean (s->get_property ("full-size-change")))
+ {
+ str += "_change";
+ }
return ly_string2scm (str);
}
}
ADD_INTERFACE (Clef,
- "A clef sign.",
-
- /* properties */
- "full-size-change "
- "glyph "
- "glyph-name "
- "non-default "
- );
+ "A clef sign.",
+
+ /* properties */
+ "full-size-change "
+ "glyph "
+ "glyph-name "
+ "non-default "
+ );
virtual void process_music ();
virtual void finalize ();
private:
- vector<Stream_event*> cluster_notes_;
+ vector<Stream_event *> cluster_notes_;
Item *beacon_;
void typeset_grobs ();
if (finished_spanner_)
{
if (!finished_spanner_->get_bound (RIGHT))
- {
- finished_spanner_->set_bound (RIGHT,
- finished_spanner_->get_bound (LEFT));
-
- }
-
+ {
+ finished_spanner_->set_bound (RIGHT,
+ finished_spanner_->get_bound (LEFT));
+
+ }
+
finished_spanner_ = 0;
}
beacon_ = 0;
int pmin = INT_MAX;
for (vsize i = 0; i < cluster_notes_.size (); i++)
- {
- Pitch *pit = unsmob_pitch (cluster_notes_[i]->get_property ("pitch"));
+ {
+ Pitch *pit = unsmob_pitch (cluster_notes_[i]->get_property ("pitch"));
- int p = (pit ? pit->steps () : 0) + c0;
+ int p = (pit ? pit->steps () : 0) + c0;
- pmax = max (pmax, p);
- pmin = min (pmin, p);
- }
+ pmax = max (pmax, p);
+ pmin = min (pmin, p);
+ }
beacon_ = make_item ("ClusterSpannerBeacon", cluster_notes_[0]->self_scm ());
beacon_->set_property ("positions",
- scm_cons (scm_from_int (pmin),
- scm_from_int (pmax)));
+ scm_cons (scm_from_int (pmin),
+ scm_from_int (pmax)));
}
if (beacon_ && !spanner_)
ADD_ACKNOWLEDGER (Cluster_spanner_engraver, note_column);
ADD_TRANSLATOR (Cluster_spanner_engraver,
- /* doc */
- "Engrave a cluster using @code{Spanner} notation.",
+ /* doc */
+ "Engrave a cluster using @code{Spanner} notation.",
- /* create */
- "ClusterSpanner "
- "ClusterSpannerBeacon ",
+ /* create */
+ "ClusterSpanner "
+ "ClusterSpannerBeacon ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
if (shape == "leftsided-stairs")
{
for (int i = 0; i < size - 1; i++)
- {
- Box box;
- box.add_point (bottom_points[i] - hvpadding);
- box.add_point (Offset (top_points[i + 1][X_AXIS],
- top_points[i][Y_AXIS]) + hvpadding);
- out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
- }
+ {
+ Box box;
+ box.add_point (bottom_points[i] - hvpadding);
+ box.add_point (Offset (top_points[i + 1][X_AXIS],
+ top_points[i][Y_AXIS]) + hvpadding);
+ out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
+ }
}
else if (shape == "rightsided-stairs")
{
for (int i = 0; i < size - 1; i++)
- {
- Box box;
- box.add_point (Offset (bottom_points[i][X_AXIS],
- bottom_points[i + 1][Y_AXIS]) - hvpadding);
- box.add_point (top_points[i + 1] + hvpadding);
- out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
- }
+ {
+ Box box;
+ box.add_point (Offset (bottom_points[i][X_AXIS],
+ bottom_points[i + 1][Y_AXIS]) - hvpadding);
+ box.add_point (top_points[i + 1] + hvpadding);
+ out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
+ }
}
else if (shape == "centered-stairs")
{
Real left_xmid = bottom_points[0][X_AXIS];
for (int i = 0; i < size - 1; i++)
- {
- Real right_xmid
- = 0.5 * (bottom_points[i][X_AXIS] + bottom_points[i + 1][X_AXIS]);
- Box box;
- box.add_point (Offset (left_xmid, bottom_points[i][Y_AXIS])
- - hvpadding);
- box.add_point (Offset (right_xmid, top_points[i][Y_AXIS])
- + hvpadding);
- out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
- left_xmid = right_xmid;
- }
+ {
+ Real right_xmid
+ = 0.5 * (bottom_points[i][X_AXIS] + bottom_points[i + 1][X_AXIS]);
+ Box box;
+ box.add_point (Offset (left_xmid, bottom_points[i][Y_AXIS])
+ - hvpadding);
+ box.add_point (Offset (right_xmid, top_points[i][Y_AXIS])
+ + hvpadding);
+ out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
+ left_xmid = right_xmid;
+ }
Real right_xmid = bottom_points[size - 1][X_AXIS];
Box box;
box.add_point (Offset (left_xmid, bottom_points[size - 1][Y_AXIS])
- - hvpadding);
+ - hvpadding);
box.add_point (Offset (right_xmid, top_points[size - 1][Y_AXIS])
- + hvpadding);
+ + hvpadding);
out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
}
else if (shape == "ramp")
{
points.push_back (bottom_points[0] - vpadding + hpadding);
for (int i = 1; i < size - 1; i++)
- points.push_back (bottom_points[i] - vpadding);
+ points.push_back (bottom_points[i] - vpadding);
points.push_back (bottom_points[size - 1] - vpadding - hpadding);
points.push_back (top_points[size - 1] + vpadding - hpadding);
for (int i = size - 2; i > 0; i--)
- points.push_back (top_points[i] + vpadding);
+ points.push_back (top_points[i] + vpadding);
points.push_back (top_points[0] + vpadding + hpadding);
out.add_stencil (Lookup::round_filled_polygon (points, blotdiameter));
}
Grob *commonx = left_bound->common_refpoint (right_bound, X_AXIS);
- vector<Grob*> const &cols = extract_grob_array (me, "columns");
+ vector<Grob *> const &cols = extract_grob_array (me, "columns");
if (cols.empty ())
{
me->warning (_ ("junking empty cluster"));
{
extract_grob_set (next, "columns", next_cols);
if (next_cols.size () > 0)
- {
- Grob *next_commony = common_refpoint_of_array (next_cols, next, Y_AXIS);
- Grob *col = next_cols[0];
+ {
+ Grob *next_commony = common_refpoint_of_array (next_cols, next, Y_AXIS);
+ Grob *col = next_cols[0];
- Interval v = col->extent (next_commony, Y_AXIS);
- Real x = right_bound->relative_coordinate (commonx, X_AXIS) - left_coord;
+ Interval v = col->extent (next_commony, Y_AXIS);
+ Real x = right_bound->relative_coordinate (commonx, X_AXIS) - left_coord;
- bottom_points.push_back (Offset (x, v[DOWN]));
- top_points.push_back (Offset (x, v[UP]));
- }
+ bottom_points.push_back (Offset (x, v[DOWN]));
+ top_points.push_back (Offset (x, v[UP]));
+ }
}
Stencil out = brew_cluster_piece (me, bottom_points, top_points);
}
ADD_INTERFACE (Cluster,
- "A graphically drawn musical cluster.\n"
- "\n"
- "@code{padding} adds to the vertical extent of the shape (top"
- " and bottom).\n"
- "\n"
- "The property @code{style} controls the shape of cluster"
- " segments. Valid values include @code{leftsided-stairs},"
- " @code{rightsided-stairs}, @code{centered-stairs}, and"
- " @code{ramp}.\n",
-
- /* properties */
- "style "
- "padding "
- "columns "
- );
+ "A graphically drawn musical cluster.\n"
+ "\n"
+ "@code{padding} adds to the vertical extent of the shape (top"
+ " and bottom).\n"
+ "\n"
+ "The property @code{style} controls the shape of cluster"
+ " segments. Valid values include @code{leftsided-stairs},"
+ " @code{rightsided-stairs}, @code{centered-stairs}, and"
+ " @code{ramp}.\n",
+
+ /* properties */
+ "style "
+ "padding "
+ "columns "
+ );
struct Cluster_beacon
{
{
Grob *me = unsmob_grob (g);
Interval v = robust_scm2interval (me->get_property ("positions"),
- Interval (0, 0));
+ Interval (0, 0));
return ly_interval2scm (Staff_symbol_referencer::staff_space (me) * 0.5 * v);
}
ADD_INTERFACE (Cluster_beacon,
- "A place holder for the cluster spanner to determine the"
- " vertical extents of a cluster spanner at this"
- " X@tie{}position.",
+ "A place holder for the cluster spanner to determine the"
+ " vertical extents of a cluster spanner at this"
+ " X@tie{}position.",
- /* properties */
- "positions "
- );
+ /* properties */
+ "positions "
+ );
* example, Ligature_bracket_engraver does not share any of this code.
*/
-
/*
* TODO: move this function to class Item?
*/
{
Item *sibling = elements[i];
if (!sibling)
- // should not occur, but who knows... -jr
- continue;
+ // should not occur, but who knows... -jr
+ continue;
if (Staff_symbol_referencer::get_staff_symbol (sibling) != staff_symbol)
- // sibling is from a staff different than that of the item of
- // interest
- continue;
+ // sibling is from a staff different than that of the item of
+ // interest
+ continue;
#if 0 /* experimental code to collapse spacing after ligature */
Grob *sibling_parent = sibling->get_parent (X_AXIS);
sibling_parent->warning (_f ("Coherent_ligature_engraver: "
- "setting `spacing-increment="
- "0.01': ptr=%ul", parent));
+ "setting `spacing-increment="
+ "0.01': ptr=%ul", parent));
sibling_parent->set_property ("forced-spacing",
- scm_from_double (0.01));
+ scm_from_double (0.01));
#endif
sibling->set_parent (target_column, X_AXIS);
primitive = dynamic_cast<Item *> (primitives[i].grob ());
Stream_event *cause = primitives[i].event_cause ();
int pitch
- = unsmob_pitch (cause->get_property ("pitch"))->steps ();
+ = unsmob_pitch (cause->get_property ("pitch"))->steps ();
if (prev_primitive)
- {
- delta_pitch = pitch - prev_pitch;
- prev_primitive->set_property ("delta-position",
- scm_from_int (delta_pitch));
- }
+ {
+ delta_pitch = pitch - prev_pitch;
+ prev_primitive->set_property ("delta-position",
+ scm_from_int (delta_pitch));
+ }
prev_pitch = pitch;
prev_primitive = primitive;
}
void
Coherent_ligature_engraver::typeset_ligature (Spanner *ligature,
- vector<Grob_info> primitives)
+ vector<Grob_info> primitives)
{
// compute some commonly needed context info stored as grob
// properties
class Collision_engraver : public Engraver
{
Item *col_;
- vector<Grob*> note_columns_;
+ vector<Grob *> note_columns_;
protected:
DECLARE_ACKNOWLEDGER (note_column);
{
/*should check Y axis? */
if (Note_column::has_rests (i.grob ()) || i.grob ()->get_parent (X_AXIS))
- return;
+ return;
if (to_boolean (i.grob ()->get_property ("ignore-collision")))
- return;
-
+ return;
+
note_columns_.push_back (i.grob ());
}
}
ADD_ACKNOWLEDGER (Collision_engraver, note_column);
ADD_TRANSLATOR (Collision_engraver,
- /* doc */
- "Collect @code{NoteColumns}, and as soon as there are two or"
- " more, put them in a @code{NoteCollision} object.",
+ /* doc */
+ "Collect @code{NoteColumns}, and as soon as there are two or"
+ " more, put them in a @code{NoteCollision} object.",
- /* create */
- "NoteCollision ",
+ /* create */
+ "NoteCollision ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
if (left_to_do_)
{
/*
- note that note_dur may be strictly less than left_to_do_
- (say, if left_to_do_ == 5/8)
+ note that note_dur may be strictly less than left_to_do_
+ (say, if left_to_do_ == 5/8)
*/
if (factor_.denominator () == 1 && factor_ > Rational (1, 1))
- note_dur = Duration (left_to_do_, false);
+ note_dur = Duration (left_to_do_, false);
else
- note_dur = Duration (left_to_do_ / factor_, false).compressed (factor_);
+ note_dur = Duration (left_to_do_ / factor_, false).compressed (factor_);
}
else
{
if (nb.main_part_ && nb < note_dur.get_length ())
{
if (factor_.denominator () == 1 && factor_ > Rational (1, 1))
- note_dur = Duration (nb.main_part_, false);
+ note_dur = Duration (nb.main_part_, false);
else
- note_dur = Duration (nb.main_part_ / factor_, false).compressed (factor_);
+ note_dur = Duration (nb.main_part_ / factor_, false).compressed (factor_);
}
do_nothing_until_ = now.main_part_ + note_dur.get_length ();
Stream_event *event = note_events_[i];
if (need_clone)
- event = event->clone ();
+ event = event->clone ();
SCM pits = note_events_[i]->get_property ("pitch");
event->set_property ("pitch", pits);
event->set_property ("duration-log", scm_from_int (note_dur.duration_log ()));
/*
- The Completion_heads_engraver splits an event into a group of consecutive events.
- For each event in the group, the property "autosplit-end" denotes whether the current event
- was truncated during splitting. Based on "autosplit-end", the Tie_engraver decides whether a
- tie event should be processed.
+ The Completion_heads_engraver splits an event into a group of consecutive events.
+ For each event in the group, the property "autosplit-end" denotes whether the current event
+ was truncated during splitting. Based on "autosplit-end", the Tie_engraver decides whether a
+ tie event should be processed.
*/
event->set_property ("autosplit-end",
- ly_bool2scm (left_to_do_ - note_dur.get_length () > Rational (0)));
+ ly_bool2scm (left_to_do_ - note_dur.get_length () > Rational (0)));
Item *note = make_note_head (event);
if (need_clone)
- event->unprotect ();
+ event->unprotect ();
notes_.push_back (note);
}
if (prev_notes_.size () == notes_.size ())
{
for (vsize i = 0; i < notes_.size (); i++)
- make_tie (prev_notes_[i], notes_[i]);
+ make_tie (prev_notes_[i], notes_[i]);
}
if (ties_.size () && !tie_column_)
prev_notes_.clear ();
}
context ()->set_property ("completionBusy",
- ly_bool2scm (note_events_.size ()));
+ ly_bool2scm (note_events_.size ()));
}
Completion_heads_engraver::Completion_heads_engraver ()
}
ADD_TRANSLATOR (Completion_heads_engraver,
- /* doc */
- "This engraver replaces @code{Note_heads_engraver}. It plays"
- " some trickery to break long notes and automatically tie them"
- " into the next measure.",
-
- /* create */
- "NoteHead "
- "Tie "
- "TieColumn ",
-
- /* read */
- "measureLength "
- "measurePosition "
- "middleCPosition "
- "timing ",
-
- /* write */
- "completionBusy "
- );
+ /* doc */
+ "This engraver replaces @code{Note_heads_engraver}. It plays"
+ " some trickery to break long notes and automatically tie them"
+ " into the next measure.",
+
+ /* create */
+ "NoteHead "
+ "Tie "
+ "TieColumn ",
+
+ /* read */
+ "measureLength "
+ "measurePosition "
+ "middleCPosition "
+ "timing ",
+
+ /* write */
+ "completionBusy "
+ );
class Completion_rest_engraver : public Engraver
{
- vector<Item*> rests_;
- vector<Item*> prev_rests_;
- vector<Stream_event*> rest_events_;
+ vector<Item *> rests_;
+ vector<Item *> prev_rests_;
+ vector<Stream_event *> rest_events_;
Moment rest_end_mom_;
bool is_first_;
Rational left_to_do_;
Rational factor_;
Moment next_barline_moment ();
- Item *make_rest (Stream_event*);
+ Item *make_rest (Stream_event *);
public:
TRANSLATOR_DECLARATIONS (Completion_rest_engraver);
Completion_rest_engraver::listen_rest (Stream_event *ev)
{
rest_events_.push_back (ev);
-
+
is_first_ = true;
Moment now = now_mom ();
Moment musiclen = get_event_length (ev, now);
return (*l - *e);
}
-Item*
+Item *
Completion_rest_engraver::make_rest (Stream_event *ev)
{
Item *rest = make_item ("Rest", ev->self_scm ());
int pos = p->steps ();
SCM c0 = get_property ("middleCPosition");
if (scm_is_number (c0))
- pos += scm_to_int (c0);
+ pos += scm_to_int (c0);
rest->set_property ("staff-position", scm_from_int (pos));
}
if (left_to_do_)
{
/*
- rest that rest_dur may be strictly less than left_to_do_
- (say, if left_to_do_ == 5/8)
+ rest that rest_dur may be strictly less than left_to_do_
+ (say, if left_to_do_ == 5/8)
*/
if (factor_.denominator () == 1 && factor_ > Rational (1, 1))
- rest_dur = Duration (left_to_do_, false);
+ rest_dur = Duration (left_to_do_, false);
else
- rest_dur = Duration (left_to_do_ / factor_, false).compressed (factor_);
+ rest_dur = Duration (left_to_do_ / factor_, false).compressed (factor_);
appearance = Duration (left_to_do_, false);
}
else
if (nb.main_part_ && nb < rest_dur.get_length ())
{
if (factor_.denominator () == 1 && factor_ > Rational (1, 1))
- rest_dur = Duration (nb.main_part_, false);
+ rest_dur = Duration (nb.main_part_, false);
else
- rest_dur = Duration (nb.main_part_ / factor_, false).compressed (factor_);
+ rest_dur = Duration (nb.main_part_ / factor_, false).compressed (factor_);
}
do_nothing_until_ = now.main_part_ + rest_dur.get_length ();
Stream_event *event = rest_events_[i];
if (need_clone)
- event = event->clone ();
+ event = event->clone ();
SCM pits = rest_events_[i]->get_property ("pitch");
event->set_property ("pitch", pits);
Item *rest = make_rest (event);
if (need_clone)
- event->unprotect ();
+ event->unprotect ();
rests_.push_back (rest);
}
-
+
left_to_do_ -= rest_dur.get_length ();
if (left_to_do_)
- get_global_context ()->add_moment_to_process (now.main_part_ + rest_dur.get_length());
+ get_global_context ()->add_moment_to_process (now.main_part_ + rest_dur.get_length ());
/*
don't do complicated arithmetic with grace rests.
*/
prev_rests_.clear ();
}
context ()->set_property ("restCompletionBusy",
- ly_bool2scm (rest_events_.size ()));
+ ly_bool2scm (rest_events_.size ()));
}
Completion_rest_engraver::Completion_rest_engraver ()
}
ADD_TRANSLATOR (Completion_rest_engraver,
- /* doc */
- "This engraver replaces @code{Rest_engraver}. It plays"
- " some trickery to break long rests into the next measure."
- ,
- /* create */
- "Rest "
- ,
- /* read */
- "middleCPosition "
- "measurePosition "
- "measureLength "
- ,
- /* write */
- "restCompletionBusy "
- );
+ /* doc */
+ "This engraver replaces @code{Rest_engraver}. It plays"
+ " some trickery to break long rests into the next measure.",
+
+ /* create */
+ "Rest ",
+
+ /* read */
+ "middleCPosition "
+ "measurePosition "
+ "measureLength ",
+
+ /* write */
+ "restCompletionBusy "
+ );
vsize start_col = starting_breakpoints_[start];
Matrix<Constrained_break_node> &st = state_[start];
vsize max_index = brk - start_col;
- for (vsize j=max_index; j-- > sys;)
+ for (vsize j = max_index; j-- > sys;)
{
if (0 == sys && j > 0)
continue; /* the first line cannot have its first break after the beginning */
Line_details const &cur = lines_.at (brk, j + start_col);
if (isinf (cur.force_))
- break;
+ break;
Real prev_f = 0;
Real prev_dem = 0;
if (sys > 0)
{
- prev_f = st.at (j, sys-1).details_.force_;
- prev_dem = st.at (j, sys-1).demerits_;
+ prev_f = st.at (j, sys - 1).details_.force_;
+ prev_dem = st.at (j, sys - 1).demerits_;
}
if (isinf (prev_dem))
continue;
return found_something;
}
-
Column_x_positions
Constrained_breaking::space_line (vsize i, vsize j)
{
bool ragged_right = to_boolean (pscore_->layout ()->c_variable ("ragged-right"));
bool ragged_last = to_boolean (pscore_->layout ()->c_variable ("ragged-last"));
- vector<Grob*> line (all_.begin () + breaks_[i],
- all_.begin () + breaks_[j] + 1);
+ vector<Grob *> line (all_.begin () + breaks_[i],
+ all_.begin () + breaks_[j] + 1);
Interval line_dims = line_dimensions_int (pscore_->layout (), i);
bool last = j == breaks_.size () - 1;
bool ragged = ragged_right || (last && ragged_last);
vector<Column_x_positions> ret;
/* find the first solution that satisfies constraints */
- for (vsize sys = sys_count-1; sys != VPOS; sys--)
+ for (vsize sys = sys_count - 1; sys != VPOS; sys--)
{
for (vsize brk = end_brk; brk != VPOS; brk--)
{
{
if (brk != end_brk)
{
- brk = st.at (brk, sys).prev_;
- sys--;
+ brk = st.at (brk, sys).prev_;
+ sys--;
warning (_ ("cannot find line breaking that satisfies constraints"));
ret.push_back (space_line (brk, end_brk));
}
/* build up the good part of the solution */
for (vsize cur_sys = sys; cur_sys != VPOS; cur_sys--)
{
- vsize prev_brk = st.at (brk, cur_sys).prev_;
+ vsize prev_brk = st.at (brk, cur_sys).prev_;
assert (brk != VPOS);
ret.push_back (space_line (prev_brk + start_brk, brk + start_brk));
brk = prev_brk;
for (vsize i = min_systems; i <= max_systems; i++)
{
vsize brk = prepare_solution (start, end, i);
- Real dem = state_[start].at (brk, i-1).demerits_;
+ Real dem = state_[start].at (brk, i - 1).demerits_;
if (dem < best_demerits)
- {
- best_demerits = dem;
- best_so_far = solve (start, end, i);
- }
+ {
+ best_demerits = dem;
+ best_so_far = solve (start, end, i);
+ }
else
- {
- vector<Column_x_positions> cur = solve (start, end, i);
- bool too_many_lines = true;
-
- for (vsize j = 0; j < cur.size (); j++)
- if (cur[j].force_ < 0)
- {
- too_many_lines = false;
- break;
- }
- if (too_many_lines)
- return best_so_far;
- }
+ {
+ vector<Column_x_positions> cur = solve (start, end, i);
+ bool too_many_lines = true;
+
+ for (vsize j = 0; j < cur.size (); j++)
+ if (cur[j].force_ < 0)
+ {
+ too_many_lines = false;
+ break;
+ }
+ if (too_many_lines)
+ return best_so_far;
+ }
}
if (best_so_far.size ())
return best_so_far;
/* This loop structure is C&Ped from solve(). */
/* find the first solution that satisfies constraints */
- for (vsize sys = sys_count-1; sys != VPOS; sys--)
+ for (vsize sys = sys_count - 1; sys != VPOS; sys--)
{
for (vsize brk = end_brk; brk != VPOS; brk--)
{
if (!isinf (st.at (brk, sys).details_.force_))
{
if (brk != end_brk)
- {
- /*
- During initialize(), we only fill out a
- Line_details for lines that are valid (ie. not too
- long), otherwise line breaking becomes O(n^3).
- In case sys_count is such that no valid solution
- is found, we need to fill in the Line_details.
- */
- Line_details details;
- brk = st.at (brk, sys).prev_;
- sys--;
- fill_line_details (&details, brk, end_brk);
- ret.push_back (details);
- }
+ {
+ /*
+ During initialize(), we only fill out a
+ Line_details for lines that are valid (ie. not too
+ long), otherwise line breaking becomes O(n^3).
+ In case sys_count is such that no valid solution
+ is found, we need to fill in the Line_details.
+ */
+ Line_details details;
+ brk = st.at (brk, sys).prev_;
+ sys--;
+ fill_line_details (&details, brk, end_brk);
+ ret.push_back (details);
+ }
/* build up the good part of the solution */
for (vsize cur_sys = sys; cur_sys != VPOS; cur_sys--)
{
- vsize prev_brk = st.at (brk, cur_sys).prev_;
+ vsize prev_brk = st.at (brk, cur_sys).prev_;
assert (brk != VPOS);
ret.push_back (st.at (brk, cur_sys).details_);
brk = prev_brk;
if (perm1 == ly_symbol2scm ("force"))
return perm2;
if (perm1 == ly_symbol2scm ("allow")
- && perm2 != ly_symbol2scm ("force"))
+ && perm2 != ly_symbol2scm ("force"))
return perm2;
return SCM_EOL;
}
SCM page_breaking_spacing_spec = l->c_variable ("page-breaking-system-system-spacing");
Page_layout_problem::read_spacing_spec (spacing_spec,
- &system_system_space_,
- ly_symbol2scm ("basic-distance"));
+ &system_system_space_,
+ ly_symbol2scm ("basic-distance"));
Page_layout_problem::read_spacing_spec (page_breaking_spacing_spec,
- &system_system_space_,
- ly_symbol2scm ("basic-distance"));
+ &system_system_space_,
+ ly_symbol2scm ("basic-distance"));
Page_layout_problem::read_spacing_spec (title_spec,
- &system_markup_space_,
- ly_symbol2scm ("basic-distance"));
+ &system_markup_space_,
+ ly_symbol2scm ("basic-distance"));
Page_layout_problem::read_spacing_spec (spacing_spec,
- &system_system_padding_,
- ly_symbol2scm ("padding"));
+ &system_system_padding_,
+ ly_symbol2scm ("padding"));
Page_layout_problem::read_spacing_spec (between_scores_spec,
- &score_system_padding_,
- ly_symbol2scm ("padding"));
+ &score_system_padding_,
+ ly_symbol2scm ("padding"));
Page_layout_problem::read_spacing_spec (page_breaking_spacing_spec,
- &system_system_padding_,
- ly_symbol2scm ("padding"));
+ &system_system_padding_,
+ ly_symbol2scm ("padding"));
Page_layout_problem::read_spacing_spec (title_spec,
- &score_markup_padding_,
- ly_symbol2scm ("padding"));
+ &score_markup_padding_,
+ ly_symbol2scm ("padding"));
Page_layout_problem::read_spacing_spec (between_scores_spec,
- &score_system_min_distance_,
- ly_symbol2scm ("minimum-distance"));
+ &score_system_min_distance_,
+ ly_symbol2scm ("minimum-distance"));
Page_layout_problem::read_spacing_spec (spacing_spec,
- &system_system_min_distance_,
- ly_symbol2scm ("minimum-distance"));
+ &system_system_min_distance_,
+ ly_symbol2scm ("minimum-distance"));
Page_layout_problem::read_spacing_spec (page_breaking_spacing_spec,
- &system_system_min_distance_,
- ly_symbol2scm ("minimum-distance"));
+ &system_system_min_distance_,
+ ly_symbol2scm ("minimum-distance"));
Page_layout_problem::read_spacing_spec (title_spec,
- &score_markup_min_distance_,
- ly_symbol2scm ("minimum-distance"));
+ &score_markup_min_distance_,
+ ly_symbol2scm ("minimum-distance"));
Interval first_line = line_dimensions_int (pscore_->layout (), 0);
Interval other_lines = line_dimensions_int (pscore_->layout (), 1);
all_ = pscore_->root_system ()->used_columns ();
lines_.resize (breaks_.size (), breaks_.size (), Line_details ());
vector<Real> forces = get_line_forces (all_,
- other_lines.length (),
- other_lines.length () - first_line.length (),
- ragged_right_);
+ other_lines.length (),
+ other_lines.length () - first_line.length (),
+ ragged_right_);
for (vsize i = 0; i + 1 < breaks_.size (); i++)
{
for (vsize j = i + 1; j < breaks_.size (); j++)
- {
- bool last = j == breaks_.size () - 1;
- bool ragged = ragged_right_ || (last && ragged_last_);
- Line_details &line = lines_.at (j, i);
-
- line.force_ = forces[i*breaks_.size () + j];
- if (ragged && last && !isinf (line.force_))
- line.force_ = (line.force_ < 0 && j > i + 1) ? infinity_f : 0;
- if (isinf (line.force_))
- break;
-
- fill_line_details (&line, i, j);
- }
+ {
+ bool last = j == breaks_.size () - 1;
+ bool ragged = ragged_right_ || (last && ragged_last_);
+ Line_details &line = lines_.at (j, i);
+
+ line.force_ = forces[i * breaks_.size () + j];
+ if (ragged && last && !isinf (line.force_))
+ line.force_ = (line.force_ < 0 && j > i + 1) ? infinity_f : 0;
+ if (isinf (line.force_))
+ break;
+
+ fill_line_details (&line, i, j);
+ }
}
/* work out all the starting indices */
{
vsize j;
for (j = 0; j + 1 < breaks_.size () && breaks_[j] < start_[i]; j++)
- ;
+ ;
starting_breakpoints_.push_back (j);
start_[i] = breaks_[j];
}
/* turn permission should always be stricter than page permission
and page permission should always be stricter than line permission */
out->page_permission_ = min_permission (out->break_permission_,
- out->page_permission_);
+ out->page_permission_);
out->turn_permission_ = min_permission (out->page_permission_,
- out->turn_permission_);
+ out->turn_permission_);
begin_of_line_extent = (begin_of_line_extent.is_empty ()
- || isnan (begin_of_line_extent[LEFT])
- || isnan (begin_of_line_extent[RIGHT]))
- ? Interval (0, 0) : begin_of_line_extent;
+ || isnan (begin_of_line_extent[LEFT])
+ || isnan (begin_of_line_extent[RIGHT]))
+ ? Interval (0, 0) : begin_of_line_extent;
rest_of_line_extent = (rest_of_line_extent.is_empty ()
- || isnan (rest_of_line_extent[LEFT])
- || isnan (rest_of_line_extent[RIGHT]))
- ? Interval (0, 0) : rest_of_line_extent;
+ || isnan (rest_of_line_extent[LEFT])
+ || isnan (rest_of_line_extent[RIGHT]))
+ ? Interval (0, 0) : rest_of_line_extent;
out->shape_ = Line_shape (begin_of_line_extent, rest_of_line_extent);
out->padding_ = last ? score_system_padding_ : system_system_padding_;
out->title_padding_ = score_markup_padding_;
title_ = to_boolean (pb->get_property ("is-title"));
compressed_lines_count_ = 1;
compressed_nontitle_lines_count_ = title_ ? 0 : 1;
- SCM last_scm = pb->get_property ("last-markup-line");
- last_markup_line_ = to_boolean (last_scm);
+ SCM last_scm = pb->get_property ("last-markup-line");
+ last_markup_line_ = to_boolean (last_scm);
SCM first_scm = pb->get_property ("first-markup-line");
first_markup_line_ = to_boolean (first_scm);
tight_spacing_ = to_boolean (pb->get_property ("tight-spacing"));
Line_details::full_height () const
{
Interval ret;
- ret.unite(shape_.begin_);
- ret.unite(shape_.rest_);
- return ret.length();
+ ret.unite (shape_.begin_);
+ ret.unite (shape_.rest_);
+ return ret.length ();
}
Real
Line_shape
Line_shape::piggyback (Line_shape mount, Real padding) const
{
- Real elevation = max (begin_[UP]-mount.begin_[DOWN], rest_[UP]-mount.rest_[DOWN]);
+ Real elevation = max (begin_[UP] - mount.begin_[DOWN], rest_[UP] - mount.rest_[DOWN]);
Interval begin = Interval (begin_[DOWN], elevation + mount.begin_[UP] + padding);
Interval rest = Interval (rest_[DOWN], elevation + mount.rest_[UP] + padding);
return Line_shape (begin, rest);
IMPLEMENT_DEFAULT_EQUAL_P (Context_def);
int
-Context_def::print_smob (SCM smob, SCM port, scm_print_state*)
+Context_def::print_smob (SCM smob, SCM port, scm_print_state *)
{
Context_def *me = (Context_def *) SCM_CELL_WORD_1 (smob);
if (ly_symbol2scm ("default-child") == tag)
default_child_ = sym;
else if (ly_symbol2scm ("consists") == tag
- || ly_symbol2scm ("remove") == tag)
+ || ly_symbol2scm ("remove") == tag)
{
translator_mods_ = scm_cons (scm_list_2 (tag, sym), translator_mods_);
}
else if (ly_symbol2scm ("accepts") == tag
- || ly_symbol2scm ("denies") == tag)
+ || ly_symbol2scm ("denies") == tag)
accept_mods_ = scm_cons (scm_list_2 (tag, sym), accept_mods_);
else if (ly_symbol2scm ("pop") == tag
- || ly_symbol2scm ("push") == tag
- || ly_symbol2scm ("assign") == tag
- || ly_symbol2scm ("unset") == tag)
+ || ly_symbol2scm ("push") == tag
+ || ly_symbol2scm ("assign") == tag
+ || ly_symbol2scm ("unset") == tag)
property_ops_ = scm_cons (mod, property_ops_);
else if (ly_symbol2scm ("alias") == tag)
context_aliases_ = scm_cons (sym, context_aliases_);
SCM tag = scm_caar (s);
SCM sym = scm_cadar (s);
if (tag == ly_symbol2scm ("accepts"))
- acc = scm_cons (sym, acc);
+ acc = scm_cons (sym, acc);
else if (tag == ly_symbol2scm ("denies"))
- acc = scm_delete_x (sym, acc);
+ acc = scm_delete_x (sym, acc);
}
SCM def = get_default_child (user_mod);
if (scm_is_symbol (def))
{
if (scm_memq (def, acc))
- acc = scm_delete_x (def, acc);
+ acc = scm_delete_x (def, acc);
acc = scm_cons (def, acc);
}
{
SCM entry = scm_car (s);
if (scm_car (entry) == ly_symbol2scm ("default-child"))
- {
- name = scm_cadr (entry);
- break;
- }
+ {
+ name = scm_cadr (entry);
+ break;
+ }
}
return name;
*/
vector<Context_def *>
Context_def::path_to_acceptable_context (SCM type_sym,
- Output_def *odef,
- SCM additional_accepts) const
+ Output_def *odef,
+ SCM additional_accepts) const
{
set<const Context_def *> seen;
return internal_path_to_acceptable_context (type_sym, odef, additional_accepts, &seen);
The SEEN parameter is a set which keeps track of visited contexts, allowing
contexts of the same type to be nested.
*/
-vector<Context_def*>
+vector<Context_def *>
Context_def::internal_path_to_acceptable_context (SCM type_sym,
- Output_def *odef,
- SCM additional_accepts,
- set<const Context_def *> *seen) const
+ Output_def *odef,
+ SCM additional_accepts,
+ set<const Context_def *> *seen) const
{
assert (scm_is_symbol (type_sym));
SCM accepted = get_accepted (additional_accepts);
- vector<Context_def*> accepteds;
+ vector<Context_def *> accepteds;
for (SCM s = accepted; scm_is_pair (s); s = scm_cdr (s))
if (Context_def *t = unsmob_context_def (find_context_def (odef,
- scm_car (s))))
+ scm_car (s))))
accepteds.push_back (t);
- vector<Context_def*> best_result;
+ vector<Context_def *> best_result;
for (vsize i = 0; i < accepteds.size (); i++)
{
/* do not check aliases, because \context Staff should not
- create RhythmicStaff. */
+ create RhythmicStaff. */
if (ly_is_equal (accepteds[i]->get_context_name (), type_sym))
- {
- best_result.push_back (accepteds[i]);
- return best_result;
- }
+ {
+ best_result.push_back (accepteds[i]);
+ return best_result;
+ }
}
seen->insert (this);
Context_def *g = accepteds[i];
if (!seen->count (g))
- {
- vector<Context_def*> result
- = g->internal_path_to_acceptable_context (type_sym, odef, SCM_EOL, seen);
- if (result.size () && result.size () < best_depth)
- {
- best_depth = result.size ();
- result.insert (result.begin (), g);
- best_result = result;
- }
- }
+ {
+ vector<Context_def *> result
+ = g->internal_path_to_acceptable_context (type_sym, odef, SCM_EOL, seen);
+ if (result.size () && result.size () < best_depth)
+ {
+ best_depth = result.size ();
+ result.insert (result.begin (), g);
+ best_result = result;
+ }
+ }
}
seen->erase (this);
SCM arg = scm_cadar (s);
if (scm_is_string (arg))
- arg = scm_string_to_symbol (arg);
+ arg = scm_string_to_symbol (arg);
if (ly_symbol2scm ("consists") == tag)
- l1 = scm_cons (arg, l1);
+ l1 = scm_cons (arg, l1);
else if (ly_symbol2scm ("remove") == tag
- && get_translator (arg))
- l1 = scm_delete_x (arg, l1);
+ && get_translator (arg))
+ l1 = scm_delete_x (arg, l1);
}
return l1;
SCM ell = SCM_EOL;
ell = scm_cons (scm_cons (ly_symbol2scm ("consists"),
- get_translator_names (SCM_EOL)), ell);
+ get_translator_names (SCM_EOL)), ell);
ell = scm_cons (scm_cons (ly_symbol2scm ("description"), description_), ell);
ell = scm_cons (scm_cons (ly_symbol2scm ("aliases"), context_aliases_), ell);
ell = scm_cons (scm_cons (ly_symbol2scm ("accepts"), get_accepted (SCM_EOL)),
- ell);
+ ell);
ell = scm_cons (scm_cons (ly_symbol2scm ("property-ops"), property_ops_),
- ell);
+ ell);
ell = scm_cons (scm_cons (ly_symbol2scm ("context-name"), context_name_),
- ell);
+ ell);
if (scm_is_symbol (translator_group_type_))
ell = scm_cons (scm_cons (ly_symbol2scm ("group-type"),
- translator_group_type_), ell);
+ translator_group_type_), ell);
return ell;
}
#include "context-mod.hh"
LY_DEFINE (ly_get_context_mods,
- "ly:get-context-mods",
- 1, 0, 0, (SCM contextmod),
- "Returns the list of context modifications stored in"
- " @var{contextmod}.")
+ "ly:get-context-mods",
+ 1, 0, 0, (SCM contextmod),
+ "Returns the list of context modifications stored in"
+ " @var{contextmod}.")
{
Context_mod *tr = unsmob_context_mod (contextmod);
LY_ASSERT_SMOB (Context_mod, contextmod, 1);
}
LY_DEFINE (ly_add_context_mod,
- "ly:add-context-mod",
- 2, 0, 0, (SCM contextmods, SCM modification),
- "Adds the given context @var{modification} to the list"
- " @var{contextmods} of context modifications.")
+ "ly:add-context-mod",
+ 2, 0, 0, (SCM contextmods, SCM modification),
+ "Adds the given context @var{modification} to the list"
+ " @var{contextmods} of context modifications.")
{
Context_mod *ctxmod = unsmob_context_mod (contextmods);
LY_ASSERT_SMOB (Context_mod, contextmods, 1);
#include "ly-smobs.icc"
IMPLEMENT_SIMPLE_SMOBS (Context_mod);
IMPLEMENT_DEFAULT_EQUAL_P (Context_mod);
+IMPLEMENT_TYPE_P (Context_mod, "ly:context-mod?");
int
-Context_mod::print_smob (SCM smob, SCM port, scm_print_state*)
+Context_mod::print_smob (SCM smob, SCM port, scm_print_state *)
{
Context_mod *me = (Context_mod *) SCM_CELL_WORD_1 (smob);
*/
void
general_pushpop_property (Context *context,
- SCM context_property,
- SCM grob_property_path,
- SCM new_value)
+ SCM context_property,
+ SCM grob_property_path,
+ SCM new_value)
{
if (!scm_is_symbol (context_property)
|| !scm_is_symbol (scm_car (grob_property_path)))
{
warning (_ ("need symbol arguments for \\override and \\revert"));
if (do_internal_type_checking_global)
- assert (false);
+ assert (false);
}
sloppy_general_pushpop_property (context, context_property,
- grob_property_path, new_value);
+ grob_property_path, new_value);
}
-
/*
Grob descriptions (ie. alists with layout properties) are
represented as a (ALIST . BASED-ON) pair, where BASED-ON is the
Push or pop (depending on value of VAL) a single entry from a
translator property list by name of PROP. GROB_PROPERTY_PATH
indicates nested alists, eg. '(beamed-stem-lengths details)
-
*/
void
execute_override_property (Context *context,
- SCM context_property,
- SCM grob_property_path,
- SCM new_value)
+ SCM context_property,
+ SCM grob_property_path,
+ SCM new_value)
{
SCM current_context_val = SCM_EOL;
Context *where = context->where_defined (context_property,
- ¤t_context_val);
+ ¤t_context_val);
/*
Don't mess with MIDI.
if (scm_is_pair (scm_cdr (grob_property_path)))
{
new_value = nested_property_alist (ly_assoc_get (symbol, target_alist,
- SCM_EOL),
- scm_cdr (grob_property_path),
- new_value);
+ SCM_EOL),
+ scm_cdr (grob_property_path),
+ new_value);
}
/* it's tempting to replace the head of the list if it's the same
if (!ly_is_procedure (new_value)
&& !is_simple_closure (new_value))
ok = type_check_assignment (symbol, new_value,
- ly_symbol2scm ("backend-type?"));
+ ly_symbol2scm ("backend-type?"));
/*
tack onto alist. We can use set_car, since
*/
void
sloppy_general_pushpop_property (Context *context,
- SCM context_property,
- SCM grob_property_path,
- SCM new_value)
+ SCM context_property,
+ SCM grob_property_path,
+ SCM new_value)
{
if (new_value == SCM_UNDEFINED)
execute_revert_property (context, context_property,
- grob_property_path);
+ grob_property_path);
else
execute_override_property (context, context_property,
- grob_property_path,
- new_value);
+ grob_property_path,
+ new_value);
}
/*
*/
void
execute_revert_property (Context *context,
- SCM context_property,
- SCM grob_property_path)
+ SCM context_property,
+ SCM grob_property_path)
{
SCM current_context_val = SCM_EOL;
if (context->where_defined (context_property, ¤t_context_val)
SCM daddy = scm_cdr (current_context_val);
if (!scm_is_pair (grob_property_path)
- || !scm_is_symbol (scm_car (grob_property_path)))
- {
- programming_error ("Grob property path should be list of symbols.");
- return;
- }
+ || !scm_is_symbol (scm_car (grob_property_path)))
+ {
+ programming_error ("Grob property path should be list of symbols.");
+ return;
+ }
SCM symbol = scm_car (grob_property_path);
if (scm_is_pair (scm_cdr (grob_property_path)))
- {
- SCM current_sub_alist = ly_assoc_get (symbol, current_alist, SCM_EOL);
- SCM new_val
- = nested_property_revert_alist (current_sub_alist,
- scm_cdr (grob_property_path));
-
- if (scm_is_pair (current_alist)
- && scm_caar (current_alist) == symbol
- && current_alist != daddy)
- current_alist = scm_cdr (current_alist);
-
- current_alist = scm_acons (symbol, new_val, current_alist);
- scm_set_car_x (current_context_val, current_alist);
- }
+ {
+ SCM current_sub_alist = ly_assoc_get (symbol, current_alist, SCM_EOL);
+ SCM new_val
+ = nested_property_revert_alist (current_sub_alist,
+ scm_cdr (grob_property_path));
+
+ if (scm_is_pair (current_alist)
+ && scm_caar (current_alist) == symbol
+ && current_alist != daddy)
+ current_alist = scm_cdr (current_alist);
+
+ current_alist = scm_acons (symbol, new_val, current_alist);
+ scm_set_car_x (current_context_val, current_alist);
+ }
else
- {
- SCM new_alist = evict_from_alist (symbol, current_alist, daddy);
-
- if (new_alist == daddy)
- context->unset_property (context_property);
- else
- context->set_property (context_property,
- scm_cons (new_alist, daddy));
- }
+ {
+ SCM new_alist = evict_from_alist (symbol, current_alist, daddy);
+
+ if (new_alist == daddy)
+ context->unset_property (context_property);
+ else
+ context->set_property (context_property,
+ scm_cons (new_alist, daddy));
+ }
}
}
/*
*/
void
execute_pushpop_property (Context *context,
- SCM context_property,
- SCM grob_property,
- SCM new_value)
+ SCM context_property,
+ SCM grob_property,
+ SCM new_value)
{
general_pushpop_property (context, context_property,
- scm_list_1 (grob_property),
- new_value);
+ scm_list_1 (grob_property),
+ new_value);
}
/*
entry = scm_cdr (entry);
if (type == ly_symbol2scm ("push"))
- {
- SCM context_prop = scm_car (entry);
- SCM val = scm_cadr (entry);
- SCM grob_prop_path = scm_cddr (entry);
- sloppy_general_pushpop_property (tg, context_prop, grob_prop_path, val);
- }
+ {
+ SCM context_prop = scm_car (entry);
+ SCM val = scm_cadr (entry);
+ SCM grob_prop_path = scm_cddr (entry);
+ sloppy_general_pushpop_property (tg, context_prop, grob_prop_path, val);
+ }
else if (type == ly_symbol2scm ("pop"))
- {
- SCM context_prop = scm_car (entry);
- SCM val = SCM_UNDEFINED;
- SCM grob_prop_path = scm_cdr (entry);
- sloppy_general_pushpop_property (tg, context_prop, grob_prop_path, val);
- }
+ {
+ SCM context_prop = scm_car (entry);
+ SCM val = SCM_UNDEFINED;
+ SCM grob_prop_path = scm_cdr (entry);
+ sloppy_general_pushpop_property (tg, context_prop, grob_prop_path, val);
+ }
else if (type == ly_symbol2scm ("assign"))
- tg->set_property (scm_car (entry), scm_cadr (entry));
+ tg->set_property (scm_car (entry), scm_cadr (entry));
}
}
SCM daddy_props
= (tg->get_parent_context ())
- ? updated_grob_properties (tg->get_parent_context (), sym)
- : SCM_EOL;
+ ? updated_grob_properties (tg->get_parent_context (), sym)
+ : SCM_EOL;
if (!scm_is_pair (props))
{
SCM *tail = ©
SCM p = scm_car (props);
while (p != based_on)
- {
- *tail = scm_cons (scm_car (p), daddy_props);
- tail = SCM_CDRLOC (*tail);
- p = scm_cdr (p);
- }
+ {
+ *tail = scm_cons (scm_car (p), daddy_props);
+ tail = SCM_CDRLOC (*tail);
+ p = scm_cdr (p);
+ }
scm_set_car_x (props, copy);
scm_set_cdr_x (props, daddy_props);
#include "dispatcher.hh"
LY_DEFINE (ly_context_current_moment,
- "ly:context-current-moment",
- 1, 0, 0, (SCM context),
- "Return the current moment of @var{context}.")
+ "ly:context-current-moment",
+ 1, 0, 0, (SCM context),
+ "Return the current moment of @var{context}.")
{
Context *tr = unsmob_context (context);
}
LY_DEFINE (ly_context_id, "ly:context-id",
- 1, 0, 0, (SCM context),
- "Return the ID string of @var{context},"
- " i.e., for @code{\\context Voice = \"one\" @dots{}}"
- " return the string @code{one}.")
+ 1, 0, 0, (SCM context),
+ "Return the ID string of @var{context},"
+ " i.e., for @code{\\context Voice = \"one\" @dots{}}"
+ " return the string @code{one}.")
{
Context *tr = unsmob_context (context);
}
LY_DEFINE (ly_context_name, "ly:context-name",
- 1, 0, 0, (SCM context),
- "Return the name of @var{context},"
- " i.e., for @code{\\context Voice = \"one\" @dots{}}"
- " return the symbol @code{Voice}.")
+ 1, 0, 0, (SCM context),
+ "Return the name of @var{context},"
+ " i.e., for @code{\\context Voice = \"one\" @dots{}}"
+ " return the symbol @code{Voice}.")
{
LY_ASSERT_SMOB (Context, context, 1);
}
LY_DEFINE (ly_context_grob_definition, "ly:context-grob-definition",
- 2, 0, 0, (SCM context, SCM name),
- "Return the definition of @var{name} (a symbol) within"
- " @var{context} as an alist.")
+ 2, 0, 0, (SCM context, SCM name),
+ "Return the definition of @var{name} (a symbol) within"
+ " @var{context} as an alist.")
{
Context *tr = unsmob_context (context);
}
LY_DEFINE (ly_context_pushpop_property, "ly:context-pushpop-property",
- 3, 1, 0, (SCM context, SCM grob, SCM eltprop, SCM val),
- "Do a single @code{\\override} or @code{\\revert} operation"
- " in @var{context}. The grob definition @var{grob} is extended"
- " with @var{eltprop} (if @var{val} is specified) or reverted"
- " (if unspecified).")
+ 3, 1, 0, (SCM context, SCM grob, SCM eltprop, SCM val),
+ "Do a single @code{\\override} or @code{\\revert} operation"
+ " in @var{context}. The grob definition @var{grob} is extended"
+ " with @var{eltprop} (if @var{val} is specified) or reverted"
+ " (if unspecified).")
{
Context *tg = unsmob_context (context);
}
LY_DEFINE (ly_context_set_property_x, "ly:context-set-property!",
- 3, 0, 0, (SCM context, SCM name, SCM val),
- "Set value of property @var{name} in context @var{context}"
- " to @var{val}.")
+ 3, 0, 0, (SCM context, SCM name, SCM val),
+ "Set value of property @var{name} in context @var{context}"
+ " to @var{val}.")
{
LY_ASSERT_SMOB (Context, context, 1);
LY_ASSERT_TYPE (ly_is_symbol, name, 2);
}
LY_DEFINE (ly_context_property_where_defined, "ly:context-property-where-defined",
- 2, 0, 0, (SCM context, SCM name),
- "Return the context above @var{context}"
- " where @var{name} is defined.")
+ 2, 0, 0, (SCM context, SCM name),
+ "Return the context above @var{context}"
+ " where @var{name} is defined.")
{
LY_ASSERT_SMOB (Context, context, 1);
LY_ASSERT_TYPE (ly_is_symbol, name, 2);
}
LY_DEFINE (ly_context_unset_property, "ly:context-unset-property", 2, 0, 0,
- (SCM context, SCM name),
- "Unset value of property @var{name} in context @var{context}.")
+ (SCM context, SCM name),
+ "Unset value of property @var{name} in context @var{context}.")
{
LY_ASSERT_SMOB (Context, context, 1);
LY_ASSERT_TYPE (ly_is_symbol, name, 2);
}
LY_DEFINE (ly_context_parent, "ly:context-parent",
- 1, 0, 0, (SCM context),
- "Return the parent of @var{context}, @code{#f} if none.")
+ 1, 0, 0, (SCM context),
+ "Return the parent of @var{context}, @code{#f} if none.")
{
LY_ASSERT_SMOB (Context, context, 1);
Context *tr = unsmob_context (context);
/* FIXME: todo: should support translator IDs, and creation? */
LY_DEFINE (ly_context_find, "ly:context-find",
- 2, 0, 0, (SCM context, SCM name),
- "Find a parent of @var{context} that has name or alias @var{name}."
- " Return @code{#f} if not found.")
+ 2, 0, 0, (SCM context, SCM name),
+ "Find a parent of @var{context} that has name or alias @var{name}."
+ " Return @code{#f} if not found.")
{
LY_ASSERT_SMOB (Context, context, 1);
LY_ASSERT_TYPE (ly_is_symbol, name, 2);
while (tr)
{
if (tr->is_alias (name))
- return tr->self_scm ();
+ return tr->self_scm ();
tr = tr->get_parent_context ();
}
}
LY_DEFINE (ly_context_now, "ly:context-now",
- 1, 0, 0, (SCM context),
- "Return @code{now-moment} of context @var{context}.")
+ 1, 0, 0, (SCM context),
+ "Return @code{now-moment} of context @var{context}.")
{
LY_ASSERT_SMOB (Context, context, 1);
Context *ctx = unsmob_context (context);
#include "context.hh"
#include "music.hh"
-
class Context_specced_music_iterator : public Music_wrapper_iterator
{
public:
Context::is_removable () const
{
return context_list_ == SCM_EOL && ! iterator_count_
- && !dynamic_cast<Global_context const *> (daddy_context_);
+ && !dynamic_cast<Global_context const *> (daddy_context_);
}
void
ctx->check_removal ();
if (ctx->is_removable ())
- {
- recurse_over_translators (ctx, &Translator::finalize,
- &Translator_group::finalize,
- UP);
- send_stream_event (ctx, "RemoveContext", 0, 0);
- }
+ {
+ recurse_over_translators (ctx, &Translator::finalize,
+ &Translator_group::finalize,
+ UP);
+ send_stream_event (ctx, "RemoveContext", 0, 0);
+ }
}
}
Context::add_context (Context *child)
{
context_list_ = ly_append2 (context_list_,
- scm_cons (child->self_scm (), SCM_EOL));
+ scm_cons (child->self_scm (), SCM_EOL));
child->daddy_context_ = this;
this->events_below_->register_as_listener (child->events_below_);
}
-
Context::Context ()
{
daddy_context_ = 0;
// Iterate through the path and create all of the implicit contexts.
for (vsize i = 0; i < path.size (); i++)
- {
- SCM ops = SCM_EOL;
- string id_str = "\\new";
- if (i == path.size () - 1)
- {
- ops = operations;
- id_str = id;
- }
- current = current->create_context (path[i],
- id_str,
- ops);
- }
+ {
+ SCM ops = SCM_EOL;
+ string id_str = "\\new";
+ if (i == path.size () - 1)
+ {
+ ops = operations;
+ id_str = id;
+ }
+ current = current->create_context (path[i],
+ id_str,
+ ops);
+ }
return current;
}
else
{
warning (_f ("cannot find or create new `%s'",
- ly_symbol2string (name).c_str ()));
+ ly_symbol2string (name).c_str ()));
ret = 0;
}
return ret;
return tg;
}
- vector<Context_def*> path = path_to_acceptable_context (n);
+ vector<Context_def *> path = path_to_acceptable_context (n);
if (path.size ())
{
// start at 1. The first one (index 0) will be us.
for (vsize i = 0; i < path.size (); i++)
- {
- SCM ops = (i == path.size () -1) ? operations : SCM_EOL;
+ {
+ SCM ops = (i == path.size () - 1) ? operations : SCM_EOL;
- string this_id = "";
- if (i == path.size () -1)
- this_id = id;
+ string this_id = "";
+ if (i == path.size () - 1)
+ this_id = id;
- current = current->create_context (path[i],
- this_id,
- ops);
- }
+ current = current->create_context (path[i],
+ this_id,
+ ops);
+ }
return current;
}
else
{
warning (_f ("cannot find or create `%s' called `%s'",
- ly_symbol2string (n).c_str (), id));
+ ly_symbol2string (n).c_str (), id));
ret = 0;
}
return ret;
Context::set_property_from_event (SCM sev)
{
Stream_event *ev = unsmob_stream_event (sev);
-
+
SCM sym = ev->get_property ("symbol");
if (scm_is_symbol (sym))
{
SCM val = ev->get_property ("value");
bool ok = true;
if (val != SCM_EOL)
- ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?"));
+ ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?"));
if (ok)
- set_property (sym, val);
+ set_property (sym, val);
}
}
Context::unset_property_from_event (SCM sev)
{
Stream_event *ev = unsmob_stream_event (sev);
-
+
SCM sym = ev->get_property ("symbol");
type_check_assignment (sym, SCM_EOL, ly_symbol2scm ("translation-type?"));
unset_property (sym);
Context::create_context_from_event (SCM sev)
{
Stream_event *ev = unsmob_stream_event (sev);
-
+
string id = ly_scm2string (ev->get_property ("id"));
SCM ops = ev->get_property ("ops");
SCM type_scm = ev->get_property ("type");
string type = ly_symbol2string (type_scm);
-
- vector<Context_def*> path = path_to_acceptable_context (type_scm);
+
+ vector<Context_def *> path = path_to_acceptable_context (type_scm);
if (path.size () != 1)
{
return;
}
Context_def *cdef = path[0];
-
+
Context *new_context = cdef->instantiate (ops);
new_context->id_string_ = id;
-
+
/* Register various listeners:
- Make the new context hear events that universally affect contexts
- connect events_below etc. properly */
/* We want to be the first ones to hear our own events. Therefore, wait
before registering events_below_ */
new_context->event_source ()->
- add_listener (GET_LISTENER (new_context->create_context_from_event),
- ly_symbol2scm ("CreateContext"));
+ add_listener (GET_LISTENER (new_context->create_context_from_event),
+ ly_symbol2scm ("CreateContext"));
new_context->event_source ()->
- add_listener (GET_LISTENER (new_context->remove_context),
- ly_symbol2scm ("RemoveContext"));
+ add_listener (GET_LISTENER (new_context->remove_context),
+ ly_symbol2scm ("RemoveContext"));
new_context->event_source ()->
- add_listener (GET_LISTENER (new_context->change_parent),
- ly_symbol2scm ("ChangeParent"));
+ add_listener (GET_LISTENER (new_context->change_parent),
+ ly_symbol2scm ("ChangeParent"));
new_context->event_source ()->
- add_listener (GET_LISTENER (new_context->set_property_from_event),
- ly_symbol2scm ("SetProperty"));
+ add_listener (GET_LISTENER (new_context->set_property_from_event),
+ ly_symbol2scm ("SetProperty"));
new_context->event_source ()->
- add_listener (GET_LISTENER (new_context->unset_property_from_event),
- ly_symbol2scm ("UnsetProperty"));
+ add_listener (GET_LISTENER (new_context->unset_property_from_event),
+ ly_symbol2scm ("UnsetProperty"));
new_context->events_below_->register_as_listener (new_context->event_source_);
this->add_context (new_context);
apply_property_operations (new_context, ops);
send_stream_event (this, "AnnounceNewContext", 0,
- ly_symbol2scm ("context"), new_context->self_scm (),
- ly_symbol2scm ("creator"), sev);
+ ly_symbol2scm ("context"), new_context->self_scm (),
+ ly_symbol2scm ("creator"), sev);
}
-vector<Context_def*>
+vector<Context_def *>
Context::path_to_acceptable_context (SCM name) const
{
// The 'accepts elements in definition_mods_ is a list of ('accepts string),
for (SCM s = scm_reverse (definition_mods_); scm_is_pair (s); s = scm_cdr (s))
if (scm_caar (s) == ly_symbol2scm ("accepts"))
{
- SCM elt = scm_list_2 (scm_caar (s), scm_string_to_symbol (scm_cadar (s)));
- accepts = scm_cons (elt, accepts);
+ SCM elt = scm_list_2 (scm_caar (s), scm_string_to_symbol (scm_cadar (s)));
+ accepts = scm_cons (elt, accepts);
}
return unsmob_context_def (definition_)->path_to_acceptable_context (name,
- get_output_def (),
- accepts);
-
+ get_output_def (),
+ accepts);
+
}
Context *
Context::create_context (Context_def *cdef,
- string id,
- SCM ops)
+ string id,
+ SCM ops)
{
infant_event_ = 0;
/* TODO: This is fairly misplaced. We can fix this when we have taken out all
iterator specific stuff from the Context class */
event_source_->
- add_listener (GET_LISTENER (acknowledge_infant),
- ly_symbol2scm ("AnnounceNewContext"));
+ add_listener (GET_LISTENER (acknowledge_infant),
+ ly_symbol2scm ("AnnounceNewContext"));
/* The CreateContext creates a new context, and sends an announcement of the
new context through another event. That event will be stored in
infant_event_ to create a return value. */
ly_symbol2scm ("type"), cdef->get_context_name (),
ly_symbol2scm ("id"), ly_string2scm (id));
event_source_->
- remove_listener (GET_LISTENER (acknowledge_infant),
- ly_symbol2scm ("AnnounceNewContext"));
+ remove_listener (GET_LISTENER (acknowledge_infant),
+ ly_symbol2scm ("AnnounceNewContext"));
assert (infant_event_);
SCM infant_scm = infant_event_->get_property ("context");
Context::default_child_context_name () const
{
return scm_is_pair (accepts_list_)
- ? scm_car (accepts_list_)
- : SCM_EOL;
+ ? scm_car (accepts_list_)
+ : SCM_EOL;
}
bool
string name = ly_symbol2string (nm);
Context_def *t = unsmob_context_def (st);
if (!t)
- {
- warning (_f ("cannot find or create: `%s'", name.c_str ()));
- t = unsmob_context_def (this->definition_);
- }
+ {
+ warning (_f ("cannot find or create: `%s'", name.c_str ()));
+ t = unsmob_context_def (this->definition_);
+ }
Context *tg = create_context (t, context_id, SCM_EOL);
return tg->get_default_interpreter (context_id);
Stream_event *e = new Stream_event (type, origin);
for (int i = 0; props[i]; i += 2)
{
- e->set_property (props[i], props[i+1]);
+ e->set_property (props[i], props[i + 1]);
}
event_source_->broadcast (e);
e->unprotect ();
/* we don't (yet) instrument context properties */
void
-Context::instrumented_set_property (SCM sym, SCM val, const char*, int, const char*)
+Context::instrumented_set_property (SCM sym, SCM val, const char *, int, const char *)
{
internal_set_property (sym, val);
}
void
Context::internal_set_property (SCM sym, SCM val)
{
+ bool type_check_ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?"));
+
if (do_internal_type_checking_global)
- assert (type_check_assignment (sym, val, ly_symbol2scm ("translation-type?")));
+ assert (type_check_ok);
- properties_dict ()->set (sym, val);
+ if (type_check_ok)
+ properties_dict ()->set (sym, val);
}
/*
*/
Context *
find_context_below (Context *where,
- SCM type, string id)
+ SCM type, string id)
{
if (where->is_alias (type))
{
if (id == "" || where->id_string () == id)
- return where;
+ return where;
}
Context *found = 0;
m = *unsmob_moment (sm);
if (m.main_part_ < Rational (0))
- {
- Rational length (measure_length (context));
- while (m.main_part_ < Rational (0))
- m.main_part_ += length;
- }
+ {
+ Rational length (measure_length (context));
+ while (m.main_part_ < Rational (0))
+ m.main_part_ += length;
+ }
}
return m;
Moment pos = measure_position (context);
Rational dur_length = dur ? dur->get_length () : Rational (0);
- Moment end_pos = pos.grace_part_ < Rational(0)
- ? Moment(pos.main_part_, pos.grace_part_ + dur_length)
- : Moment(pos.main_part_ + dur_length, 0);
+ Moment end_pos = pos.grace_part_ < Rational (0)
+ ? Moment (pos.main_part_, pos.grace_part_ + dur_length)
+ : Moment (pos.main_part_ + dur_length, 0);
return end_pos;
}
return bn;
}
-
void
set_context_property_on_children (Context *trans, SCM sym, SCM val)
{
{
SCM proc = context->get_property ("repeatCountVisibility");
return (ly_is_procedure (proc)
- && to_boolean (scm_call_2 (proc,
- count,
- context->self_scm ())));
+ && to_boolean (scm_call_2 (proc,
+ count,
+ context->self_scm ())));
}
virtual void acknowledge_audio_element (Audio_element_info info);
};
-
Control_track_performer::Control_track_performer ()
{
control_track_ = 0;
void
Control_track_performer::acknowledge_audio_element (Audio_element_info info)
{
- if (Audio_tempo *tempo = dynamic_cast<Audio_tempo*> (info.elem_))
+ if (Audio_tempo *tempo = dynamic_cast<Audio_tempo *> (info.elem_))
{
control_track_->add_audio_item (tempo);
}
- if (Audio_time_signature * sig = dynamic_cast<Audio_time_signature *> (info.elem_))
+ if (Audio_time_signature *sig = dynamic_cast<Audio_time_signature *> (info.elem_))
{
control_track_->add_audio_item (sig);
}
control_track_->add_audio_item (text);
announce_element (Audio_element_info (text, 0));
-
+
}
void
announce_element (Audio_element_info (control_track_, 0));
string id_string = String_convert::pad_to (gnu_lilypond_version_string (), 30);
-
+
add_text (Audio_text::TRACK_NAME, "control track");
add_text (Audio_text::TEXT, "creator: ");
add_text (Audio_text::TEXT, id_string);
}
ADD_TRANSLATOR (Control_track_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
abs_oct = abs (abs_oct) + 1;
SCM txt = scm_number_to_string (scm_from_int (abs_oct),
- scm_from_int (10));
+ scm_from_int (10));
g->set_property ("text",
- scm_list_n (ly_lily_module_constant ("vcenter-markup"),
- txt, SCM_UNDEFINED));
+ scm_list_n (ly_lily_module_constant ("vcenter-markup"),
+ txt, SCM_UNDEFINED));
Side_position_interface::add_support (g, clef_);
g->set_parent (clef_, Y_AXIS);
clef_ = c;
SCM cpos = get_property ("cueClefPosition");
if (scm_is_number (cpos))
- clef_->set_property ("staff-position", cpos);
+ clef_->set_property ("staff-position", cpos);
create_octavate_eight (get_property ("cueClefOctavation"));
}
clef_ = make_item ("CueEndClef", SCM_EOL);
SCM cpos = get_property ("clefPosition");
if (scm_is_number (cpos))
- clef_->set_property ("staff-position", cpos);
+ clef_->set_property ("staff-position", cpos);
create_octavate_eight (get_property ("clefOctavation"));
}
{
set_glyph ();
if (scm_is_string (glyph))
- {
- create_clef ();
- if (clef_)
- clef_->set_property ("non-default", SCM_BOOL_T);
- }
+ {
+ create_clef ();
+ if (clef_)
+ clef_->set_property ("non-default", SCM_BOOL_T);
+ }
else
create_end_clef ();
{
SCM vis = 0;
if (to_boolean (clef_->get_property ("non-default")))
- vis = get_property ("explicitCueClefVisibility");
+ vis = get_property ("explicitCueClefVisibility");
if (vis)
- clef_->set_property ("break-visibility", vis);
+ clef_->set_property ("break-visibility", vis);
clef_ = 0;
octavate_ = 0;
ADD_ACKNOWLEDGER (Cue_clef_engraver, bar_line);
ADD_TRANSLATOR (Cue_clef_engraver,
- /* doc */
- "Determine and set reference point for pitches in cued voices.",
-
- /* create */
- "CueClef "
- "CueEndClef "
- "OctavateEight ",
-
- /* read */
- "cueClefGlyph "
- "cueClefOctavation "
- "cueClefPosition "
- "explicitCueClefVisibility "
- "middleCCuePosition "
- "clefOctavation ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Determine and set reference point for pitches in cued voices.",
+
+ /* create */
+ "CueClef "
+ "CueEndClef "
+ "OctavateEight ",
+
+ /* read */
+ "cueClefGlyph "
+ "cueClefOctavation "
+ "cueClefPosition "
+ "explicitCueClefVisibility "
+ "middleCCuePosition "
+ "clefOctavation ",
+
+ /* write */
+ ""
+ );
private:
Item *create_custos ();
bool custos_permitted_;
- vector<Grob*> custodes_;
+ vector<Grob *> custodes_;
vector<Pitch> pitches_;
};
{
/*
- ideally, we'd do custos->set_parent (Y_AXIS, notehead),
- but since the note head lives on the other system, we can't
+ ideally, we'd do custos->set_parent (Y_AXIS, notehead),
+ but since the note head lives on the other system, we can't
- So we copy the position from the note head pitch. We
- don't look at the staff-position, since we can't be sure
- whether Clef_engraver already applied a vertical shift.
+ So we copy the position from the note head pitch. We
+ don't look at the staff-position, since we can't be sure
+ whether Clef_engraver already applied a vertical shift.
*/
pitches_.push_back (*unsmob_pitch (ev->get_property ("pitch")));
}
if (custos_permitted_)
{
for (vsize i = pitches_.size (); i--;)
- {
- Item *c = create_custos ();
+ {
+ Item *c = create_custos ();
- int p = pitches_[i].steps ();
- SCM c0 = get_property ("middleCPosition");
- if (scm_is_number (c0))
- p += scm_to_int (c0);
+ int p = pitches_[i].steps ();
+ SCM c0 = get_property ("middleCPosition");
+ if (scm_is_number (c0))
+ p += scm_to_int (c0);
- c->set_property ("staff-position",
- scm_from_int (p));
- }
+ c->set_property ("staff-position",
+ scm_from_int (p));
+ }
pitches_.clear ();
}
ADD_ACKNOWLEDGER (Custos_engraver, note_head);
ADD_TRANSLATOR (Custos_engraver,
- /* doc */
- "Engrave custodes.",
+ /* doc */
+ "Engrave custodes.",
- /* create */
- "Custos ",
+ /* create */
+ "Custos ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
}
ADD_INTERFACE (Custos,
- "A custos object. @code{style} can have four valid values:"
- " @code{mensural}, @code{vaticana}, @code{medicaea}, and"
- " @code{hufnagel}. @code{mensural} is the default style.",
-
- /* properties */
- "style "
- "neutral-position "
- "neutral-direction "
- );
+ "A custos object. @code{style} can have four valid values:"
+ " @code{mensural}, @code{vaticana}, @code{medicaea}, and"
+ " @code{hufnagel}. @code{mensural} is the default style.",
+
+ /* properties */
+ "style "
+ "neutral-position "
+ "neutral-direction "
+ );
#include "translator.icc"
ADD_TRANSLATOR (Default_bar_line_engraver,
- /* doc */
- "This engraver determines what kind of automatic bar lines"
- " should be produced, and sets @code{whichBar} accordingly."
- " It should be at the same level as @ref{Timing_translator}.",
-
- /* create */
- "",
-
- /* read */
- "automaticBars "
- "barAlways "
- "defaultBarType "
- "measureLength "
- "whichBar "
- "measurePosition ",
-
- /* write */
- "automaticBars "
- );
+ /* doc */
+ "This engraver determines what kind of automatic bar lines"
+ " should be produced, and sets @code{whichBar} accordingly."
+ " It should be at the same level as @ref{Timing_translator}.",
+
+ /* create */
+ "",
+
+ /* read */
+ "automaticBars "
+ "barAlways "
+ "defaultBarType "
+ "measureLength "
+ "whichBar "
+ "measurePosition ",
+
+ /* write */
+ "automaticBars "
+ );
Default_bar_line_engraver::Default_bar_line_engraver ()
{
Moment mp = measure_position (context ());
bool start_of_measure = (last_moment_.main_part_ != now.main_part_
- && !mp.main_part_);
+ && !mp.main_part_);
if (!scm_is_string (which) && to_boolean (automatic_bars))
{
SCM always = get_property ("barAlways");
if ((start_of_measure && last_moment_.main_part_ >= Moment (0))
- || to_boolean (always))
- {
- /* should this work, or be junked? See input/bugs/no-bars.ly */
- which = get_property ("defaultBarType");
- }
+ || to_boolean (always))
+ {
+ /* should this work, or be junked? See input/bugs/no-bars.ly */
+ which = get_property ("defaultBarType");
+ }
}
context ()->set_property ("whichBar", which);
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "dimension-cache.hh"
#include "warn.hh"
#include "warn.hh"
LY_DEFINE (ly_pt, "ly:pt",
- 1, 0, 0, (SCM num),
- "@var{num} printer points.")
+ 1, 0, 0, (SCM num),
+ "@var{num} printer points.")
{
LY_ASSERT_TYPE (scm_is_number, num, 1);
return scm_from_double (point_constant
- * scm_to_double (num));
+ * scm_to_double (num));
}
LY_DEFINE (ly_cm, "ly:cm",
- 1, 0, 0, (SCM num),
- "@var{num} cm.")
+ 1, 0, 0, (SCM num),
+ "@var{num} cm.")
{
LY_ASSERT_TYPE (scm_is_number, num, 1);
return scm_from_double (cm_constant
- * scm_to_double (num));
+ * scm_to_double (num));
}
LY_DEFINE (ly_inch, "ly:inch",
- 1, 0, 0, (SCM num),
- "@var{num} inches.")
+ 1, 0, 0, (SCM num),
+ "@var{num} inches.")
{
LY_ASSERT_TYPE (scm_is_number, num, 1);
return scm_from_double (inch_constant
- * scm_to_double (num));
+ * scm_to_double (num));
}
LY_DEFINE (ly_mm, "ly:mm",
- 1, 0, 0, (SCM num),
- "@var{num} mm.")
+ 1, 0, 0, (SCM num),
+ "@var{num} mm.")
{
LY_ASSERT_TYPE (scm_is_number, num, 1);
return scm_from_double (mm_constant
- * scm_to_double (num));
+ * scm_to_double (num));
}
LY_DEFINE (ly_bp, "ly:bp",
- 1, 0, 0, (SCM num),
- "@var{num} bigpoints (1/72th inch).")
+ 1, 0, 0, (SCM num),
+ "@var{num} bigpoints (1/72th inch).")
{
LY_ASSERT_TYPE (scm_is_number, num, 1);
return scm_from_double (bigpoint_constant
- * scm_to_double (num));
+ * scm_to_double (num));
}
#include "dispatcher.hh"
LY_DEFINE (ly_make_dispatcher, "ly:make-dispatcher",
- 0, 0, 0, (),
- "Return a newly created dispatcher.")
+ 0, 0, 0, (),
+ "Return a newly created dispatcher.")
{
return (new Dispatcher ())->unprotect ();
}
LY_DEFINE (ly_connect_dispatchers, "ly:connect-dispatchers",
- 2, 0, 0, (SCM to, SCM from),
- "Make the dispatcher @var{to} listen to events from @var{from}.")
+ 2, 0, 0, (SCM to, SCM from),
+ "Make the dispatcher @var{to} listen to events from @var{from}.")
{
Dispatcher *t = unsmob_dispatcher (to);
Dispatcher *f = unsmob_dispatcher (from);
-
- LY_ASSERT_SMOB (Dispatcher, to, 1);
- LY_ASSERT_SMOB (Dispatcher, from, 2);
+
+ LY_ASSERT_SMOB (Dispatcher, to, 1);
+ LY_ASSERT_SMOB (Dispatcher, from, 2);
t->register_as_listener (f);
}
LY_DEFINE (ly_add_listener, "ly:add-listener",
- 2, 0, 1, (SCM list, SCM disp, SCM cl),
- "Add the listener @var{list} to the dispatcher @var{disp}."
- " Whenever @var{disp} hears an event of class @var{cl},"
- " it is forwarded to @var{list}.")
+ 2, 0, 1, (SCM list, SCM disp, SCM cl),
+ "Add the listener @var{list} to the dispatcher @var{disp}."
+ " Whenever @var{disp} hears an event of class @var{cl},"
+ " it is forwarded to @var{list}.")
{
Listener *l = unsmob_listener (list);
Dispatcher *d = unsmob_dispatcher (disp);
- LY_ASSERT_SMOB (Listener, list, 1);
- LY_ASSERT_SMOB (Dispatcher, disp, 2);
-
+ LY_ASSERT_SMOB (Listener, list, 1);
+ LY_ASSERT_SMOB (Dispatcher, disp, 2);
+
for (int arg = SCM_ARG3; scm_is_pair (cl); cl = scm_cdr (cl), arg++)
{
SCM sym = scm_car (cl);
}
LY_DEFINE (ly_broadcast, "ly:broadcast",
- 2, 0, 0, (SCM disp, SCM ev),
- "Send the stream event @var{ev} to the dispatcher @var{disp}.")
+ 2, 0, 0, (SCM disp, SCM ev),
+ "Send the stream event @var{ev} to the dispatcher @var{disp}.")
{
Dispatcher *d = unsmob_dispatcher (disp);
Stream_event *e = unsmob_stream_event (ev);
-
+
LY_ASSERT_SMOB (Dispatcher, disp, 1);
- LY_ASSERT_SMOB (Stream_event, ev, 2);
+ LY_ASSERT_SMOB (Stream_event, ev, 2);
d->broadcast (e);
return SCM_UNDEFINED;
}
}
int
-Dispatcher::print_smob (SCM s, SCM p, scm_print_state*)
+Dispatcher::print_smob (SCM s, SCM p, scm_print_state *)
{
Dispatcher *me = (Dispatcher *) SCM_CELL_WORD_1 (s);
scm_puts ("#<Dispatcher ", p);
The first step is to collect all listener lists and to initially
insert them in the priority queue.
*/
- struct { int prio; SCM list; } lists[num_classes+1];
+ struct { int prio; SCM list; } lists[num_classes + 1];
int i = 0;
for (SCM cl = class_list; scm_is_pair (cl); cl = scm_cdr (cl))
{
SCM list = scm_hashq_ref (listeners_, scm_car (cl), SCM_EOL);
if (!scm_is_pair (list))
- num_classes--;
+ num_classes--;
else
- {
+ {
// bubblesort.
int prio = scm_to_int (scm_caar (list));
- int j;
- for (j = i; j > 0 && lists[j-1].prio > prio; j--)
- lists[j] = lists[j-1];
- lists[j].prio = prio;
- lists[j].list = list;
- i++;
+ int j;
+ for (j = i; j > 0 && lists[j - 1].prio > prio; j--)
+ lists[j] = lists[j - 1];
+ lists[j].prio = prio;
+ lists[j].list = list;
+ i++;
}
}
lists[num_classes].prio = INT_MAX;
if (!scm_is_pair (next))
num_classes--;
int prio = (scm_is_pair (next)) ? scm_to_int (scm_caar (next)) : INT_MAX;
- for (i = 0; prio > lists[i+1].prio; i++)
- lists[i] = lists[i+1];
+ for (i = 0; prio > lists[i + 1].prio; i++)
+ lists[i] = lists[i + 1];
lists[i].prio = prio;
lists[i].list = next;
}
-/* TODO: Uncomment.
- if (!sent)
- warning (_f ("Junking event: %s", ly_symbol2string (class_symbol).c_str ()));
-*/
+ /* TODO: Uncomment.
+ if (!sent)
+ warning (_f ("Junking event: %s", ly_symbol2string (class_symbol).c_str ()));
+ */
}
void
/* Tell all dispatchers that we listen to, that we want to hear ev_class
events */
for (SCM disp = dispatchers_; scm_is_pair (disp); disp = scm_cdr (disp))
- {
- int priority = scm_to_int (scm_cdar (disp));
- Dispatcher *d = unsmob_dispatcher (scm_caar (disp));
- d->internal_add_listener (GET_LISTENER (dispatch), ev_class, priority);
- }
+ {
+ int priority = scm_to_int (scm_cdar (disp));
+ Dispatcher *d = unsmob_dispatcher (scm_caar (disp));
+ d->internal_add_listener (GET_LISTENER (dispatch), ev_class, priority);
+ }
listen_classes_ = scm_cons (ev_class, listen_classes_);
}
SCM entry = scm_cons (scm_from_int (priority), l.smobbed_copy ());
while (scm_is_pair (scm_cdr (e)))
if (*unsmob_listener (scm_cdadr (e)) == l && first)
{
- scm_set_cdr_x (e, scm_cddr (e));
- first = false;
- break;
+ scm_set_cdr_x (e, scm_cddr (e));
+ first = false;
+ break;
}
else
e = scm_cdr (e);
{
/* Unregister with all dispatchers. */
for (SCM disp = dispatchers_; scm_is_pair (disp); disp = scm_cdr (disp))
- {
- Dispatcher *d = unsmob_dispatcher (scm_caar (disp));
- d->remove_listener (GET_LISTENER (dispatch), ev_class);
- }
+ {
+ Dispatcher *d = unsmob_dispatcher (scm_caar (disp));
+ d->remove_listener (GET_LISTENER (dispatch), ev_class);
+ }
listen_classes_ = scm_delq_x (ev_class, listen_classes_);
}
}
if (d)
{
if (!dotcol_)
- dotcol_ = make_item ("DotColumn", SCM_EOL);
+ dotcol_ = make_item ("DotColumn", SCM_EOL);
Dot_column::add_head (dotcol_, info.grob ());
}
}
-
ADD_ACKNOWLEDGER (Dot_column_engraver, rhythmic_head);
ADD_TRANSLATOR (Dot_column_engraver,
- /* doc */
- "Engrave dots on dotted notes shifted to the right of the"
- " note. If omitted, then dots appear on top of the notes.",
+ /* doc */
+ "Engrave dots on dotted notes shifted to the right of the"
+ " note. If omitted, then dots appear on top of the notes.",
- /* create */
- "DotColumn ",
+ /* create */
+ "DotColumn ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
SCM
Dot_column::calc_positioning_done (SCM smob)
{
- Grob *me = unsmob_grob (smob);
+ Grob *me = unsmob_grob (smob);
/*
Trigger note collision resolution first, since that may kill off
me->set_property ("positioning-done", SCM_BOOL_T);
- vector<Grob*> dots
+ vector<Grob *> dots
= extract_grob_array (me, "dots");
- vector<Grob*> main_heads;
+ vector<Grob *> main_heads;
Real ss = 0;
Grob *commonx = me;
{
Grob *n = dots[i]->get_parent (Y_AXIS);
commonx = n->common_refpoint (commonx, X_AXIS);
-
- if (Grob *stem = unsmob_grob (n->get_object("stem")))
- {
- commonx = stem->common_refpoint (commonx, X_AXIS);
-
- if (Stem::first_head (stem) == n)
- main_heads.push_back (n);
- }
+
+ if (Grob *stem = unsmob_grob (n->get_object ("stem")))
+ {
+ commonx = stem->common_refpoint (commonx, X_AXIS);
+
+ if (Stem::first_head (stem) == n)
+ main_heads.push_back (n);
+ }
}
vector<Box> boxes;
- set<Grob*> stems;
+ set<Grob *> stems;
- extract_grob_set(me, "side-support-elements", support);
+ extract_grob_set (me, "side-support-elements", support);
Interval base_x;
for (vsize i = 0; i < main_heads.size (); i++)
base_x.unite (main_heads[i]->extent (commonx, X_AXIS));
-
+
for (vsize i = 0; i < support.size (); i++)
{
Grob *s = support[i];
if (!ss)
- ss = Staff_symbol_referencer::staff_space (s);
+ ss = Staff_symbol_referencer::staff_space (s);
/* can't inspect Y extent of rest.
-
- Rest collisions should wait after line breaking.
+
+ Rest collisions should wait after line breaking.
*/
Interval y;
if (Rest::has_interface (s))
- {
- base_x.unite (s->extent (commonx, X_AXIS));
- continue;
- }
+ {
+ base_x.unite (s->extent (commonx, X_AXIS));
+ continue;
+ }
else if (Stem::has_interface (s))
- {
- Real y1 = Stem::head_positions (s)[-get_grob_direction (s)];
- Real y2 = y1 + get_grob_direction (s) * 7;
+ {
+ Real y1 = Stem::head_positions (s)[-get_grob_direction (s)];
+ Real y2 = y1 + get_grob_direction (s) * 7;
- y.add_point (y1);
- y.add_point (y2);
- }
+ y.add_point (y1);
+ y.add_point (y2);
+ }
else if (Note_head::has_interface (s))
- y = Interval (-1, 1);
+ y = Interval (-1, 1);
else
- {
- programming_error ("unknown grob in dot col support");
- continue;
- }
+ {
+ programming_error ("unknown grob in dot col support");
+ continue;
+ }
y *= 2 / ss;
y += Staff_symbol_referencer::get_position (s);
boxes.push_back (b);
if (Grob *stem = unsmob_grob (s->get_object ("stem")))
- stems.insert (stem);
+ stems.insert (stem);
}
- for (set<Grob*>::const_iterator i (stems.begin());
+ for (set<Grob *>::const_iterator i (stems.begin ());
i != stems.end (); i++)
{
Grob *stem = (*i);
Stencil flag = Stem::flag (stem);
if (!flag.is_empty ())
- {
- Interval y = flag.extent (Y_AXIS)
- * (2 / ss)
- + Stem::stem_end_position (stem);
+ {
+ Interval y = flag.extent (Y_AXIS)
+ * (2 / ss)
+ + Stem::stem_end_position (stem);
- Interval x = stem->relative_coordinate (commonx, X_AXIS)
- + flag.extent (X_AXIS);
+ Interval x = stem->relative_coordinate (commonx, X_AXIS)
+ + flag.extent (X_AXIS);
- boxes.push_back (Box (x,y));
- }
+ boxes.push_back (Box (x, y));
+ }
}
-
+
vector_sort (dots, position_less);
for (vsize i = dots.size (); i--;)
{
if (!dots[i]->is_live ())
- dots.erase (dots.begin () + i);
+ dots.erase (dots.begin () + i);
else
- // Undo any fake translations that were done in add_head.
- dots[i]->translate_axis (-dots[i]->relative_coordinate (me, X_AXIS), X_AXIS);
+ // Undo any fake translations that were done in add_head.
+ dots[i]->translate_axis (-dots[i]->relative_coordinate (me, X_AXIS), X_AXIS);
}
Dot_formatting_problem problem (boxes, base_x);
Grob *note = dots[i]->get_parent (Y_AXIS);
if (note)
- {
- Grob *stem = unsmob_grob (note->get_object ("stem"));
- if (stem)
- dp.extremal_head_ = Stem::first_head (stem) == note;
-
- dp.x_extent_ = note->extent (commonx, X_AXIS);
- }
+ {
+ Grob *stem = unsmob_grob (note->get_object ("stem"));
+ if (stem)
+ dp.extremal_head_ = Stem::first_head (stem) == note;
+
+ dp.x_extent_ = note->extent (commonx, X_AXIS);
+ }
int p = Staff_symbol_referencer::get_rounded_position (dp.dot_);
/* icky, since this should go via a Staff_symbol_referencer
- offset callback but adding a dot overwrites Y-offset. */
+ offset callback but adding a dot overwrites Y-offset. */
p += (int) robust_scm2double (dp.dot_->get_property ("staff-position"), 0.0);
dp.pos_ = p;
if (dp.extremal_head_)
- dp.dir_ = to_dir (dp.dot_->get_property ("direction"));
+ dp.dir_ = to_dir (dp.dot_->get_property ("direction"));
cfg.remove_collision (p);
cfg[p] = dp;
if (Staff_symbol_referencer::on_line (dp.dot_, p))
- cfg.remove_collision (p);
+ cfg.remove_collision (p);
}
problem.register_configuration (cfg);
i != cfg.end (); i++)
{
/*
- Junkme?
+ Junkme?
*/
Staff_symbol_referencer::set_position (i->second.dot_, i->first);
}
-
+
me->translate_axis (cfg.x_offset () - me->relative_coordinate (commonx, X_AXIS),
- X_AXIS);
+ X_AXIS);
return SCM_BOOL_T;
}
// The translation here is undone in calc_positioning_done, where we
// do the X-offset properly.
if (Rest::has_interface (head))
- d->translate_axis (head->extent (head, X_AXIS).length (), X_AXIS);
+ d->translate_axis (head->extent (head, X_AXIS).length (), X_AXIS);
else
- d->set_property ("X-offset", Grob::x_parent_positioning_proc);
+ d->set_property ("X-offset", Grob::x_parent_positioning_proc);
Axis_group_interface::add_element (me, d);
}
}
ADD_INTERFACE (Dot_column,
- "Group dot objects so they form a column, and position"
- " dots so they do not clash with staff lines.",
-
- /* properties */
- "dots "
- "positioning-done "
- "direction "
- );
+ "Group dot objects so they form a column, and position"
+ " dots so they do not clash with staff lines.",
+
+ /* properties */
+ "dots "
+ "positioning-done "
+ "direction "
+ );
#include "dot-formatting-problem.hh"
#include "staff-symbol-referencer.hh"
-
int
Dot_configuration::badness () const
{
int dot_move_dir = sign (p - i->second.pos_);
if (i->second.extremal_head_)
- {
- if (i->second.dir_
- && dot_move_dir != i->second.dir_)
- demerit += 3;
- else if (dot_move_dir != UP)
- demerit += 2;
- }
+ {
+ if (i->second.dir_
+ && dot_move_dir != i->second.dir_)
+ demerit += 3;
+ else if (dot_move_dir != UP)
+ demerit += 2;
+ }
else if (dot_move_dir != UP)
- demerit += 1;
+ demerit += 1;
t += demerit;
}
if (d > 0)
{
for (Dot_configuration::const_iterator i (begin ());
- i != end (); i++)
- {
- int p = i->first;
- if (p == k)
- {
- if (Staff_symbol_referencer::on_line (i->second.dot_, p))
- p += d;
- else
- p += 2* d;
-
- offset = 2*d;
-
- new_cfg[p] = i->second;
- }
- else
- {
- if (new_cfg.find (p) == new_cfg.end ())
- offset = 0;
- new_cfg[p + offset] = i->second;
- }
- }
+ i != end (); i++)
+ {
+ int p = i->first;
+ if (p == k)
+ {
+ if (Staff_symbol_referencer::on_line (i->second.dot_, p))
+ p += d;
+ else
+ p += 2 * d;
+
+ offset = 2 * d;
+
+ new_cfg[p] = i->second;
+ }
+ else
+ {
+ if (new_cfg.find (p) == new_cfg.end ())
+ offset = 0;
+ new_cfg[p + offset] = i->second;
+ }
+ }
}
else
{
Dot_configuration::const_iterator i (end ());
do
- {
- i--;
-
- int p = i->first;
- if (p == k)
- {
- if (Staff_symbol_referencer::on_line (i->second.dot_, p))
- p += d;
- else
- p += 2* d;
-
- offset = 2*d;
-
- new_cfg[p] = i->second;
- }
- else
- {
- if (new_cfg.find (p) == new_cfg.end ())
- offset = 0;
-
- new_cfg[p + offset] = i->second;
- }
- }
+ {
+ i--;
+
+ int p = i->first;
+ if (p == k)
+ {
+ if (Staff_symbol_referencer::on_line (i->second.dot_, p))
+ p += d;
+ else
+ p += 2 * d;
+
+ offset = 2 * d;
+
+ new_cfg[p] = i->second;
+ }
+ else
+ {
+ if (new_cfg.find (p) == new_cfg.end ())
+ offset = 0;
+
+ new_cfg[p + offset] = i->second;
+ }
+ }
while (i != begin ());
}
#include "dot-configuration.hh"
#include "skyline.hh"
-Dot_formatting_problem::~Dot_formatting_problem()
+Dot_formatting_problem::~Dot_formatting_problem ()
{
delete best_;
}
}
Dot_formatting_problem::Dot_formatting_problem (vector<Box> const &boxes,
- Interval base_x)
+ Interval base_x)
: head_skyline_ (boxes, 0.0, Y_AXIS, RIGHT)
{
best_ = 0;
#include "translator.icc"
-
-class Dots_engraver : public Engraver
+class Dots_engraver : public Engraver
{
DECLARE_ACKNOWLEDGER (rhythmic_head);
TRANSLATOR_DECLARATIONS (Dots_engraver);
Grob *note = gi.grob ();
if (unsmob_grob (note->get_object ("dot")))
return;
-
+
Duration *dur = unsmob_duration (cause->get_property ("duration"));
if (dur && dur->dot_count ())
{
}
}
-
ADD_ACKNOWLEDGER (Dots_engraver, rhythmic_head);
ADD_TRANSLATOR (Dots_engraver,
- "Create @ref{Dots} objects for"
- " @ref{rhythmic-head-interface}s.",
-
- /* create */
- "Dots ",
-
- /* read */
- "",
-
- /* write */
- ""
- );
+ "Create @ref{Dots} objects for"
+ " @ref{rhythmic-head-interface}s.",
+
+ /* create */
+ "Dots ",
+
+ /* read */
+ "",
+
+ /* write */
+ ""
+ );
if (scm_is_number (c))
{
SCM scm_style = sc->get_property ("style");
- string style ="";
+ string style = "";
if (scm_is_symbol (scm_style))
- style = ly_symbol2string (scm_style);
- string idx = "dots.dot" + style;
+ style = ly_symbol2string (scm_style);
+ string idx = "dots.dot" + style;
Stencil d = Font_interface::get_default_font (sc)->find_by_name (idx);
if (d.is_empty ())
- {
- sc->warning (_f ("dot `%s' not found", idx.c_str ()));
- return SCM_EOL;
- }
+ {
+ sc->warning (_f ("dot `%s' not found", idx.c_str ()));
+ return SCM_EOL;
+ }
Real dw = d.extent (X_AXIS).length ();
/*
- we need to add a real blank box, to assure that
- side-positioning doth not cancel the left-most padding. */
+ we need to add a real blank box, to assure that
+ side-positioning doth not cancel the left-most padding. */
/*
- TODO: this should be handled by side-position padding.
+ TODO: this should be handled by side-position padding.
*/
mol = Lookup::blank (Box (Interval (0, 0),
- Interval (0, 0)));
+ Interval (0, 0)));
for (int i = scm_to_int (c); i--;)
- {
- d.translate_axis (2 * dw, X_AXIS);
- mol.add_at_edge (X_AXIS, RIGHT, d, dw);
- }
+ {
+ d.translate_axis (2 * dw, X_AXIS);
+ mol.add_at_edge (X_AXIS, RIGHT, d, dw);
+ }
}
return mol.smobbed_copy ();
}
ADD_INTERFACE (Dots,
- "The dots to go with a notehead or rest. @code{direction}"
- " sets the preferred direction to move in case of staff line"
- " collisions. @code{style} defaults to undefined, which is"
- " normal 19th/20th century traditional style. Set"
- " @code{style} to @code{vaticana} for ancient type dots.",
+ "The dots to go with a notehead or rest. @code{direction}"
+ " sets the preferred direction to move in case of staff line"
+ " collisions. @code{style} defaults to undefined, which is"
+ " normal 19th/20th century traditional style. Set"
+ " @code{style} to @code{vaticana} for ancient type dots.",
- /* properties */
- "direction "
- "dot-count "
- "style "
- );
+ /* properties */
+ "direction "
+ "dot-count "
+ "style "
+ );
if (!percent_event_)
{
Moment meas_len (robust_scm2moment (get_property ("measureLength"),
- Moment (1)));
+ Moment (1)));
start_mom_ = now_mom () + meas_len;
get_global_context ()->add_moment_to_process (start_mom_);
percent_event_ = ev;
if (percent_event_ && now_mom ().main_part_ == start_mom_.main_part_)
{
Item *double_percent = make_item ("DoublePercentRepeat",
- percent_event_->self_scm ());
+ percent_event_->self_scm ());
SCM count = percent_event_->get_property ("repeat-count");
if (count != SCM_EOL && to_boolean (get_property ("countPercentRepeats"))
- && check_repeat_count_visibility (context (), count))
- {
- Item *double_percent_counter
- = make_item ("DoublePercentRepeatCounter",
- percent_event_->self_scm ());
-
- SCM text = scm_number_to_string (count, scm_from_int (10));
- double_percent_counter->set_property ("text", text);
-
- Side_position_interface::add_support (double_percent_counter,
- double_percent);
- double_percent_counter->set_parent (double_percent, Y_AXIS);
- double_percent_counter->set_parent (double_percent, X_AXIS);
- }
+ && check_repeat_count_visibility (context (), count))
+ {
+ Item *double_percent_counter
+ = make_item ("DoublePercentRepeatCounter",
+ percent_event_->self_scm ());
+
+ SCM text = scm_number_to_string (count, scm_from_int (10));
+ double_percent_counter->set_property ("text", text);
+
+ Side_position_interface::add_support (double_percent_counter,
+ double_percent);
+ double_percent_counter->set_parent (double_percent, Y_AXIS);
+ double_percent_counter->set_parent (double_percent, X_AXIS);
+ }
// forbid breaks on a % line
context ()->get_score_context ()->set_property ("forbidBreak",
- SCM_BOOL_T);
+ SCM_BOOL_T);
percent_event_ = 0;
}
}
ADD_TRANSLATOR (Double_percent_repeat_engraver,
- /* doc */
- "Make double measure repeats.",
+ /* doc */
+ "Make double measure repeats.",
- /* create */
- "DoublePercentRepeat "
- "DoublePercentRepeatCounter ",
+ /* create */
+ "DoublePercentRepeat "
+ "DoublePercentRepeatCounter ",
- /* read */
- "countPercentRepeats "
- "measureLength "
- "repeatCountVisibility ",
+ /* read */
+ "countPercentRepeats "
+ "measureLength "
+ "repeatCountVisibility ",
- /* write */
- "forbidBreak "
- );
+ /* write */
+ "forbidBreak "
+ );
for (vsize i = 0; i < events_.size (); i++)
{
if (!tab)
- tab = get_property ("drumStyleTable");
+ tab = get_property ("drumStyleTable");
Stream_event *ev = events_[i];
Item *note = make_item ("NoteHead", ev->self_scm ());
SCM defn = SCM_EOL;
if (scm_hash_table_p (tab) == SCM_BOOL_T)
- defn = scm_hashq_ref (tab, drum_type, SCM_EOL);
+ defn = scm_hashq_ref (tab, drum_type, SCM_EOL);
if (scm_is_pair (defn))
- {
- SCM pos = scm_caddr (defn);
- SCM style = scm_car (defn);
- SCM script = scm_cadr (defn);
-
- if (scm_integer_p (pos) == SCM_BOOL_T)
- note->set_property ("staff-position", pos);
- if (scm_is_symbol (style))
- note->set_property ("style", style);
-
- if (scm_is_string (script))
- {
- Item *p = make_item ("Script", ev->self_scm ());
- make_script_from_event (p, context (), script,
- 0);
-
- p->set_parent (note, Y_AXIS);
- Side_position_interface::add_support (p, note);
- scripts_.push_back (p);
- }
- }
+ {
+ SCM pos = scm_caddr (defn);
+ SCM style = scm_car (defn);
+ SCM script = scm_cadr (defn);
+
+ if (scm_integer_p (pos) == SCM_BOOL_T)
+ note->set_property ("staff-position", pos);
+ if (scm_is_symbol (style))
+ note->set_property ("style", style);
+
+ if (scm_is_string (script))
+ {
+ Item *p = make_item ("Script", ev->self_scm ());
+ make_script_from_event (p, context (), script,
+ 0);
+
+ p->set_parent (note, Y_AXIS);
+ Side_position_interface::add_support (p, note);
+ scripts_.push_back (p);
+ }
+ }
}
}
Grob *e = scripts_[i];
if (to_dir (e->get_property ("side-relative-direction")))
- e->set_object ("direction-source", inf.grob ()->self_scm ());
+ e->set_object ("direction-source", inf.grob ()->self_scm ());
Side_position_interface::add_support (e, inf.grob ());
}
Grob *e = scripts_[i];
if (!e->get_parent (X_AXIS)
- && Side_position_interface::get_axis (e) == Y_AXIS)
- e->set_parent (inf.grob (), X_AXIS);
+ && Side_position_interface::get_axis (e) == Y_AXIS)
+ e->set_parent (inf.grob (), X_AXIS);
}
}
ADD_ACKNOWLEDGER (Drum_notes_engraver, note_column);
ADD_TRANSLATOR (Drum_notes_engraver,
- /* doc */
- "Generate drum note heads.",
+ /* doc */
+ "Generate drum note heads.",
- /* create */
- "NoteHead "
- "Script ",
+ /* create */
+ "NoteHead "
+ "Script ",
- /* read */
- "drumStyleTable ",
+ /* read */
+ "drumStyleTable ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
SCM defn = SCM_EOL;
if (scm_is_symbol (sym)
- && (scm_hash_table_p (tab) == SCM_BOOL_T))
- defn = scm_hashq_ref (tab, sym, SCM_EOL);
+ && (scm_hash_table_p (tab) == SCM_BOOL_T))
+ defn = scm_hashq_ref (tab, sym, SCM_EOL);
if (Pitch *pit = unsmob_pitch (defn))
- {
+ {
SCM articulations = n->get_property ("articulations");
Stream_event *tie_event = 0;
for (SCM s = articulations;
Stream_event *ev = unsmob_stream_event (scm_car (s));
if (!ev)
continue;
-
+
if (ev->in_event_class ("tie-event"))
tie_event = ev;
}
- Moment len = get_event_length (n, now_mom ());
+ Moment len = get_event_length (n, now_mom ());
- Audio_note *p = new Audio_note (*pit, len,
+ Audio_note *p = new Audio_note (*pit, len,
tie_event, Pitch (0, 0, 0));
- Audio_element_info info (p, n);
- announce_element (info);
- }
+ Audio_element_info info (p, n);
+ announce_element (info);
+ }
}
note_evs_.clear ();
}
ADD_TRANSLATOR (Drum_note_performer,
- /* doc */
- "Play drum notes.",
+ /* doc */
+ "Play drum notes.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
}
LY_DEFINE (ly_duration_less_p, "ly:duration<?",
- 2, 0, 0, (SCM p1, SCM p2),
- "Is @var{p1} shorter than @var{p2}?")
+ 2, 0, 0, (SCM p1, SCM p2),
+ "Is @var{p1} shorter than @var{p2}?")
{
LY_ASSERT_SMOB (Duration, p1, 1);
LY_ASSERT_SMOB (Duration, p2, 2);
}
LY_DEFINE (ly_make_duration, "ly:make-duration",
- 1, 3, 0, (SCM length, SCM dotcount, SCM num, SCM den),
- "@var{length} is the negative logarithm (base 2) of the duration:"
- " 1@tie{}is a half note, 2@tie{}is a quarter note, 3@tie{}is an"
- " eighth note, etc. The number of dots after the note is given by"
- " the optional argument @var{dotcount}.\n"
- "\n"
- "The duration factor is optionally given by @var{num} and"
- " @var{den}.\n"
- "\n"
- "A duration is a musical duration, i.e., a length of time"
- " described by a power of two (whole, half, quarter, etc.) and a"
- " number of augmentation dots.")
+ 1, 3, 0, (SCM length, SCM dotcount, SCM num, SCM den),
+ "@var{length} is the negative logarithm (base 2) of the duration:"
+ " 1@tie{}is a half note, 2@tie{}is a quarter note, 3@tie{}is an"
+ " eighth note, etc. The number of dots after the note is given by"
+ " the optional argument @var{dotcount}.\n"
+ "\n"
+ "The duration factor is optionally given by @var{num} and"
+ " @var{den}.\n"
+ "\n"
+ "A duration is a musical duration, i.e., a length of time"
+ " described by a power of two (whole, half, quarter, etc.) and a"
+ " number of augmentation dots.")
{
LY_ASSERT_TYPE (scm_is_integer, length, 1);
}
LY_DEFINE (ly_duration_log, "ly:duration-log",
- 1, 0, 0, (SCM dur),
- "Extract the duration log from @var{dur}.")
+ 1, 0, 0, (SCM dur),
+ "Extract the duration log from @var{dur}.")
{
LY_ASSERT_SMOB (Duration, dur, 1);
return scm_from_int (unsmob_duration (dur)->duration_log ());
}
LY_DEFINE (ly_duration_dot_count, "ly:duration-dot-count",
- 1, 0, 0, (SCM dur),
- "Extract the dot count from @var{dur}.")
+ 1, 0, 0, (SCM dur),
+ "Extract the dot count from @var{dur}.")
{
LY_ASSERT_SMOB (Duration, dur, 1);
return scm_from_int (unsmob_duration (dur)->dot_count ());
}
LY_DEFINE (ly_intlog2, "ly:intlog2",
- 1, 0, 0, (SCM d),
- "The 2-logarithm of 1/@var{d}.")
+ 1, 0, 0, (SCM d),
+ "The 2-logarithm of 1/@var{d}.")
{
LY_ASSERT_TYPE (scm_is_number, d, 1);
int log = intlog2 (scm_to_int (d));
}
LY_DEFINE (ly_duration_length, "ly:duration-length",
- 1, 0, 0, (SCM dur),
- "The length of the duration as a @code{moment}.")
+ 1, 0, 0, (SCM dur),
+ "The length of the duration as a @code{moment}.")
{
LY_ASSERT_SMOB (Duration, dur, 1);
return Moment (unsmob_duration (dur)->get_length ()).smobbed_copy ();
}
LY_DEFINE (ly_duration_2_string, "ly:duration->string",
- 1, 0, 0, (SCM dur),
- "Convert @var{dur} to a string.")
+ 1, 0, 0, (SCM dur),
+ "Convert @var{dur} to a string.")
{
LY_ASSERT_SMOB (Duration, dur, 1);
return ly_string2scm (unsmob_duration (dur)->to_string ());
}
LY_DEFINE (ly_duration_factor, "ly:duration-factor",
- 1, 0, 0, (SCM dur),
- "Extract the compression factor from @var{dur}."
- " Return it as a pair.")
+ 1, 0, 0, (SCM dur),
+ "Extract the compression factor from @var{dur}."
+ " Return it as a pair.")
{
LY_ASSERT_SMOB (Duration, dur, 1);
Rational r = unsmob_duration (dur)->factor ();
else
{
/* we want to find the integer k for which 2q/p > 2^k >= q/p.
- It's simple to check that k' = \floor \log q - \floor \log p
- satisfies the left inequality and is within a factor of 2 of
- satistying the right one. Therefore either k = k' or k = k'+1 */
+ It's simple to check that k' = \floor \log q - \floor \log p
+ satisfies the left inequality and is within a factor of 2 of
+ satistying the right one. Therefore either k = k' or k = k'+1 */
int p = (int) r.num ();
int q = (int) r.den ();
int k = intlog2 (q) - intlog2 (p);
- if (shift_left(p, k) < q)
- k++;
+ if (shift_left (p, k) < q)
+ k++;
- assert (shift_left(p, k) >= q && shift_left(p, (k-1)) < q);
+ assert (shift_left (p, k) >= q && shift_left (p, (k - 1)) < q);
/* If we were to write out log (p/q) in base 2, then the position of the
- first non-zero bit (ie. k in our notation) would be the durlog
- and the number of consecutive 1s after that bit would be the number of
- dots */
- p = shift_left(p, k) - q;
+ first non-zero bit (ie. k in our notation) would be the durlog
+ and the number of consecutive 1s after that bit would be the number of
+ dots */
+ p = shift_left (p, k) - q;
dots_ = 0;
while ((p *= 2) >= q)
- {
- p -= q;
- dots_++;
- }
+ {
+ p -= q;
+ dots_++;
+ }
/* we only go up to 64th notes */
if (k > 6)
- {
- durlog_ = 6;
- dots_ = 0;
- }
+ {
+ durlog_ = 6;
+ dots_ = 0;
+ }
else
- durlog_ = k;
+ durlog_ = k;
if (scale || k > 6)
- factor_ = r / get_length ();
+ factor_ = r / get_length ();
}
}
Duration *q = (Duration *) SCM_CELL_WORD_1 (b);
bool eq = p->dots_ == q->dots_
- && p->durlog_ == q->durlog_
- && p->factor_ == q->factor_;
+ && p->durlog_ == q->durlog_
+ && p->factor_ == q->factor_;
return eq ? SCM_BOOL_T : SCM_BOOL_F;
}
{
if (!line_)
line_ = make_spanner ("DynamicLineSpanner",
- event ? event->self_scm () : SCM_EOL);
+ event ? event->self_scm () : SCM_EOL);
}
void
ended_.push_back (info.spanner ());
/* If the break flag is set, store the current spanner and let new dynamics
- * create a new spanner
+ * create a new spanner
*/
- bool spanner_broken = current_dynamic_spanner_ == info.spanner () &&
- to_boolean (current_dynamic_spanner_->get_property ("spanner-broken"));
+ bool spanner_broken = current_dynamic_spanner_ == info.spanner ()
+ && to_boolean (current_dynamic_spanner_->get_property ("spanner-broken"));
if (spanner_broken && line_)
{
if (ended_line_)
if (cause)
{
if (Direction d = to_dir (cause->get_property ("direction")))
- set_grob_direction (line_, d);
+ set_grob_direction (line_, d);
}
}
Direction d = LEFT;
do
{
- if ((d == LEFT && !line->get_bound (LEFT)) ||
- (end && d == RIGHT && !line->get_bound (RIGHT)))
- {
- vector<Spanner *> const &spanners
- = (d == LEFT) ? started_ : ended_;
-
- Grob *bound = 0;
- if (scripts_.size ())
- bound = scripts_[0];
- else if (spanners.size ())
- bound = spanners[0]->get_bound (d);
- else
- {
- bound = unsmob_grob (get_property ("currentMusicalColumn"));
- programming_error ("started DynamicLineSpanner but have no left bound");
- }
-
- line->set_bound (d, bound);
- }
+ if ((d == LEFT && !line->get_bound (LEFT))
+ || (end && d == RIGHT && !line->get_bound (RIGHT)))
+ {
+ vector<Spanner *> const &spanners
+ = (d == LEFT) ? started_ : ended_;
+
+ Grob *bound = 0;
+ if (scripts_.size ())
+ bound = scripts_[0];
+ else if (spanners.size ())
+ bound = spanners[0]->get_bound (d);
+ else
+ {
+ bound = unsmob_grob (get_property ("currentMusicalColumn"));
+ programming_error ("started DynamicLineSpanner but have no left bound");
+ }
+
+ line->set_bound (d, bound);
+ }
}
while (flip (&d) != LEFT);
}
set<Spanner *>::iterator it = running_.find (sp);
if (it != running_.end ())
- running_.erase (it);
+ running_.erase (it);
else
- started_[i]->programming_error ("lost track of this dynamic spanner");
+ started_[i]->programming_error ("lost track of this dynamic spanner");
}
bool end = line_ && running_.empty ();
// is ended now
set_spanner_bounds (ended_line_, true);
set_spanner_bounds (line_, end);
- // If the flag is set to break the spanner after the current child, don't
+ // If the flag is set to break the spanner after the current child, don't
// add any more support points (needed e.g. for style=none, where the
// invisible spanner should NOT be shifted since we don't have a line).
- bool spanner_broken = current_dynamic_spanner_ &&
- to_boolean (current_dynamic_spanner_->get_property ("spanner-broken"));
+ bool spanner_broken = current_dynamic_spanner_
+ && to_boolean (current_dynamic_spanner_->get_property ("spanner-broken"));
for (vsize i = 0; line_ && !spanner_broken && i < support_.size (); i++)
Side_position_interface::add_support (line_, support_[i]);
}
ADD_TRANSLATOR (Dynamic_align_engraver,
- /* doc */
- "Align hairpins and dynamic texts on a horizontal line.",
+ /* doc */
+ "Align hairpins and dynamic texts on a horizontal line.",
- /* create */
- "DynamicLineSpanner ",
+ /* create */
+ "DynamicLineSpanner ",
- /* read */
- "currentMusicalColumn ",
+ /* read */
+ "currentMusicalColumn ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Drul_array<Stream_event *> accepted_spanevents_drul_;
- vector<Note_column*> pending_columns_;
- vector<Grob*> pending_elements_;
+ vector<Note_column *> pending_columns_;
+ vector<Grob *> pending_elements_;
void typeset_all ();
if (d == START)
ASSIGN_EVENT_ONCE (accepted_spanevents_drul_[START], ev);
-
+
/* Cancel any ongoing crescendo, either explicitly by \! or
implicitly by a new crescendo. Also avoid warning if cresc is
cancelled both implicitly and explicitly. */
if (accepted_spanevents_drul_[START] || accepted_spanevents_drul_[STOP] || script_ev_)
{
if (!line_spanner_)
- {
- Stream_event *rq = accepted_spanevents_drul_[START];
- line_spanner_ = make_spanner ("DynamicLineSpanner", rq ? rq->self_scm () : SCM_EOL);
- if (script_ev_)
- rq = script_ev_;
- }
+ {
+ Stream_event *rq = accepted_spanevents_drul_[START];
+ line_spanner_ = make_spanner ("DynamicLineSpanner", rq ? rq->self_scm () : SCM_EOL);
+ if (script_ev_)
+ rq = script_ev_;
+ }
}
/*
{
script_ = make_item ("DynamicText", script_ev_->self_scm ());
script_->set_property ("text",
- script_ev_->get_property ("text"));
+ script_ev_->get_property ("text"));
if (Direction d = to_dir (script_ev_->get_property ("direction")))
- set_grob_direction (line_spanner_, d);
+ set_grob_direction (line_spanner_, d);
else if (Direction d = to_dir (line_spanner_->get_property ("direction")))
- set_grob_direction (script_, d);
+ set_grob_direction (script_, d);
Axis_group_interface::add_element (line_spanner_, script_);
}
Stream_event *stop_ev = accepted_spanevents_drul_ [STOP]
- ? accepted_spanevents_drul_[STOP] : script_ev_;
+ ? accepted_spanevents_drul_[STOP] : script_ev_;
if (accepted_spanevents_drul_[STOP] || script_ev_)
{
/*
- finish side position alignment if the (de)cresc ends here, and
- there are no new dynamics.
+ finish side position alignment if the (de)cresc ends here, and
+ there are no new dynamics.
*/
if (cresc_)
- {
- assert (!finished_cresc_ && cresc_);
-
- if (script_)
- {
- cresc_->set_bound (RIGHT, script_);
- add_bound_item (line_spanner_, script_);
- }
-
- finished_cresc_ = cresc_;
- announce_end_grob (finished_cresc_, SCM_EOL);
- cresc_ = 0;
- current_cresc_ev_ = 0;
- }
+ {
+ assert (!finished_cresc_ && cresc_);
+
+ if (script_)
+ {
+ cresc_->set_bound (RIGHT, script_);
+ add_bound_item (line_spanner_, script_);
+ }
+
+ finished_cresc_ = cresc_;
+ announce_end_grob (finished_cresc_, SCM_EOL);
+ cresc_ = 0;
+ current_cresc_ev_ = 0;
+ }
else if (accepted_spanevents_drul_[STOP])
- {
- accepted_spanevents_drul_[STOP]->origin ()->warning (_ ("cannot find start of (de)crescendo"));
- stop_ev = 0;
- }
+ {
+ accepted_spanevents_drul_[STOP]->origin ()->warning (_ ("cannot find start of (de)crescendo"));
+ stop_ev = 0;
+ }
}
if (accepted_spanevents_drul_[START])
{
if (current_cresc_ev_)
- {
- string msg = _ ("already have a decrescendo");
- if (current_cresc_ev_->in_event_class ("crescendo-event"))
- msg = _ ("already have a crescendo");
-
- accepted_spanevents_drul_[START]->origin ()->warning (msg);
- current_cresc_ev_->origin ()->warning (_ ("cresc starts here"));
- }
+ {
+ string msg = _ ("already have a decrescendo");
+ if (current_cresc_ev_->in_event_class ("crescendo-event"))
+ msg = _ ("already have a crescendo");
+
+ accepted_spanevents_drul_[START]->origin ()->warning (msg);
+ current_cresc_ev_->origin ()->warning (_ ("cresc starts here"));
+ }
else
- {
- current_cresc_ev_ = accepted_spanevents_drul_[START];
-
- if (Direction d = to_dir (current_cresc_ev_->get_property ("direction")))
- set_grob_direction (line_spanner_, d);
-
- /*
- TODO: Use symbols.
- */
-
- SCM start_sym = current_cresc_ev_->get_property ("class");
- string start_type;
-
- if (start_sym == ly_symbol2scm ("decrescendo-event"))
- start_type = "decrescendo";
- else if (start_sym == ly_symbol2scm ("crescendo-event"))
- start_type = "crescendo";
- else
- {
- programming_error ("unknown dynamic spanner type");
- return;
- }
-
- /*
- UGH. TODO: should read from original event, so appearance
- may be altered with \tweak.
- */
- SCM s = get_property ((start_type + "Spanner").c_str ());
- if (!scm_is_symbol (s) || s == ly_symbol2scm ("hairpin"))
- {
- cresc_ = make_spanner ("Hairpin", accepted_spanevents_drul_[START]->self_scm ());
- if (finished_cresc_)
- {
- Pointer_group_interface::add_grob (finished_cresc_,
- ly_symbol2scm ("adjacent-hairpins"),
- cresc_);
-
- Pointer_group_interface::add_grob (cresc_,
- ly_symbol2scm ("adjacent-hairpins"),
- finished_cresc_);
- }
- }
-
- /*
- This is a convenient (and legacy) interface to TextSpanners
- for use in (de)crescendi.
- Hmm.
- */
- else
- {
- cresc_ = make_spanner ("DynamicTextSpanner", accepted_spanevents_drul_[START]->self_scm ());
- cresc_->set_property ("style", s);
- context ()->set_property ((start_type
- + "Spanner").c_str (), SCM_EOL);
- s = get_property ((start_type + "Text").c_str ());
- if (Text_interface::is_markup (s))
- {
- cresc_->set_property ("text", s);
- context ()->set_property ((start_type + "Text").c_str (),
- SCM_EOL);
- }
-
- if (script_)
- {
- set_nested_property (cresc_,
- scm_list_3 (ly_symbol2scm ("bound-details"),
- ly_symbol2scm ("left"),
- ly_symbol2scm ("attach-dir")
- ),
- scm_from_int (RIGHT));
- }
- }
-
- if (script_)
- {
- cresc_->set_bound (LEFT, script_);
- add_bound_item (line_spanner_, cresc_->get_bound (LEFT));
- }
- Axis_group_interface::add_element (line_spanner_, cresc_);
- }
+ {
+ current_cresc_ev_ = accepted_spanevents_drul_[START];
+
+ if (Direction d = to_dir (current_cresc_ev_->get_property ("direction")))
+ set_grob_direction (line_spanner_, d);
+
+ /*
+ TODO: Use symbols.
+ */
+
+ SCM start_sym = current_cresc_ev_->get_property ("class");
+ string start_type;
+
+ if (start_sym == ly_symbol2scm ("decrescendo-event"))
+ start_type = "decrescendo";
+ else if (start_sym == ly_symbol2scm ("crescendo-event"))
+ start_type = "crescendo";
+ else
+ {
+ programming_error ("unknown dynamic spanner type");
+ return;
+ }
+
+ /*
+ UGH. TODO: should read from original event, so appearance
+ may be altered with \tweak.
+ */
+ SCM s = get_property ((start_type + "Spanner").c_str ());
+ if (!scm_is_symbol (s) || s == ly_symbol2scm ("hairpin"))
+ {
+ cresc_ = make_spanner ("Hairpin", accepted_spanevents_drul_[START]->self_scm ());
+ if (finished_cresc_)
+ {
+ Pointer_group_interface::add_grob (finished_cresc_,
+ ly_symbol2scm ("adjacent-hairpins"),
+ cresc_);
+
+ Pointer_group_interface::add_grob (cresc_,
+ ly_symbol2scm ("adjacent-hairpins"),
+ finished_cresc_);
+ }
+ }
+
+ /*
+ This is a convenient (and legacy) interface to TextSpanners
+ for use in (de)crescendi.
+ Hmm.
+ */
+ else
+ {
+ cresc_ = make_spanner ("DynamicTextSpanner", accepted_spanevents_drul_[START]->self_scm ());
+ cresc_->set_property ("style", s);
+ context ()->set_property ((start_type
+ + "Spanner").c_str (), SCM_EOL);
+ s = get_property ((start_type + "Text").c_str ());
+ if (Text_interface::is_markup (s))
+ {
+ cresc_->set_property ("text", s);
+ context ()->set_property ((start_type + "Text").c_str (),
+ SCM_EOL);
+ }
+
+ if (script_)
+ {
+ set_nested_property (cresc_,
+ scm_list_3 (ly_symbol2scm ("bound-details"),
+ ly_symbol2scm ("left"),
+ ly_symbol2scm ("attach-dir")
+ ),
+ scm_from_int (RIGHT));
+ }
+ }
+
+ if (script_)
+ {
+ cresc_->set_bound (LEFT, script_);
+ add_bound_item (line_spanner_, cresc_->get_bound (LEFT));
+ }
+ Axis_group_interface::add_element (line_spanner_, cresc_);
+ }
}
}
if (finished_cresc_)
{
if (!finished_cresc_->get_bound (RIGHT))
- {
-
- Grob *column_bound = unsmob_grob (get_property ("currentMusicalColumn"));
-
- finished_cresc_->set_bound (RIGHT, script_
- ? script_
- : column_bound);
-
- if (finished_line_spanner_)
- add_bound_item (finished_line_spanner_,
- finished_cresc_->get_bound (RIGHT));
- }
+ {
+
+ Grob *column_bound = unsmob_grob (get_property ("currentMusicalColumn"));
+
+ finished_cresc_->set_bound (RIGHT, script_
+ ? script_
+ : column_bound);
+
+ if (finished_line_spanner_)
+ add_bound_item (finished_line_spanner_,
+ finished_cresc_->get_bound (RIGHT));
+ }
finished_cresc_ = 0;
}
if (finished_line_spanner_)
{
/*
- We used to have
+ We used to have
- extend-spanner-over-elements (finished_line_spanner_);
+ extend-spanner-over-elements (finished_line_spanner_);
- but this is rather kludgy, since finished_line_spanner_
- typically has a staff-symbol field set , extending it over the
- entire staff.
+ but this is rather kludgy, since finished_line_spanner_
+ typically has a staff-symbol field set , extending it over the
+ entire staff.
*/
Grob *l = finished_line_spanner_->get_bound (LEFT);
Grob *r = finished_line_spanner_->get_bound (RIGHT);
if (!r && l)
- finished_line_spanner_->set_bound (RIGHT, l);
+ finished_line_spanner_->set_bound (RIGHT, l);
else if (!l && r)
- finished_line_spanner_->set_bound (LEFT, r);
+ finished_line_spanner_->set_bound (LEFT, r);
else if (!r && !l)
- {
- /*
- This is a isolated dynamic apparently, and does not even have
- any interesting support item.
- */
- Grob *cc = unsmob_grob (get_property ("currentMusicalColumn"));
- Item *ci = dynamic_cast<Item *> (cc);
- finished_line_spanner_->set_bound (RIGHT, ci);
- finished_line_spanner_->set_bound (LEFT, ci);
- }
+ {
+ /*
+ This is a isolated dynamic apparently, and does not even have
+ any interesting support item.
+ */
+ Grob *cc = unsmob_grob (get_property ("currentMusicalColumn"));
+ Item *ci = dynamic_cast<Item *> (cc);
+ finished_line_spanner_->set_bound (RIGHT, ci);
+ finished_line_spanner_->set_bound (LEFT, ci);
+ }
finished_line_spanner_ = 0;
}
}
{
extract_grob_set (info.grob (), "note-heads", heads);
if (heads.size ())
- {
- Grob *head = heads[0];
- script_->set_parent (head, X_AXIS);
- Self_alignment_interface::set_center_parent (script_, X_AXIS);
- }
+ {
+ Grob *head = heads[0];
+ script_->set_parent (head, X_AXIS);
+ Self_alignment_interface::set_center_parent (script_, X_AXIS);
+ }
}
if (cresc_)
{
if (!cresc_->get_bound (LEFT))
- {
- cresc_->set_bound (LEFT, info.grob ());
- add_bound_item (line_spanner_, cresc_->get_bound (LEFT));
- }
+ {
+ cresc_->set_bound (LEFT, info.grob ());
+ add_bound_item (line_spanner_, cresc_->get_bound (LEFT));
+ }
}
if (finished_cresc_ && !finished_cresc_->get_bound (RIGHT))
ADD_ACKNOWLEDGER (Dynamic_engraver, note_column);
ADD_TRANSLATOR (Dynamic_engraver,
- /* doc */
- "Create hairpins, dynamic texts, and their vertical"
- " alignments. The symbols are collected onto a"
- " @code{DynamicLineSpanner} grob which takes care of vertical"
- " positioning.",
-
- /* create */
- "DynamicLineSpanner "
- "DynamicTextSpanner "
- "DynamicText "
- "Hairpin ",
-
- /* read */
- "",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create hairpins, dynamic texts, and their vertical"
+ " alignments. The symbols are collected onto a"
+ " @code{DynamicLineSpanner} grob which takes care of vertical"
+ " positioning.",
+
+ /* create */
+ "DynamicLineSpanner "
+ "DynamicTextSpanner "
+ "DynamicText "
+ "Hairpin ",
+
+ /* read */
+ "",
+
+ /* write */
+ ""
+ );
DECLARE_TRANSLATOR_LISTENER (absolute_dynamic);
private:
Stream_event *script_event_;
- Drul_array<Stream_event*> span_events_;
- Drul_array<Direction> grow_dir_;
+ Drul_array<Stream_event *> span_events_;
+ Drul_array<Direction> grow_dir_;
Real last_volume_;
Audio_dynamic *absolute_;
Audio_span_dynamic *span_dynamic_;
last_volume_ = 0.5;
script_event_ = 0;
absolute_ = 0;
- span_events_[LEFT] =
- span_events_[RIGHT] = 0;
+ span_events_[LEFT]
+ = span_events_[RIGHT] = 0;
span_dynamic_ = 0;
finished_span_dynamic_ = 0;
}
{
Interval iv (0, 1);
if (scm_is_number (min))
- iv[MIN] = scm_to_double (min);
+ iv[MIN] = scm_to_double (min);
if (scm_is_number (max))
- iv[MAX] = scm_to_double (max);
+ iv[MAX] = scm_to_double (max);
volume = iv[MIN] + iv.length () * volume;
}
else
{
/*
- urg, code duplication:: staff_performer
+ urg, code duplication:: staff_performer
*/
SCM s = get_property ("midiInstrument");
if (!scm_is_string (s))
- s = get_property ("instrumentName");
+ s = get_property ("instrumentName");
if (!scm_is_string (s))
- s = scm_from_locale_string ("piano");
+ s = scm_from_locale_string ("piano");
SCM eq = get_property ("instrumentEqualizer");
if (ly_is_procedure (eq))
- s = scm_call_1 (eq, s);
+ s = scm_call_1 (eq, s);
if (is_number_pair (s))
- {
- Interval iv = ly_scm2interval (s);
- volume = iv[MIN] + iv.length () * volume;
- }
+ {
+ Interval iv = ly_scm2interval (s);
+ volume = iv[MIN] + iv.length () * volume;
+ }
}
return volume;
}
-
void
Dynamic_performer::process_music ()
{
absolute_ = new Audio_dynamic ();
if (script_event_)
- {
- SCM proc = get_property ("dynamicAbsoluteVolumeFunction");
-
- SCM svolume = SCM_EOL;
- if (ly_is_procedure (proc))
- {
- // urg
- svolume = scm_call_1 (proc, script_event_->get_property ("text"));
- }
-
- Real volume = robust_scm2double (svolume, 0.5);
-
- last_volume_
- = absolute_->volume_ = equalize_volume (volume);
- }
-
+ {
+ SCM proc = get_property ("dynamicAbsoluteVolumeFunction");
+
+ SCM svolume = SCM_EOL;
+ if (ly_is_procedure (proc))
+ {
+ // urg
+ svolume = scm_call_1 (proc, script_event_->get_property ("text"));
+ }
+
+ Real volume = robust_scm2double (svolume, 0.5);
+
+ last_volume_
+ = absolute_->volume_ = equalize_volume (volume);
+ }
+
Audio_element_info info (absolute_, script_event_);
announce_element (info);
}
finished_span_dynamic_->render ();
finished_span_dynamic_ = 0;
}
-
+
if (absolute_ && absolute_->volume_ < 0)
{
absolute_->volume_ = last_volume_;
{
last_volume_ = absolute_->volume_;
}
-
+
absolute_ = 0;
script_event_ = 0;
- span_events_[LEFT] =
- span_events_[RIGHT] = 0;
+ span_events_[LEFT]
+ = span_events_[RIGHT] = 0;
}
IMPLEMENT_TRANSLATOR_LISTENER (Dynamic_performer, decrescendo);
}
ADD_TRANSLATOR (Dynamic_performer,
- /* doc */
- "",
-
- /* create */
- "",
-
- /* read */
- "dynamicAbsoluteVolumeFunction "
- "instrumentEqualizer "
- "midiMaximumVolume "
- "midiMinimumVolume "
- "midiInstrument ",
-
- /* write */
- ""
- );
+ /* doc */
+ "",
+
+ /* create */
+ "",
+
+ /* read */
+ "dynamicAbsoluteVolumeFunction "
+ "instrumentEqualizer "
+ "midiMaximumVolume "
+ "midiMinimumVolume "
+ "midiInstrument ",
+
+ /* write */
+ ""
+ );
struct Enclosing_bracket
{
DECLARE_GROB_INTERFACE ();
-
+
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (width, (SCM));
};
-
ADD_INTERFACE (Enclosing_bracket,
- "Brackets alongside bass figures.",
-
- /* properties */
- "bracket-flare "
- "edge-height "
- "elements "
- "padding "
- "shorten-pair "
- "thickness "
- );
+ "Brackets alongside bass figures.",
-/* ugh: should make bracket interface. */
+ /* properties */
+ "bracket-flare "
+ "edge-height "
+ "elements "
+ "padding "
+ "shorten-pair "
+ "thickness "
+ );
+/* ugh: should make bracket interface. */
MAKE_SCHEME_CALLBACK (Enclosing_bracket, width, 1);
SCM
return SCM_EOL;
}
- Grob *common_x = common_refpoint_of_array (elements, me, X_AXIS);
+ Grob *common_x = common_refpoint_of_array (elements, me, X_AXIS);
Interval xext = Axis_group_interface::relative_group_extent (elements, common_x, X_AXIS);
Stencil left_br = Horizontal_bracket::make_bracket (me, 10.0, Y_AXIS, LEFT);
Stencil right_br = Horizontal_bracket::make_bracket (me, 10.0, Y_AXIS, LEFT);
-
xext.widen (robust_scm2double (me->get_property ("padding"), 0.25));
left_br.translate_axis (xext[LEFT], X_AXIS);
right_br.translate_axis (xext[RIGHT], X_AXIS);
return SCM_EOL;
}
- Grob *common_x = common_refpoint_of_array (elements, me, X_AXIS);
+ Grob *common_x = common_refpoint_of_array (elements, me, X_AXIS);
Interval xext = Axis_group_interface::relative_group_extent (elements, common_x, X_AXIS);
if (xext.is_empty ())
{
}
Stencil left_br = Horizontal_bracket::make_enclosing_bracket (me, me, elements,
- Y_AXIS, LEFT);
+ Y_AXIS, LEFT);
Stencil right_br = Horizontal_bracket::make_enclosing_bracket (me, me, elements,
- Y_AXIS, RIGHT);
+ Y_AXIS, RIGHT);
xext.widen (robust_scm2double (me->get_property ("padding"), 0.25));
left_br.translate_axis (xext[LEFT], X_AXIS);
right_br.translate_axis (xext[RIGHT], X_AXIS);
-
+
left_br.add_stencil (right_br);
left_br.translate_axis (-me->relative_coordinate (common_x, X_AXIS), X_AXIS);
Engraver_group::override (SCM sev)
{
Stream_event *ev = unsmob_stream_event (sev);
-
+
sloppy_general_pushpop_property (context (),
- ev->get_property ("symbol"),
- ev->get_property ("property-path"),
- ev->get_property ("value"));
+ ev->get_property ("symbol"),
+ ev->get_property ("property-path"),
+ ev->get_property ("value"));
}
IMPLEMENT_LISTENER (Engraver_group, revert);
Engraver_group::revert (SCM sev)
{
Stream_event *ev = unsmob_stream_event (sev);
-
+
sloppy_general_pushpop_property (context (),
- ev->get_property ("symbol"),
- ev->get_property ("property-path"),
- SCM_UNDEFINED);
+ ev->get_property ("symbol"),
+ ev->get_property ("property-path"),
+ SCM_UNDEFINED);
}
void
Engraver_group *dad_eng
= dad_con
- ? dynamic_cast<Engraver_group *> (dad_con->implementation ())
- : 0;
+ ? dynamic_cast<Engraver_group *> (dad_con->implementation ())
+ : 0;
if (dad_eng)
dad_eng->announce_grob (info);
for (vsize j = 0; j < announce_infos_.size (); j++)
{
Grob_info info = announce_infos_[j];
-
+
SCM meta = info.grob ()->internal_get_property (meta_sym);
SCM nm = scm_assoc (name_sym, meta);
if (scm_is_pair (nm))
- nm = scm_cdr (nm);
+ nm = scm_cdr (nm);
else
- continue;
+ continue;
SCM acklist = scm_hashq_ref (acknowledge_hash_table_drul_[info.start_end ()],
- nm, SCM_BOOL_F);
-
+ nm, SCM_BOOL_F);
+
Engraver_dispatch_list *dispatch
- = Engraver_dispatch_list::unsmob (acklist);
+ = Engraver_dispatch_list::unsmob (acklist);
if (acklist == SCM_BOOL_F)
- {
- SCM ifaces
- = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta));
- acklist = Engraver_dispatch_list::create (get_simple_trans_list (),
- ifaces, info.start_end ());
+ {
+ SCM ifaces
+ = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta));
+ acklist = Engraver_dispatch_list::create (get_simple_trans_list (),
+ ifaces, info.start_end ());
- dispatch
- = Engraver_dispatch_list::unsmob (acklist);
+ dispatch
+ = Engraver_dispatch_list::unsmob (acklist);
- scm_hashq_set_x (acknowledge_hash_table_drul_[info.start_end ()], nm, acklist);
- }
+ scm_hashq_set_x (acknowledge_hash_table_drul_[info.start_end ()], nm, acklist);
+ }
if (dispatch)
- dispatch->apply (info);
+ dispatch->apply (info);
}
}
{
Context *c = unsmob_context (scm_car (s));
Engraver_group *group
- = dynamic_cast<Engraver_group *> (c->implementation ());
+ = dynamic_cast<Engraver_group *> (c->implementation ());
if (group)
- count += group->pending_grob_count ();
+ count += group->pending_grob_count ();
}
return count;
}
do
{
/*
- DOCME: why is this inside the loop?
+ DOCME: why is this inside the loop?
*/
for (SCM s = context ()->children_contexts ();
- scm_is_pair (s); s = scm_cdr (s))
- {
- Context *c = unsmob_context (scm_car (s));
- Engraver_group *group
- = dynamic_cast<Engraver_group *> (c->implementation ());
- if (group)
- group->do_announces ();
- }
-
-
+ scm_is_pair (s); s = scm_cdr (s))
+ {
+ Context *c = unsmob_context (scm_car (s));
+ Engraver_group *group
+ = dynamic_cast<Engraver_group *> (c->implementation ());
+ if (group)
+ group->do_announces ();
+ }
+
while (1)
- {
- precomputed_translator_foreach (PROCESS_ACKNOWLEDGED);
- if (announce_infos_.size () == 0)
- break;
-
- acknowledge_grobs ();
- announce_infos_.clear ();
- }
+ {
+ precomputed_translator_foreach (PROCESS_ACKNOWLEDGED);
+ if (announce_infos_.size () == 0)
+ break;
+
+ acknowledge_grobs ();
+ announce_infos_.clear ();
+ }
}
while (pending_grob_count () > 0);
}
Engraver_group::Engraver_group ()
{
- acknowledge_hash_table_drul_[LEFT]
- = acknowledge_hash_table_drul_[RIGHT]
- = SCM_EOL;
-
+ acknowledge_hash_table_drul_[LEFT]
+ = acknowledge_hash_table_drul_[RIGHT]
+ = SCM_EOL;
+
acknowledge_hash_table_drul_[LEFT] = scm_c_make_hash_table (61);
acknowledge_hash_table_drul_[RIGHT] = scm_c_make_hash_table (61);
}
#include "translator.icc"
ADD_TRANSLATOR_GROUP (Engraver_group,
- /* doc */
- "A group of engravers taken together.",
+ /* doc */
+ "A group of engravers taken together.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
void
Engraver_group::derived_mark () const
#include "grob.hh"
LY_DEFINE (ly_engraver_make_grob, "ly:engraver-make-grob",
- 3, 0, 0, (SCM engraver, SCM grob_name, SCM cause),
- "Create a grob originating from given @var{engraver} instance,"
- " with given @var{grob-name}, a symbol."
- " @var{cause} should either be another grob"
- " or a music event.")
+ 3, 0, 0, (SCM engraver, SCM grob_name, SCM cause),
+ "Create a grob originating from given @var{engraver} instance,"
+ " with given @var{grob-name}, a symbol."
+ " @var{cause} should either be another grob"
+ " or a music event.")
{
LY_ASSERT_TYPE (unsmob_engraver, engraver, 1);
LY_ASSERT_TYPE (ly_is_symbol, grob_name, 2);
LY_ASSERT_TYPE (ly_is_grob_cause, cause, 3);
Grob *g = unsmob_engraver (engraver)->
- internal_make_grob(grob_name, cause,
- ly_symbol2string (grob_name).c_str (),
- "scheme", 0, "scheme");
+ internal_make_grob (grob_name, cause,
+ ly_symbol2string (grob_name).c_str (),
+ "scheme", 0, "scheme");
return g->self_scm ();
}
LY_DEFINE (ly_engraver_announce_end_grob, "ly:engraver-announce-end-grob",
- 3, 0, 0, (SCM engraver, SCM grob, SCM cause),
- "Announce the end of a grob (i.e., the end of a spanner)"
- " originating from given @var{engraver} instance, with"
- " @var{grob} being a grob. @var{cause} should either"
- " be another grob or a music event.")
+ 3, 0, 0, (SCM engraver, SCM grob, SCM cause),
+ "Announce the end of a grob (i.e., the end of a spanner)"
+ " originating from given @var{engraver} instance, with"
+ " @var{grob} being a grob. @var{cause} should either"
+ " be another grob or a music event.")
{
LY_ASSERT_TYPE (unsmob_engraver, engraver, 1);
LY_ASSERT_SMOB (Grob, grob, 2);
LY_ASSERT_TYPE (ly_is_grob_cause, cause, 3);
unsmob_engraver (engraver)->
- announce_end_grob (unsmob_grob (grob), cause);
+ announce_end_grob (unsmob_grob (grob), cause);
return SCM_UNSPECIFIED;
}
}
Grob_info
-Engraver::make_grob_info(Grob *e, SCM cause)
+Engraver::make_grob_info (Grob *e, SCM cause)
{
/* TODO: Remove Music code when it's no longer needed */
if (Music *m = unsmob_music (cause))
announce_grob (make_grob_info (e, cause));
}
-
/*
CAUSE is the object (typically a grob or stream-event object) that
was the reason for ending E. */
announce_end_grob (make_grob_info (e, cause));
}
-
Engraver::Engraver ()
{
}
#ifndef NDEBUG
static SCM creation_callback = SCM_EOL;
LY_DEFINE (ly_set_grob_creation_callback, "ly:set-grob-creation-callback",
- 1, 0, 0, (SCM cb),
- "Specify a procedure that will be called every time a new grob"
- " is created. The callback will receive as arguments the grob"
- " that was created, the name of the C++ source file that caused"
- " the grob to be created, and the corresponding line number in"
- " the C++ source file.")
+ 1, 0, 0, (SCM cb),
+ "Specify a procedure that will be called every time a new grob"
+ " is created. The callback will receive as arguments the grob"
+ " that was created, the name of the C++ source file that caused"
+ " the grob to be created, and the corresponding line number in"
+ " the C++ source file.")
{
LY_ASSERT_TYPE (ly_is_procedure, cb, 1);
Grob *
Engraver::internal_make_grob (SCM symbol,
- SCM cause,
- char const * /* name */,
- char const *file,
- int line,
- char const *fun)
+ SCM cause,
+ char const * /* name */,
+ char const *file,
+ int line,
+ char const *fun)
{
#ifdef NDEBUG
(void)file;
#ifndef NDEBUG
if (ly_is_procedure (creation_callback))
scm_apply_0 (creation_callback,
- scm_list_n (grob->self_scm (), scm_from_locale_string (file),
- scm_from_int (line), scm_from_locale_string (fun), SCM_UNDEFINED));
+ scm_list_n (grob->self_scm (), scm_from_locale_string (file),
+ scm_from_int (line), scm_from_locale_string (fun), SCM_UNDEFINED));
#endif
return grob;
Item *
Engraver::internal_make_item (SCM x, SCM cause,
- char const *name,
- char const *file, int line, char const *fun)
+ char const *name,
+ char const *file, int line, char const *fun)
{
Item *it = dynamic_cast<Item *> (internal_make_grob (x, cause, name, file, line, fun));
assert (it);
Paper_column *
Engraver::internal_make_column (SCM x, char const *name,
- char const *file, int line, char const *fun)
+ char const *file, int line, char const *fun)
{
return dynamic_cast<Paper_column *> (internal_make_grob (x, SCM_EOL, name, file, line, fun));
}
Spanner *
Engraver::internal_make_spanner (SCM x, SCM cause, char const *name,
- char const *file, int line, char const *fun)
+ char const *file, int line, char const *fun)
{
Spanner *sp = dynamic_cast<Spanner *> (internal_make_grob (x, cause, name, file, line, fun));
assert (sp);
return sp;
}
-Engraver*
+Engraver *
unsmob_engraver (SCM eng)
{
- return dynamic_cast<Engraver*> (unsmob_translator (eng));
+ return dynamic_cast<Engraver *> (unsmob_translator (eng));
}
bool
#include "translator.icc"
ADD_TRANSLATOR (Engraver,
- /* doc */
- "Base class for engravers. Does nothing, so it is not used.",
-
- /* create */
- "",
+ /* doc */
+ "Base class for engravers. Does nothing, so it is not used.",
- /* read */
- "",
+ /* create */
+ "",
- /* write */
- ""
- );
+ /* read */
+ "",
+ /* write */
+ ""
+ );
if (event_drul_[START])
{
if (current_event_)
- event_drul_[START]->origin ()->warning (_ ("already have an episema"));
+ event_drul_[START]->origin ()->warning (_ ("already have an episema"));
else
- {
- current_event_ = event_drul_[START];
- span_ = make_spanner ("Episema", event_drul_[START]->self_scm ());
+ {
+ current_event_ = event_drul_[START];
+ span_ = make_spanner ("Episema", event_drul_[START]->self_scm ());
- event_drul_[START] = 0;
- }
+ event_drul_[START] = 0;
+ }
}
if (event_drul_[STOP])
{
if (!span_)
- event_drul_[STOP]
- ->origin ()->warning (_ ("cannot find start of episema"));
+ event_drul_[STOP]
+ ->origin ()->warning (_ ("cannot find start of episema"));
else
- {
- finished_ = span_;
- announce_end_grob (finished_, SCM_EOL);
- span_ = 0;
- current_event_ = 0;
- note_columns_.clear ();
- }
+ {
+ finished_ = span_;
+ announce_end_grob (finished_, SCM_EOL);
+ span_ = 0;
+ current_event_ = 0;
+ note_columns_.clear ();
+ }
}
}
if (finished_)
{
if (!finished_->get_bound (RIGHT))
- {
- Grob *col = (note_columns_.size ()
- ? note_columns_.back ()
- : unsmob_grob (get_property ("currentMusicalColumn")));
- finished_->set_bound (RIGHT, col);
- }
+ {
+ Grob *col = (note_columns_.size ()
+ ? note_columns_.back ()
+ : unsmob_grob (get_property ("currentMusicalColumn")));
+ finished_->set_bound (RIGHT, col);
+ }
finished_ = 0;
}
}
if (span_ && !span_->get_bound (LEFT))
{
Grob *col = (note_columns_.size ()
- ? note_columns_.front ()
- : unsmob_grob (get_property ("currentMusicalColumn")));
+ ? note_columns_.front ()
+ : unsmob_grob (get_property ("currentMusicalColumn")));
span_->set_bound (LEFT, col);
}
ADD_ACKNOWLEDGER (Episema_engraver, note_head);
ADD_TRANSLATOR (Episema_engraver,
- /* doc */
- "Create an @emph{Editio Vaticana}-style episema line.",
+ /* doc */
+ "Create an @emph{Editio Vaticana}-style episema line.",
- /* create */
- "Episema ",
+ /* create */
+ "Episema ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
if (last_processed_mom_ < Moment (0))
{
for (SCM s = get_music ()->get_property ("elements");
- scm_is_pair (s); s = scm_cdr (s))
- {
- Music *mus = unsmob_music (scm_car (s));
- report_event (mus);
- }
+ scm_is_pair (s); s = scm_cdr (s))
+ {
+ Music *mus = unsmob_music (scm_car (s));
+ report_event (mus);
+ }
for (SCM s = get_music ()->get_property ("events");
- scm_is_pair (s); s = scm_cdr (s))
- {
- Stream_event *ev = unsmob_stream_event (scm_car (s));
- get_outlet ()->event_source ()->broadcast (ev);
- }
+ scm_is_pair (s); s = scm_cdr (s))
+ {
+ Stream_event *ev = unsmob_stream_event (scm_car (s));
+ get_outlet ()->event_source ()->broadcast (ev);
+ }
}
Simple_music_iterator::process (m);
}
ASSIGN_EVENT_ONCE (ev_, ev);
}
-
/*
A CompletizeExtenderEvent is sent at the end of each lyrics block
to ensure any pending extender can be correctly terminated if the lyrics
Grob *h = voice ? get_current_note_head (voice, to_boolean (get_property ("includeGraceNotes"))) : 0;
if (h)
- {
- if (extender_)
- {
- Pointer_group_interface::add_grob (extender_,
- ly_symbol2scm ("heads"), h);
- }
-
- if (pending_extender_)
- {
- Pointer_group_interface::add_grob (pending_extender_,
- ly_symbol2scm ("heads"), h);
- }
- }
+ {
+ if (extender_)
+ {
+ Pointer_group_interface::add_grob (extender_,
+ ly_symbol2scm ("heads"), h);
+ }
+
+ if (pending_extender_)
+ {
+ Pointer_group_interface::add_grob (pending_extender_,
+ ly_symbol2scm ("heads"), h);
+ }
+ }
else
- {
- if (pending_extender_
- && !get_property ("extendersOverRests"))
- {
- completize_extender (pending_extender_);
- pending_extender_ = 0;
- }
- }
+ {
+ if (pending_extender_
+ && !get_property ("extendersOverRests"))
+ {
+ completize_extender (pending_extender_);
+ pending_extender_ = 0;
+ }
+ }
if (extender_)
- {
- pending_extender_ = extender_;
- extender_ = 0;
- }
+ {
+ pending_extender_ = extender_;
+ extender_ = 0;
+ }
}
ev_ = 0;
{
extract_item_set (sp, "heads", heads);
if (heads.size ())
- sp->set_bound (RIGHT, heads.back ());
+ sp->set_bound (RIGHT, heads.back ());
}
}
completize_extender (extender_);
if (!extender_->get_bound (RIGHT))
- extender_->warning (_ ("unterminated extender"));
+ extender_->warning (_ ("unterminated extender"));
extender_ = 0;
}
completize_extender (pending_extender_);
if (!pending_extender_->get_bound (RIGHT))
- pending_extender_->warning (_ ("unterminated extender"));
+ pending_extender_->warning (_ ("unterminated extender"));
pending_extender_ = 0;
}
}
ADD_ACKNOWLEDGER (Extender_engraver, lyric_syllable);
ADD_TRANSLATOR (Extender_engraver,
- /* doc */
- "Create lyric extenders.",
+ /* doc */
+ "Create lyric extenders.",
- /* create */
- "LyricExtender ",
+ /* create */
+ "LyricExtender ",
- /* read */
- "extendersOverRests "
- "includeGraceNotes ",
+ /* read */
+ "extendersOverRests "
+ "includeGraceNotes ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "pointer-group-interface.hh"
#include "axis-group-interface.hh"
-
#include "horizontal-bracket.hh"
struct Figured_bass_continuation
{
DECLARE_GROB_INTERFACE ();
-
+
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (center_on_figures, (SCM));
SCM
Figured_bass_continuation::center_on_figures (SCM grob)
{
- Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (grob));
+ Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (grob));
extract_grob_set (me, "figures", figures);
if (figures.empty ())
return scm_from_double (0.0);
SCM
Figured_bass_continuation::print (SCM grob)
{
- Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (grob));
+ Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (grob));
+
+ Real thick
+ = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"))
+ * robust_scm2double (me->get_property ("thickness"), 1);
- Real thick =
- me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"))
- * robust_scm2double (me->get_property ("thickness"), 1);
-
Interval spanned;
Direction d = LEFT;
Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT),
- X_AXIS);
+ X_AXIS);
do
{
Item *bound = me->get_bound (d);
- Direction extdir =
- (d == LEFT && to_boolean (bound->get_property ("implicit")))
- ? LEFT : RIGHT;
+ Direction extdir
+ = (d == LEFT && to_boolean (bound->get_property ("implicit")))
+ ? LEFT : RIGHT;
- spanned[d]
- = robust_relative_extent (bound, common, X_AXIS)[extdir]
- - me->relative_coordinate (common, X_AXIS);
+ spanned[d]
+ = robust_relative_extent (bound, common, X_AXIS)[extdir]
+ - me->relative_coordinate (common, X_AXIS);
}
- while (flip (&d) != LEFT);
+ while (flip (&d) != LEFT);
spanned.widen (- robust_scm2double (me->get_property ("padding"), 0.2));
-
+
Stencil extender;
if (!spanned.is_empty ())
extender = Line_interface::make_line (thick,
- Offset (spanned[LEFT], 0),
- Offset (spanned[RIGHT], 0));
-
+ Offset (spanned[LEFT], 0),
+ Offset (spanned[RIGHT], 0));
+
return extender.smobbed_copy ();
}
ADD_INTERFACE (Figured_bass_continuation,
- "Simple extender line between bounds.",
-
- /* properties */
- "thickness "
- "padding "
- "figures "
- );
-
+ "Simple extender line between bounds.",
+
+ /* properties */
+ "thickness "
+ "padding "
+ "figures "
+ );
+
void add_brackets ();
void create_grobs ();
- void center_continuations (vector<Spanner*> const &consecutive_lines);
+ void center_continuations (vector<Spanner *> const &consecutive_lines);
void center_repeated_continuations ();
protected:
vector<Figure_group> groups_;
{
if (now_mom ().main_part_ < stop_moment_.main_part_
|| now_mom ().grace_part_ < Rational (0))
- return ;
+ return;
have_rest_ = 0;
new_events_.clear ();
if (groups_.empty ()
|| now_mom ().main_part_ < stop_moment_.main_part_
|| now_mom ().grace_part_ < Rational (0))
- return ;
+ return;
bool found = false;
for (vsize i = 0; !found && i < groups_.size (); i++)
- found = found || groups_[i].current_event_;
+ found = found || groups_[i].current_event_;
if (!found)
clear_spanners ();
Figured_bass_engraver::listen_bass_figure (Stream_event *ev)
{
new_event_found_ = true;
- Moment stop = now_mom () + get_event_length (ev, now_mom ());
+ Moment stop = now_mom () + get_event_length (ev, now_mom ());
stop_moment_ = max (stop_moment_, stop);
// Handle no-continuation here, don't even add it to the already existing
}
void
-Figured_bass_engraver::center_continuations (vector<Spanner*> const &consecutive_lines)
+Figured_bass_engraver::center_continuations (vector<Spanner *> const &consecutive_lines)
{
if (consecutive_lines.size () == 2)
{
- vector<Grob*> left_figs;
+ vector<Grob *> left_figs;
for (vsize j = consecutive_lines.size (); j--;)
left_figs.push_back (consecutive_lines[j]->get_bound (LEFT));
- SCM ga = Grob_array::make_array ();
+ SCM ga = Grob_array::make_array ();
unsmob_grob_array (ga)->set_array (left_figs);
for (vsize j = consecutive_lines.size (); j--;)
void
Figured_bass_engraver::center_repeated_continuations ()
{
- vector<Spanner*> consecutive_lines;
+ vector<Spanner *> consecutive_lines;
for (vsize i = 0; i <= groups_.size (); i++)
{
if (i < groups_.size ()
{
if (groups_[i].group_)
{
- announce_end_grob (groups_[i].group_ , SCM_EOL);
+ announce_end_grob (groups_[i].group_, SCM_EOL);
groups_[i].group_ = 0;
}
if (groups_[i].continuation_line_)
{
- announce_end_grob (groups_[i].continuation_line_ , SCM_EOL);
+ announce_end_grob (groups_[i].continuation_line_, SCM_EOL);
groups_[i].continuation_line_ = 0;
}
}
// If we have a rest, or we have no new or continued events, clear all spanners
bool ignore_rest = to_boolean (get_property ("ignoreFiguredBassRest"));
- if ((ignore_rest && have_rest_) ||
- (!continuation_ && new_events_.empty ()))
+ if ((ignore_rest && have_rest_)
+ || (!continuation_ && new_events_.empty ()))
{
clear_spanners ();
groups_.clear ();
{
if (!group.continuation_line_)
{
- Spanner * line
+ Spanner *line
= make_spanner ("BassFigureContinuation", SCM_EOL);
- Item * item = group.figure_item_;
+ Item *item = group.figure_item_;
group.continuation_line_ = line;
line->set_bound (LEFT, item);
/*
Ugh, repeated code.
*/
- vector<Spanner*> consecutive;
+ vector<Spanner *> consecutive;
if (to_boolean (get_property ("figuredBassCenterContinuations")))
{
for (vsize i = 0; i <= junk_continuations.size (); i++)
{
if (i < junk_continuations.size ()
- && (i == 0 || junk_continuations[i-1] == junk_continuations[i] - 1))
+ && (i == 0 || junk_continuations[i - 1] == junk_continuations[i] - 1))
consecutive.push_back (groups_[junk_continuations[i]].continuation_line_);
else
{
Figured_bass_engraver::create_grobs ()
{
Grob *muscol
- = dynamic_cast<Item*> (unsmob_grob (get_property ("currentMusicalColumn")));
+ = dynamic_cast<Item *> (unsmob_grob (get_property ("currentMusicalColumn")));
if (!alignment_)
{
alignment_ = make_spanner ("BassFigureAlignment", SCM_EOL);
void
Figured_bass_engraver::add_brackets ()
{
- vector<Grob*> encompass;
+ vector<Grob *> encompass;
bool inside = false;
- for (vsize i = 0; i < groups_.size (); i ++)
+ for (vsize i = 0; i < groups_.size (); i++)
{
if (!groups_[i].current_event_)
continue;
if (inside && groups_[i].figure_item_)
encompass.push_back (groups_[i].figure_item_);
- if (to_boolean (groups_[i].current_event_->get_property ("bracket-stop")))
+ if (to_boolean (groups_[i].current_event_->get_property ("bracket-stop")))
{
inside = false;
- Item * brack = make_item ("BassFigureBracket", groups_[i].current_event_->self_scm ());
+ Item *brack = make_item ("BassFigureBracket", groups_[i].current_event_->self_scm ());
for (vsize j = 0; j < encompass.size (); j++)
{
Pointer_group_interface::add_grob (brack,
/* write */
""
- );
+ );
Spanner *bass_figure_alignment_;
Spanner *positioner_;
- vector<Grob*> support_;
- vector<Grob*> span_support_;
+ vector<Grob *> support_;
+ vector<Grob *> span_support_;
protected:
DECLARE_ACKNOWLEDGER (note_column);
DECLARE_ACKNOWLEDGER (slur);
{
positioner_->set_bound (RIGHT, bass_figure_alignment_->get_bound (RIGHT));
}
-
+
positioner_ = 0;
bass_figure_alignment_ = 0;
}
void
-Figured_bass_position_engraver::finalize ()
+Figured_bass_position_engraver::finalize ()
{
stop_spanner ();
}
void
Figured_bass_position_engraver::acknowledge_end_slur (Grob_info info)
{
- vector<Grob*>::iterator i = find (span_support_.begin (), span_support_.end (),
- info.grob ());
+ vector<Grob *>::iterator i = find (span_support_.begin (), span_support_.end (),
+ info.grob ());
if (i < span_support_.end ())
span_support_.erase (i);
if (positioner_)
{
for (vsize i = 0; i < span_support_.size (); i++)
- Side_position_interface::add_support (positioner_, span_support_[i]);
+ Side_position_interface::add_support (positioner_, span_support_[i]);
for (vsize i = 0; i < support_.size (); i++)
- Side_position_interface::add_support (positioner_, support_[i]);
+ Side_position_interface::add_support (positioner_, support_[i]);
}
support_.clear ();
void
Figured_bass_position_engraver::acknowledge_bass_figure_alignment (Grob_info info)
{
- bass_figure_alignment_ = dynamic_cast<Spanner*> (info.grob ());
+ bass_figure_alignment_ = dynamic_cast<Spanner *> (info.grob ());
start_spanner ();
}
-
ADD_ACKNOWLEDGER (Figured_bass_position_engraver, note_column);
ADD_ACKNOWLEDGER (Figured_bass_position_engraver, slur);
ADD_END_ACKNOWLEDGER (Figured_bass_position_engraver, slur);
ADD_END_ACKNOWLEDGER (Figured_bass_position_engraver, bass_figure_alignment);
ADD_TRANSLATOR (Figured_bass_position_engraver,
- /* doc */
- "Position figured bass alignments over notes.",
-
- /* create */
- "BassFigureAlignmentPositioning ",
-
- /* read */
- "",
-
- /* write */
- ""
- );
+ /* doc */
+ "Position figured bass alignments over notes.",
+
+ /* create */
+ "BassFigureAlignmentPositioning ",
+
+ /* read */
+ "",
+
+ /* write */
+ ""
+ );
}
LY_DEFINE (ly_add_file_name_alist, "ly:add-file-name-alist",
- 1, 0, 0, (SCM alist),
- "Add mappings for error messages from @var{alist}.")
+ 1, 0, 0, (SCM alist),
+ "Add mappings for error messages from @var{alist}.")
{
for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s))
{
class Fingering_engraver : public Engraver
{
- vector<Stream_event*> events_;
- vector<Item*> fingerings_;
+ vector<Stream_event *> events_;
+ vector<Item *> fingerings_;
public:
TRANSLATOR_DECLARATIONS (Fingering_engraver);
{
/*
FIXME: should do something.
-
+
This function is mainly here to shut up a warning
*/
}
Grob *t = fingerings_[i];
Side_position_interface::add_support (t, inf.grob ());
if (!t->get_parent (X_AXIS))
- t->set_parent (inf.grob (), X_AXIS);
+ t->set_parent (inf.grob (), X_AXIS);
}
}
if (!is_direction (fingering->get_property_data ("direction")))
{
if (d)
- fingering->set_property ("direction", scm_from_int (d));
+ fingering->set_property ("direction", scm_from_int (d));
else
- fingering->set_property ("direction", scm_from_int (RIGHT));
+ fingering->set_property ("direction", scm_from_int (RIGHT));
}
fingerings_.push_back (fingering);
ADD_ACKNOWLEDGER (Fingering_engraver, stem);
ADD_TRANSLATOR (Fingering_engraver,
- /* doc */
- "Create fingering scripts.",
+ /* doc */
+ "Create fingering scripts.",
- /* create */
- "Fingering ",
+ /* create */
+ "Fingering ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
font = FcNameUnparse (fs->fonts[j]);
if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &str) == FcResultMatch)
- retval += String_convert::form_string ("FILE %s\n", str);
+ retval += String_convert::form_string ("FILE %s\n", str);
if (FcPatternGetString (fs->fonts[j], FC_INDEX, 0, &str) == FcResultMatch)
- retval += String_convert::form_string ("INDEX %s\n", str);
+ retval += String_convert::form_string ("INDEX %s\n", str);
if (FcPatternGetString (fs->fonts[j], FC_FAMILY, 0, &str) == FcResultMatch)
- retval += String_convert::form_string ("family %s\n ", str);
+ retval += String_convert::form_string ("family %s\n ", str);
if (FcPatternGetString (fs->fonts[j],
- "designsize", 0, &str) == FcResultMatch)
- retval += String_convert::form_string ("designsize %s\n ", str);
+ "designsize", 0, &str) == FcResultMatch)
+ retval += String_convert::form_string ("designsize %s\n ", str);
retval += String_convert::form_string ("%s\n", (const char *)font);
free (font);
return retval;
}
-
LY_DEFINE (ly_font_config_get_font_file, "ly:font-config-get-font-file", 1, 0, 0,
- (SCM name),
- "Get the file for font @var{name}.")
+ (SCM name),
+ "Get the file for font @var{name}.")
{
LY_ASSERT_TYPE (scm_is_string, name, 1);
return scm_result;
}
-
+
LY_DEFINE (ly_font_config_display_fonts, "ly:font-config-display-fonts", 0, 0, 0,
- (),
- "Dump a list of all fonts visible to FontConfig.")
+ (),
+ "Dump a list of all fonts visible to FontConfig.")
{
string str = display_list (NULL);
str += display_config (NULL);
}
LY_DEFINE (ly_font_config_add_directory, "ly:font-config-add-directory", 1, 0, 0,
- (SCM dir),
- "Add directory @var{dir} to FontConfig.")
+ (SCM dir),
+ "Add directory @var{dir} to FontConfig.")
{
LY_ASSERT_TYPE (scm_is_string, dir, 1);
}
LY_DEFINE (ly_font_config_add_font, "ly:font-config-add-font", 1, 0, 0,
- (SCM font),
- "Add font @var{font} to FontConfig.")
+ (SCM font),
+ "Add font @var{font} to FontConfig.")
{
LY_ASSERT_TYPE (scm_is_string, font, 1);
#include "main.hh"
#include "warn.hh"
-
FcConfig *font_config_global = 0;
void
/* TODO: Find a way for Fontconfig to update its cache, if needed. */
font_config_global = FcInitLoadConfig ();
-
+
vector<string> dirs;
/* Extra trailing slash suddenly breaks fontconfig (fc-cache 2.5.0)
on windows. */
dirs.push_back (lilypond_datadir + "/fonts/otf");
-
+
for (vsize i = 0; i < dirs.size (); i++)
{
string dir = dirs[i];
if (!FcConfigAppFontAddDir (font_config_global, (FcChar8 *)dir.c_str ()))
- error (_f ("failed adding font directory: %s", dir.c_str ()));
+ error (_f ("failed adding font directory: %s", dir.c_str ()));
else if (be_verbose_global)
- message (_f ("adding font directory: %s", dir.c_str ()));
+ message (_f ("adding font directory: %s", dir.c_str ()));
}
-
+
if (be_verbose_global)
message (_ ("Building font database..."));
}
ADD_INTERFACE (Font_interface,
- "Any symbol that is typeset through fixed sets of glyphs,"
- " (i.e., fonts).",
+ "Any symbol that is typeset through fixed sets of glyphs,"
+ " (i.e., fonts).",
- /* properties */
- "font "
- "font-encoding "
- "font-family "
- "font-name "
- "font-series "
- "font-shape "
- "font-size "
- );
+ /* properties */
+ "font "
+ "font-encoding "
+ "font-family "
+ "font-name "
+ "font-series "
+ "font-shape "
+ "font-size "
+ );
#include "modified-font-metric.hh"
LY_DEFINE (ly_font_get_glyph, "ly:font-get-glyph",
- 2, 0, 0,
- (SCM font, SCM name),
- "Return a stencil from @var{font} for the glyph named @var{name}."
- " If the glyph is not available, return an empty stencil.\n"
- "\n"
- "Note that this command can only be used to access glyphs from"
- " fonts loaded with @code{ly:system-font-load}; currently, this"
- " means either the Emmentaler or Emmentaler-Brace "
+ 2, 0, 0,
+ (SCM font, SCM name),
+ "Return a stencil from @var{font} for the glyph named @var{name}."
+ " If the glyph is not available, return an empty stencil.\n"
+ "\n"
+ "Note that this command can only be used to access glyphs from"
+ " fonts loaded with @code{ly:system-font-load}; currently, this"
+ " means either the Emmentaler or Emmentaler-Brace "
" fonts, corresponding"
- " to the font encodings @code{fetaMusic} and @code{fetaBraces},"
- " respectively.")
+ " to the font encodings @code{fetaMusic} and @code{fetaBraces},"
+ " respectively.")
{
Font_metric *fm = unsmob_metrics (font);
LY_ASSERT_SMOB (Font_metric, font, 1);
}
LY_DEFINE (ly_font_glyph_name_to_index, "ly:font-glyph-name-to-index",
- 2, 0, 0,
- (SCM font, SCM name),
- "Return the index for @var{name} in @var{font}.\n"
- "\n"
- "Note that this command can only be used to access glyphs from"
- " fonts loaded with @code{ly:system-font-load}; currently, this"
- " means either the Emmentaler or Emmentaler-Brace fonts, corresponding"
- " to the font encodings @code{fetaMusic} and @code{fetaBraces},"
- " respectively.")
+ 2, 0, 0,
+ (SCM font, SCM name),
+ "Return the index for @var{name} in @var{font}.\n"
+ "\n"
+ "Note that this command can only be used to access glyphs from"
+ " fonts loaded with @code{ly:system-font-load}; currently, this"
+ " means either the Emmentaler or Emmentaler-Brace fonts, corresponding"
+ " to the font encodings @code{fetaMusic} and @code{fetaBraces},"
+ " respectively.")
{
Font_metric *fm = unsmob_metrics (font);
LY_ASSERT_SMOB (Font_metric, font, 1);
}
LY_DEFINE (ly_font_index_to_charcode, "ly:font-index-to-charcode",
- 2, 0, 0,
- (SCM font, SCM index),
- "Return the character code for @var{index} in @var{font}.\n"
- "\n"
- "Note that this command can only be used to access glyphs from"
- " fonts loaded with @code{ly:system-font-load}; currently, this"
- " means either the Emmentaler or Emmentaler-Brace fonts, corresponding"
- " to the font encodings @code{fetaMusic} and @code{fetaBraces},"
- " respectively.")
+ 2, 0, 0,
+ (SCM font, SCM index),
+ "Return the character code for @var{index} in @var{font}.\n"
+ "\n"
+ "Note that this command can only be used to access glyphs from"
+ " fonts loaded with @code{ly:system-font-load}; currently, this"
+ " means either the Emmentaler or Emmentaler-Brace fonts, corresponding"
+ " to the font encodings @code{fetaMusic} and @code{fetaBraces},"
+ " respectively.")
{
Font_metric *fm = unsmob_metrics (font);
LY_ASSERT_SMOB (Font_metric, font, 1);
}
LY_DEFINE (ly_font_glyph_name_to_charcode, "ly:font-glyph-name-to-charcode",
- 2, 0, 0,
- (SCM font, SCM name),
- "Return the character code for glyph @var{name} in @var{font}.\n"
- "\n"
- "Note that this command can only be used to access glyphs from"
- " fonts loaded with @code{ly:system-font-load}; currently, this"
- " means either the Emmentaler or Emmentaler-Brace fonts, corresponding"
- " to the font encodings @code{fetaMusic} and @code{fetaBraces},"
- " respectively.")
+ 2, 0, 0,
+ (SCM font, SCM name),
+ "Return the character code for glyph @var{name} in @var{font}.\n"
+ "\n"
+ "Note that this command can only be used to access glyphs from"
+ " fonts loaded with @code{ly:system-font-load}; currently, this"
+ " means either the Emmentaler or Emmentaler-Brace fonts, corresponding"
+ " to the font encodings @code{fetaMusic} and @code{fetaBraces},"
+ " respectively.")
{
Font_metric *fm = unsmob_metrics (font);
LY_ASSERT_SMOB (Font_metric, font, 1);
TODO: when are non string retvals allowed?
*/
LY_DEFINE (ly_font_file_name, "ly:font-file-name",
- 1, 0, 0,
- (SCM font),
- "Given the font metric @var{font},"
- " return the corresponding file name.")
+ 1, 0, 0,
+ (SCM font),
+ "Given the font metric @var{font},"
+ " return the corresponding file name.")
{
LY_ASSERT_SMOB (Font_metric, font, 1);
}
LY_DEFINE (ly_font_name, "ly:font-name",
- 1, 0, 0,
- (SCM font),
- "Given the font metric @var{font},"
- " return the corresponding name.")
+ 1, 0, 0,
+ (SCM font),
+ "Given the font metric @var{font},"
+ " return the corresponding name.")
{
LY_ASSERT_SMOB (Font_metric, font, 1);
Font_metric *fm = unsmob_metrics (font);
}
LY_DEFINE (ly_font_magnification, "ly:font-magnification", 1, 0, 0,
- (SCM font),
- "Given the font metric @var{font}, return the"
- " magnification, relative to the current output-scale.")
+ (SCM font),
+ "Given the font metric @var{font}, return the"
+ " magnification, relative to the current output-scale.")
{
LY_ASSERT_SMOB (Font_metric, font, 1);
}
LY_DEFINE (ly_font_design_size, "ly:font-design-size", 1, 0, 0,
- (SCM font),
- "Given the font metric @var{font}, return the"
- " design size, relative to the current output-scale.")
+ (SCM font),
+ "Given the font metric @var{font}, return the"
+ " design size, relative to the current output-scale.")
{
LY_ASSERT_SMOB (Font_metric, font, 1);
if (idx >= 0)
{
expr = scm_list_3 (ly_symbol2scm ("named-glyph"),
- self_scm (),
- ly_string2scm (s));
+ self_scm (),
+ ly_string2scm (s));
b = get_indexed_char_dimensions (idx);
}
size_t
Font_metric::name_to_index (string) const
{
- return (size_t)-1;
+ return (size_t) - 1;
}
Offset
string, bool) const
{
(void) state;
-
+
programming_error ("Cannot get a text stencil from this font");
return Stencil (Box (), SCM_EOL);
}
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "dimensions.hh"
#include "all-font-metrics.hh"
#include "output-def.hh"
Font_metric *
get_font_by_design_size (Output_def *layout, Real requested,
- SCM font_vector)
+ SCM font_vector)
{
int n = scm_c_vector_length (font_vector);
Real size = 1e6;
SCM entry = scm_c_vector_ref (font_vector, i);
if (scm_promise_p (entry) == SCM_BOOL_T)
- {
- Font_metric *fm = unsmob_metrics (scm_force (entry));
- size = fm->design_size ();
- }
+ {
+ Font_metric *fm = unsmob_metrics (scm_force (entry));
+ size = fm->design_size ();
+ }
#if HAVE_PANGO_FT2
else if (scm_is_pair (entry)
- && scm_is_number (scm_car (entry))
- && scm_is_string (scm_cdr (entry)))
- {
- size = scm_to_double (scm_car (entry));
- pango_description_string
- = scm_cdr (entry);
- }
+ && scm_is_number (scm_car (entry))
+ && scm_is_string (scm_cdr (entry)))
+ {
+ size = scm_to_double (scm_car (entry));
+ pango_description_string
+ = scm_cdr (entry);
+ }
#endif
if (size > requested)
- break;
+ break;
last_size = size;
last_pango_description_string = pango_description_string;
}
else if (i > 0)
{
if ((requested / last_size) < (size / requested))
- {
- i--;
- size = last_size;
- pango_description_string = last_pango_description_string;
- }
+ {
+ i--;
+ size = last_size;
+ pango_description_string = last_pango_description_string;
+ }
}
Font_metric *fm = 0;
{
#if HAVE_PANGO_FT2
return find_pango_font (layout,
- pango_description_string,
- requested / size);
+ pango_description_string,
+ requested / size);
#else
error ("Trying to retrieve pango font without HAVE_PANGO_FT2.");
#endif
Font_metric *
get_font_by_mag_step (Output_def *layout, Real requested_step,
- SCM font_vector, Real default_size)
+ SCM font_vector, Real default_size)
{
return get_font_by_design_size (layout, default_size
- * pow (2.0, requested_step / 6.0),
- font_vector);
+ * pow (2.0, requested_step / 6.0),
+ font_vector);
}
SCM
properties_to_font_size_family (SCM fonts, SCM alist_chain)
{
return scm_call_2 (ly_lily_module_constant ("lookup-font"), fonts,
- alist_chain);
+ alist_chain);
}
Font_metric *
#endif
if (scm_instance_p (name))
{
- SCM base_size = scm_slot_ref (name, ly_symbol2scm ("default-size"));
- SCM vec = scm_slot_ref (name, ly_symbol2scm ("size-vector"));
+ SCM base_size = scm_slot_ref (name, ly_symbol2scm ("default-size"));
+ SCM vec = scm_slot_ref (name, ly_symbol2scm ("size-vector"));
- Real req = robust_scm2double (ly_chain_assoc_get (ly_symbol2scm ("font-size"), chain, SCM_BOOL_F),
- 0.0);
+ Real req = robust_scm2double (ly_chain_assoc_get (ly_symbol2scm ("font-size"), chain, SCM_BOOL_F),
+ 0.0);
- return get_font_by_mag_step (layout, req, vec,
- scm_to_double (base_size));
+ return get_font_by_mag_step (layout, req, vec,
+ scm_to_double (base_size));
}
assert (0);
return;
Real font_size = size
- + robust_scm2double (gi.grob ()->get_property ("font-size"), 0);
+ + robust_scm2double (gi.grob ()->get_property ("font-size"), 0);
gi.grob ()->set_property ("font-size", scm_from_double (font_size));
}
ADD_ACKNOWLEDGER (Font_size_engraver, font);
ADD_TRANSLATOR (Font_size_engraver,
- /* doc */
- "Put @code{fontSize} into @code{font-size} grob property.",
+ /* doc */
+ "Put @code{fontSize} into @code{font-size} grob property.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "fontSize ",
+ /* read */
+ "fontSize ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
b->set_parent (s, X_AXIS);
Grob *bound = unsmob_grob (get_property ("currentMusicalColumn"));
b->set_bound (LEFT, bound);
- annotated_spanners_.push_back (Drul_array<Spanner *> (s,b));
+ annotated_spanners_.push_back (Drul_array<Spanner *> (s, b));
}
else
{
{
Stream_event *e = unsmob_stream_event (scm_car (s));
if (e->in_event_class ("footnote-event"))
- footnotify (info.grob (), e);
+ footnotify (info.grob (), e);
}
for (vsize i = 0; i < events_.size (); i++)
{
if (info.grob ()->name () == ly_symbol2string (events_[i]->get_property ("symbol")))
- footnotify (info.grob (), events_[i]);
+ footnotify (info.grob (), events_[i]);
}
}
ADD_END_ACKNOWLEDGER (Footnote_engraver, grob);
ADD_TRANSLATOR (Footnote_engraver,
- /* doc */
- "Create footnote texts.",
+ /* doc */
+ "Create footnote texts.",
- /* create */
- "FootnoteItem "
- "FootnoteSpanner ",
+ /* create */
+ "FootnoteItem "
+ "FootnoteSpanner ",
- /*read*/
- "currentMusicalColumn ",
+ /*read*/
+ "currentMusicalColumn ",
- /*write*/
- ""
- );
+ /*write*/
+ ""
+ );
}
ADD_TRANSLATOR (Forbid_line_break_engraver,
- /* doc */
- "Forbid line breaks when note heads are still playing at some"
- " point.",
+ /* doc */
+ "Forbid line breaks when note heads are still playing at some"
+ " point.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "busyGrobs ",
+ /* read */
+ "busyGrobs ",
- /* write */
- "forbidBreak "
- );
+ /* write */
+ "forbidBreak "
+ );
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2007--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "freetype.hh"
-#undef __FTERRORS_H__
-#define FT_ERRORDEF(e, v, s) { e, s },
-#define FT_ERROR_START_LIST {
-#define FT_ERROR_END_LIST { 0, 0 } };
-
+#undef __FTERRORS_H__
+#define FT_ERRORDEF(e, v, s) { e, s },
+#define FT_ERROR_START_LIST {
+#define FT_ERROR_END_LIST { 0, 0 } };
+
const struct Freetype_error_message
-{
- FT_Error err_code;
- const char* err_msg;
-} ft_errors[] =
-
+{
+ FT_Error err_code;
+ const char *err_msg;
+} ft_errors[] =
+
#include <freetype/fterrors.h>
;
-
#include <string>
string
freetype_error_string (FT_Error code)
{
for (Freetype_error_message const *p = ft_errors;
- p->err_msg; p ++)
+ p->err_msg; p++)
{
if (p->err_code == code)
- return p->err_msg;
+ return p->err_msg;
}
- return "<unknown error>";
+ return "<unknown error>";
}
-
+
return;
SCM tab_strings = articulation_list (note_events_,
- tabstring_events_,
- "string-number-event");
+ tabstring_events_,
+ "string-number-event");
SCM fingers = articulation_list (note_events_,
- fingering_events_,
- "fingering-event");
+ fingering_events_,
+ "fingering-event");
fret_board_ = make_item ("FretBoard", note_events_[0]->self_scm ());
SCM fret_notes = ly_cxx_vector_to_list (note_events_);
SCM proc = get_property ("noteToFretFunction");
if (ly_is_procedure (proc))
scm_call_4 (proc,
- context ()->self_scm (),
- fret_notes,
- scm_list_2 (tab_strings, fingers),
- fret_board_->self_scm ());
+ context ()->self_scm (),
+ fret_notes,
+ scm_list_2 (tab_strings, fingers),
+ fret_board_->self_scm ());
SCM changes = get_property ("chordChanges");
if (to_boolean (changes) && scm_is_pair (last_fret_notes_)
&& ly_is_equal (last_fret_notes_, fret_notes))
}
ADD_TRANSLATOR (Fretboard_engraver,
- /* doc */
- "Generate fret diagram from one or more events of type"
- " @code{NoteEvent}.",
-
- /* create */
- "FretBoard ",
-
- /* read */
- "chordChanges "
- "defaultStrings "
- "highStringOne "
- "maximumFretStretch "
- "minimumFret "
- "noteToFretFunction "
- "predefinedDiagramTable "
- "stringTunings "
- "tablatureFormat ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Generate fret diagram from one or more events of type"
+ " @code{NoteEvent}.",
+
+ /* create */
+ "FretBoard ",
+
+ /* read */
+ "chordChanges "
+ "defaultStrings "
+ "highStringOne "
+ "maximumFretStretch "
+ "minimumFret "
+ "noteToFretFunction "
+ "predefinedDiagramTable "
+ "stringTunings "
+ "tablatureFormat ",
+
+ /* write */
+ ""
+ );
#include "lily-guile.hh"
#include "warn.hh"
-
static SCM doc_hash_table;
void
string mangle = mangle_cxx_identifier (cxx);
if (mangle != scm_name)
{
- programming_error ("wrong cxx name: " + mangle + ", " + cxx + ", " + scm_name);
+ programming_error ("wrong cxx name: " + mangle + ", " + cxx + ", " + scm_name);
}
}
-
void
ly_add_function_documentation (SCM func,
- string fname,
- string varlist,
- string doc)
+ string fname,
+ string varlist,
+ string doc)
{
if (doc == "")
return;
doc_hash_table = scm_permanent_object (scm_c_make_hash_table (59));
string s = string (" - ") + "LilyPond procedure: " + fname + " " + varlist
- + "\n" + doc;
+ + "\n" + doc;
scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
- ly_string2scm (s));
+ ly_string2scm (s));
SCM entry = scm_cons (ly_string2scm (varlist), ly_string2scm (doc));
scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname.c_str ()), entry);
}
LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation",
- 0, 0, 0, (),
- "Get a hash table with all LilyPond Scheme extension functions.")
+ 0, 0, 0, (),
+ "Get a hash table with all LilyPond Scheme extension functions.")
{
return doc_hash_table;
}
-
#include <map>
map<void *, string> type_names;
-
+
void
ly_add_type_predicate (void *ptr,
- string name)
+ string name)
{
- type_names[ptr] = name;
+ type_names[ptr] = name;
}
string
void
init_func_doc ()
{
- ly_add_type_predicate ((void*) &is_direction, "direction");
- ly_add_type_predicate ((void*) &is_music_function, "Music_function");
- ly_add_type_predicate ((void*) &ly_is_port, "port");
- ly_add_type_predicate ((void*) &ly_cheap_is_list, "list");
- ly_add_type_predicate ((void*) &unsmob_global_context, "Global_context");
- ly_add_type_predicate ((void*) &unsmob_input, "Input");
- ly_add_type_predicate ((void*) &unsmob_moment, "Moment");
- ly_add_type_predicate ((void*) &unsmob_paper_score, "Paper_score");
- ly_add_type_predicate ((void*) &unsmob_performance, "Performance");
-
- ly_add_type_predicate ((void*) &is_axis, "axis");
- ly_add_type_predicate ((void*) &is_number_pair, "number pair");
- ly_add_type_predicate ((void*) &ly_is_list, "list");
- ly_add_type_predicate ((void*) &ly_is_procedure, "procedure");
- ly_add_type_predicate ((void*) &ly_is_symbol, "symbol");
- ly_add_type_predicate ((void*) &scm_is_bool, "boolean");
- ly_add_type_predicate ((void*) &scm_is_integer, "integer");
- ly_add_type_predicate ((void*) &scm_is_number, "number");
- ly_add_type_predicate ((void*) &scm_is_pair, "pair");
- ly_add_type_predicate ((void*) &scm_is_rational, "rational");
- ly_add_type_predicate ((void*) &scm_is_string, "string");
- ly_add_type_predicate ((void*) &scm_is_vector, "vector");
- ly_add_type_predicate ((void*) &unsmob_item, "Item");
- ly_add_type_predicate ((void*) &unsmob_music, "Music");
- ly_add_type_predicate ((void*) &unsmob_spanner, "Spanner");
- ly_add_type_predicate ((void*) &unsmob_stream_event, "Stream_event");
+ ly_add_type_predicate ((void *) &is_direction, "direction");
+ ly_add_type_predicate ((void *) &is_music_function, "Music_function");
+ ly_add_type_predicate ((void *) &ly_is_port, "port");
+ ly_add_type_predicate ((void *) &ly_cheap_is_list, "list");
+ ly_add_type_predicate ((void *) &unsmob_global_context, "Global_context");
+ ly_add_type_predicate ((void *) &unsmob_input, "Input");
+ ly_add_type_predicate ((void *) &unsmob_moment, "Moment");
+ ly_add_type_predicate ((void *) &unsmob_paper_score, "Paper_score");
+ ly_add_type_predicate ((void *) &unsmob_performance, "Performance");
+
+ ly_add_type_predicate ((void *) &is_axis, "axis");
+ ly_add_type_predicate ((void *) &is_number_pair, "number pair");
+ ly_add_type_predicate ((void *) &ly_is_list, "list");
+ ly_add_type_predicate ((void *) &ly_is_procedure, "procedure");
+ ly_add_type_predicate ((void *) &ly_is_symbol, "symbol");
+ ly_add_type_predicate ((void *) &scm_is_bool, "boolean");
+ ly_add_type_predicate ((void *) &scm_is_integer, "integer");
+ ly_add_type_predicate ((void *) &scm_is_number, "number");
+ ly_add_type_predicate ((void *) &scm_is_pair, "pair");
+ ly_add_type_predicate ((void *) &scm_is_rational, "rational");
+ ly_add_type_predicate ((void *) &scm_is_string, "string");
+ ly_add_type_predicate ((void *) &scm_is_vector, "vector");
+ ly_add_type_predicate ((void *) &unsmob_item, "Item");
+ ly_add_type_predicate ((void *) &unsmob_music, "Music");
+ ly_add_type_predicate ((void *) &unsmob_spanner, "Spanner");
+ ly_add_type_predicate ((void *) &unsmob_stream_event, "Stream_event");
}
ADD_SCM_INIT_FUNC (func_doc, init_func_doc);
#include "warn.hh"
LY_DEFINE (ly_start_environment, "ly:start-environment",
- 0, 0, 0, (),
- "Return the environment (a list of strings) that was in"
- " effect at program start.")
+ 0, 0, 0, (),
+ "Return the environment (a list of strings) that was in"
+ " effect at program start.")
{
SCM l = SCM_EOL;
SCM *tail = &l;
for (vsize i = 0; i < start_environment_global.size (); i++)
{
*tail = scm_cons (ly_string2scm (start_environment_global[i]),
- SCM_EOL);
- tail = SCM_CDRLOC(*tail);
+ SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
}
return l;
}
-
LY_DEFINE (ly_find_file, "ly:find-file",
- 1, 0, 0, (SCM name),
- "Return the absolute file name of @var{name},"
- " or @code{#f} if not found.")
+ 1, 0, 0, (SCM name),
+ "Return the absolute file name of @var{name},"
+ " or @code{#f} if not found.")
{
LY_ASSERT_TYPE (scm_is_string, name, 1);
buffering.)
*/
LY_DEFINE (ly_gulp_file, "ly:gulp-file",
- 1, 1, 0, (SCM name, SCM size),
- "Read @var{size} characters from the file @var{name},"
+ 1, 1, 0, (SCM name, SCM size),
+ "Read @var{size} characters from the file @var{name},"
" and return its contents in a string."
" If @var{size} is undefined, the entire file is read."
- " The file is looked up using the search path.")
+ " The file is looked up using the search path.")
{
LY_ASSERT_TYPE (scm_is_string, name, 1);
int sz = INT_MAX;
}
LY_DEFINE (ly_error, "ly:error",
- 1, 0, 1, (SCM str, SCM rest),
- "A Scheme callable function to issue the error @var{str}."
- " The error is formatted with @code{format} and @var{rest}.")
+ 1, 0, 1, (SCM str, SCM rest),
+ "A Scheme callable function to issue the error @var{str}."
+ " The error is formatted with @code{format} and @var{rest}.")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
}
LY_DEFINE (ly_message, "ly:message",
- 1, 0, 1, (SCM str, SCM rest),
- "A Scheme callable function to issue the message @var{str}."
- " The message is formatted with @code{format} and @var{rest}.")
+ 1, 0, 1, (SCM str, SCM rest),
+ "A Scheme callable function to issue the message @var{str}."
+ " The message is formatted with @code{format} and @var{rest}.")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
}
LY_DEFINE (ly_progress, "ly:progress",
- 1, 0, 1, (SCM str, SCM rest),
- "A Scheme callable function to print progress @var{str}."
- " The message is formatted with @code{format} and @var{rest}.")
+ 1, 0, 1, (SCM str, SCM rest),
+ "A Scheme callable function to print progress @var{str}."
+ " The message is formatted with @code{format} and @var{rest}.")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
}
LY_DEFINE (ly_programming_error, "ly:programming-error",
- 1, 0, 1, (SCM str, SCM rest),
- "A Scheme callable function to issue the internal warning"
- " @var{str}. The message is formatted with @code{format}"
- " and @var{rest}.")
+ 1, 0, 1, (SCM str, SCM rest),
+ "A Scheme callable function to issue the internal warning"
+ " @var{str}. The message is formatted with @code{format}"
+ " and @var{rest}.")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
}
LY_DEFINE (ly_success, "ly:success",
- 1, 0, 1, (SCM str, SCM rest),
- "A Scheme callable function to issue a success message @var{str}."
- " The message is formatted with @code{format} and @var{rest}.")
+ 1, 0, 1, (SCM str, SCM rest),
+ "A Scheme callable function to issue a success message @var{str}."
+ " The message is formatted with @code{format} and @var{rest}.")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
}
LY_DEFINE (ly_warning, "ly:warning",
- 1, 0, 1, (SCM str, SCM rest),
- "A Scheme callable function to issue the warning @var{str}."
- " The message is formatted with @code{format} and @var{rest}.")
+ 1, 0, 1, (SCM str, SCM rest),
+ "A Scheme callable function to issue the warning @var{str}."
+ " The message is formatted with @code{format} and @var{rest}.")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
}
LY_DEFINE (ly_dir_p, "ly:dir?",
- 1, 0, 0, (SCM s),
- "Is @var{s} a direction? Valid directions are @code{-1},"
- " @code{0}, or@tie{}@code{1}, where @code{-1} represents"
- " left or down, @code{1}@tie{}represents right or up, and @code{0}"
- " represents a neutral direction.")
+ 1, 0, 0, (SCM s),
+ "Is @var{s} a direction? Valid directions are @code{-1},"
+ " @code{0}, or@tie{}@code{1}, where @code{-1} represents"
+ " left or down, @code{1}@tie{}represents right or up, and @code{0}"
+ " represents a neutral direction.")
{
if (scm_is_number (s))
{
}
LY_DEFINE (ly_assoc_get, "ly:assoc-get",
- 2, 2, 0,
- (SCM key, SCM alist, SCM default_value, SCM strict_checking),
- "Return value if @var{key} in @var{alist}, else @var{default-value}"
- " (or @code{#f} if not specified). If @var{strict-checking} is set"
+ 2, 2, 0,
+ (SCM key, SCM alist, SCM default_value, SCM strict_checking),
+ "Return value if @var{key} in @var{alist}, else @var{default-value}"
+ " (or @code{#f} if not specified). If @var{strict-checking} is set"
" to @code{#t} and @var{key} is not in @var{alist}, a programming_error"
" is output.")
{
- LY_ASSERT_TYPE(ly_cheap_is_list, alist, 2);
+ LY_ASSERT_TYPE (ly_cheap_is_list, alist, 2);
SCM handle = scm_assoc (key, alist);
if (scm_is_pair (handle))
if (strict_checking == SCM_BOOL_T)
{
string key_string = ly_scm2string
- (scm_object_to_string (key, SCM_UNDEFINED));
+ (scm_object_to_string (key, SCM_UNDEFINED));
string default_value_string = ly_scm2string
- (scm_object_to_string (default_value,
- SCM_UNDEFINED));
- programming_error ("Cannot find key `" +
- key_string +
- "' in alist, setting to `" +
- default_value_string + "'.");
+ (scm_object_to_string (default_value,
+ SCM_UNDEFINED));
+ programming_error ("Cannot find key `"
+ + key_string
+ + "' in alist, setting to `"
+ + default_value_string + "'.");
}
return default_value;
}
LY_DEFINE (ly_string_substitute, "ly:string-substitute",
- 3, 0, 0, (SCM a, SCM b, SCM s),
- "Replace string@tie{}@var{a} by string@tie{}@var{b} in"
- " string@tie{}@var{s}.")
+ 3, 0, 0, (SCM a, SCM b, SCM s),
+ "Replace string@tie{}@var{a} by string@tie{}@var{b} in"
+ " string@tie{}@var{s}.")
{
LY_ASSERT_TYPE (scm_is_string, s, 1);
LY_ASSERT_TYPE (scm_is_string, b, 2);
string ss = ly_scm2string (s);
replace_all (&ss, ly_scm2string (a),
- ly_scm2string (b));
+ ly_scm2string (b));
return ly_string2scm (ss);
}
}
LY_DEFINE (ly_string_percent_encode, "ly:string-percent-encode",
- 1, 0, 0, (SCM str),
- "Encode all characters in string @var{str} with hexadecimal"
- " percent escape sequences, with the following exceptions:"
- " characters @code{-}, @code{.}, @code{/}, and @code{_}; and"
- " characters in ranges @code{0-9}, @code{A-Z}, and @code{a-z}.")
+ 1, 0, 0, (SCM str),
+ "Encode all characters in string @var{str} with hexadecimal"
+ " percent escape sequences, with the following exceptions:"
+ " characters @code{-}, @code{.}, @code{/}, and @code{_}; and"
+ " characters in ranges @code{0-9}, @code{A-Z}, and @code{a-z}.")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
Byte cur = orig_str[i];
if (is_not_escape_character (cur))
- new_str += cur;
+ new_str += cur;
else
- {
- new_str += '%';
- new_str += String_convert::bin2hex (cur);
- }
+ {
+ new_str += '%';
+ new_str += String_convert::bin2hex (cur);
+ }
i++;
}
}
LY_DEFINE (ly_number_2_string, "ly:number->string",
- 1, 0, 0, (SCM s),
- "Convert @var{s} to a string without generating many decimals.")
+ 1, 0, 0, (SCM s),
+ "Convert @var{s} to a string without generating many decimals.")
{
LY_ASSERT_TYPE (scm_is_number, s, 1);
- char str[400]; // ugh.
+ char str[400]; // ugh.
if (scm_exact_p (s) == SCM_BOOL_F)
{
Real r (scm_to_double (s));
- if (isinf (r) || isnan (r))
- {
- programming_error (_ ("infinity or NaN encountered while converting Real number"));
- programming_error (_ ("setting to zero"));
+ if (isinf (r) || isnan (r))
+ {
+ programming_error (_ ("infinity or NaN encountered while converting Real number"));
+ programming_error (_ ("setting to zero"));
- r = 0.0;
- }
+ r = 0.0;
+ }
snprintf (str, sizeof (str), "%.4f", r);
}
}
LY_DEFINE (ly_version, "ly:version", 0, 0, 0, (),
- "Return the current lilypond version as a list, e.g.,"
- " @code{(1 3 127 uu1)}.")
+ "Return the current lilypond version as a list, e.g.,"
+ " @code{(1 3 127 uu1)}.")
{
char const *vs = "\'(" MAJOR_VERSION " " MINOR_VERSION " " PATCH_LEVEL " " MY_PATCH_LEVEL ")";
}
LY_DEFINE (ly_unit, "ly:unit", 0, 0, 0, (),
- "Return the unit used for lengths as a string.")
+ "Return the unit used for lengths as a string.")
{
return scm_from_locale_string (INTERNAL_UNIT);
}
LY_DEFINE (ly_dimension_p, "ly:dimension?", 1, 0, 0, (SCM d),
- "Return @var{d} as a number. Used to distinguish length"
- " variables from normal numbers.")
+ "Return @var{d} as a number. Used to distinguish length"
+ " variables from normal numbers.")
{
return scm_number_p (d);
}
Debugging mem leaks:
*/
LY_DEFINE (ly_protects, "ly:protects",
- 0, 0, 0, (),
- "Return hash of protected objects.")
+ 0, 0, 0, (),
+ "Return hash of protected objects.")
{
return scm_protects;
}
LY_DEFINE (ly_gettext, "ly:gettext",
- 1, 0, 0, (SCM original),
- "A Scheme wrapper function for @code{gettext}.")
+ 1, 0, 0, (SCM original),
+ "A Scheme wrapper function for @code{gettext}.")
{
LY_ASSERT_TYPE (scm_is_string, original, 1);
return ly_string2scm (_ (ly_scm2string (original).c_str ()));
}
LY_DEFINE (ly_output_formats, "ly:output-formats",
- 0, 0, 0, (),
- "Formats passed to @option{--format} as a list of strings,"
- " used for the output.")
+ 0, 0, 0, (),
+ "Formats passed to @option{--format} as a list of strings,"
+ " used for the output.")
{
vector<string> output_formats = string_split (output_format_global, ',');
}
LY_DEFINE (ly_wide_char_2_utf_8, "ly:wide-char->utf-8",
- 1, 0, 0, (SCM wc),
- "Encode the Unicode codepoint @var{wc}, an integer, as UTF-8.")
+ 1, 0, 0, (SCM wc),
+ "Encode the Unicode codepoint @var{wc}, an integer, as UTF-8.")
{
char buf[5];
}
LY_DEFINE (ly_effective_prefix, "ly:effective-prefix",
- 0, 0, 0, (),
- "Return effective prefix.")
+ 0, 0, 0, (),
+ "Return effective prefix.")
{
return ly_string2scm (lilypond_datadir);
}
LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get",
- 2, 2, 0, (SCM key, SCM achain, SCM default_value, SCM strict_checking),
- "Return value for @var{key} from a list of alists @var{achain}."
- " If no entry is found, return @var{default-value} or @code{#f} if"
- " @var{default-value} is not specified. With @var{strict-checking}"
+ 2, 2, 0, (SCM key, SCM achain, SCM default_value, SCM strict_checking),
+ "Return value for @var{key} from a list of alists @var{achain}."
+ " If no entry is found, return @var{default-value} or @code{#f} if"
+ " @var{default-value} is not specified. With @var{strict-checking}"
" set to @code{#t}, a programming_error is output in such cases.")
{
if (scm_is_pair (achain))
{
SCM handle = scm_assoc (key, scm_car (achain));
if (scm_is_pair (handle))
- return scm_cdr (handle);
+ return scm_cdr (handle);
else
- return ly_chain_assoc_get (key, scm_cdr (achain), default_value);
+ return ly_chain_assoc_get (key, scm_cdr (achain), default_value);
}
if (strict_checking == SCM_BOOL_T)
{
string key_string = ly_scm2string
- (scm_object_to_string (key, SCM_UNDEFINED));
+ (scm_object_to_string (key, SCM_UNDEFINED));
string default_value_string = ly_scm2string
- (scm_object_to_string (default_value,
- SCM_UNDEFINED));
- programming_error ("Cannot find key `" +
- key_string +
- "' in achain, setting to `" +
- default_value_string + "'.");
+ (scm_object_to_string (default_value,
+ SCM_UNDEFINED));
+ programming_error ("Cannot find key `"
+ + key_string
+ + "' in achain, setting to `"
+ + default_value_string + "'.");
}
return default_value == SCM_UNDEFINED ? SCM_BOOL_F : default_value;
}
-
LY_DEFINE (ly_stderr_redirect, "ly:stderr-redirect",
- 1, 1, 0, (SCM file_name, SCM mode),
- "Redirect stderr to @var{file-name}, opened with @var{mode}.")
+ 1, 1, 0, (SCM file_name, SCM mode),
+ "Redirect stderr to @var{file-name}, opened with @var{mode}.")
{
LY_ASSERT_TYPE (scm_is_string, file_name, 1);
static SCM
accumulate_symbol (void * /* closure */,
- SCM key,
- SCM /* val */,
- SCM result)
+ SCM key,
+ SCM /* val */,
+ SCM result)
{
return scm_cons (key, result);
}
LY_DEFINE (ly_hash_table_keys, "ly:hash-table-keys",
- 1,0,0, (SCM tab),
- "Return a list of keys in @var{tab}.")
+ 1, 0, 0, (SCM tab),
+ "Return a list of keys in @var{tab}.")
{
return scm_internal_hash_fold ((scm_t_hash_fold_fn) &accumulate_symbol,
- NULL, SCM_EOL, tab);
+ NULL, SCM_EOL, tab);
}
LY_DEFINE (ly_camel_case_2_lisp_identifier, "ly:camel-case->lisp-identifier",
- 1, 0, 0, (SCM name_sym),
- "Convert @code{FooBar_Bla} to @code{foo-bar-bla} style symbol.")
+ 1, 0, 0, (SCM name_sym),
+ "Convert @code{FooBar_Bla} to @code{foo-bar-bla} style symbol.")
{
LY_ASSERT_TYPE (ly_is_symbol, name_sym, 1);
}
LY_DEFINE (ly_expand_environment, "ly:expand-environment",
- 1, 0, 0, (SCM str),
- "Expand @code{$VAR} and @code{$@{VAR@}} in @var{str}.")
+ 1, 0, 0, (SCM str),
+ "Expand @code{$VAR} and @code{$@{VAR@}} in @var{str}.")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
return ly_string2scm (expand_environment_variables (ly_scm2string (str)));
}
-
LY_DEFINE (ly_truncate_list_x, "ly:truncate-list!",
- 2, 0, 0, (SCM lst, SCM i),
- "Take at most the first @var{i} of list @var{lst}.")
+ 2, 0, 0, (SCM lst, SCM i),
+ "Take at most the first @var{i} of list @var{lst}.")
{
LY_ASSERT_TYPE (scm_is_integer, i, 1);
SCM s = lst;
k--;
for (; scm_is_pair (s) && k--; s = scm_cdr (s))
- ;
+ ;
if (scm_is_pair (s))
- scm_set_cdr_x (s, SCM_EOL);
+ scm_set_cdr_x (s, SCM_EOL);
}
return lst;
}
Real val = scm_to_double (arg);
if (isnan (val) || isinf (val))
- {
- warning (_ ("Found infinity or nan in output. Substituting 0.0"));
- return ("0.0");
- if (strict_infinity_checking)
- abort ();
- }
+ {
+ warning (_ ("Found infinity or nan in output. Substituting 0.0"));
+ return ("0.0");
+ if (strict_infinity_checking)
+ abort ();
+ }
else
- return (String_convert::form_string ("%.*lf", precision, val));
+ return (String_convert::form_string ("%.*lf", precision, val));
}
else if (scm_is_string (arg))
{
else
{
ly_progress (scm_from_locale_string ("\nUnsupported SCM value for format: ~a"),
- scm_list_1 (arg));
+ scm_list_1 (arg));
}
-
return "";
}
LY_DEFINE (ly_format, "ly:format",
- 1, 0, 1, (SCM str, SCM rest),
- "LilyPond specific format, supporting @code{~a} and @code{~[0-9]f}."
- " Basic support for @code{~s} is also provided.")
+ 1, 0, 1, (SCM str, SCM rest),
+ "LilyPond specific format, supporting @code{~a} and @code{~[0-9]f}."
+ " Basic support for @code{~s} is also provided.")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
{
vsize tilde = format.find ('~', i);
- results.push_back (format.substr (i, (tilde-i)));
+ results.push_back (format.substr (i, (tilde - i)));
if (tilde == NPOS)
- break ;
+ break;
- tilde ++;
+ tilde++;
- char spec = format.at (tilde ++);
+ char spec = format.at (tilde++);
if (spec == '~')
- results.push_back ("~");
+ results.push_back ("~");
else
- {
- if (!scm_is_pair (rest))
- {
- programming_error (string (__FUNCTION__)
- + ": not enough arguments for format.");
- return ly_string2scm ("");
- }
-
- SCM arg = scm_car (rest);
- rest = scm_cdr (rest);
-
- int precision = 8;
-
- if (spec == '$')
- precision = 2;
- else if (isdigit (spec))
- {
- precision = spec - '0';
- spec = format.at (tilde ++);
- }
-
- if (spec == 'a' || spec == 'A' || spec == 'f' || spec == '$')
- results.push_back (format_single_argument (arg, precision));
- else if (spec == 's' || spec == 'S')
- results.push_back (format_single_argument (arg, precision, true));
- else if (spec == 'l')
- {
- SCM s = arg;
- for (; scm_is_pair (s); s = scm_cdr (s))
- {
- results.push_back (format_single_argument (scm_car (s), precision));
- if (scm_cdr (s) != SCM_EOL)
- results.push_back (" ");
- }
-
- if (s != SCM_EOL)
- results.push_back (format_single_argument (s, precision));
-
- }
- }
+ {
+ if (!scm_is_pair (rest))
+ {
+ programming_error (string (__FUNCTION__)
+ + ": not enough arguments for format.");
+ return ly_string2scm ("");
+ }
+
+ SCM arg = scm_car (rest);
+ rest = scm_cdr (rest);
+
+ int precision = 8;
+
+ if (spec == '$')
+ precision = 2;
+ else if (isdigit (spec))
+ {
+ precision = spec - '0';
+ spec = format.at (tilde++);
+ }
+
+ if (spec == 'a' || spec == 'A' || spec == 'f' || spec == '$')
+ results.push_back (format_single_argument (arg, precision));
+ else if (spec == 's' || spec == 'S')
+ results.push_back (format_single_argument (arg, precision, true));
+ else if (spec == 'l')
+ {
+ SCM s = arg;
+ for (; scm_is_pair (s); s = scm_cdr (s))
+ {
+ results.push_back (format_single_argument (scm_car (s), precision));
+ if (scm_cdr (s) != SCM_EOL)
+ results.push_back (" ");
+ }
+
+ if (s != SCM_EOL)
+ results.push_back (format_single_argument (s, precision));
+
+ }
+ }
i = tilde;
}
if (scm_is_pair (rest))
programming_error (string (__FUNCTION__)
- + ": too many arguments");
+ + ": too many arguments");
vsize len = 0;
for (vsize i = 0; i < results.size (); i++)
len += results[i].size ();
- char *result = (char*) scm_malloc (len + 1);
+ char *result = (char *) scm_malloc (len + 1);
char *ptr = result;
for (vsize i = 0; i < results.size (); i++)
{
if (!standard_error)
flags |= G_SPAWN_STDERR_TO_DEV_NULL;
if (!g_spawn_sync (0, argv, 0, GSpawnFlags (flags),
- 0, 0,
- standard_output, standard_error,
- &exit_status, &error))
+ 0, 0,
+ standard_output, standard_error,
+ &exit_status, &error))
{
fprintf (stderr, "failed (%d): %s: %s\n", exit_status, argv[0], error->message);
g_error_free (error);
if (!exit_status)
- exit_status = -1;
+ exit_status = -1;
}
return exit_status;
}
LY_DEFINE (ly_spawn, "ly:spawn",
- 1, 0, 1, (SCM command, SCM rest),
- "Simple interface to g_spawn_sync"
- " @var{str}."
- " The error is formatted with @code{format} and @var{rest}.")
+ 1, 0, 1, (SCM command, SCM rest),
+ "Simple interface to g_spawn_sync"
+ " @var{str}."
+ " The error is formatted with @code{format} and @var{rest}.")
{
LY_ASSERT_TYPE (scm_is_string, command, 1);
char *standard_output = 0;
char *standard_error = 0;
int exit_status = be_verbose_global
- ? ly_run_command (argv, &standard_output, &standard_error)
- : ly_run_command (argv, 0, 0);
+ ? ly_run_command (argv, &standard_output, &standard_error)
+ : ly_run_command (argv, 0, 0);
if (be_verbose_global)
{
fprintf (stderr, "\n%s", standard_output);
fprintf (stderr, "%s", standard_error);
}
-
+
for (int i = 0; i < n; i++)
free (argv[i]);
delete[] argv;
{
extract_grob_set (g, "note-heads", note_heads);
int glissando_index = 0;
- for (vsize i=0; i < note_column_1.size (); i++)
+ for (vsize i = 0; i < note_column_1.size (); i++)
{
if (note_column_2[i] >= note_heads.size ())
{
note_column_1.clear ();
note_column_2.clear ();
stop_glissandi = false;
- }
+ }
if (start_glissandi)
{
note_column_1.push_back (vsize (n1));
note_column_2.push_back (vsize (n2));
}
- for (vsize i=0; i < note_column_1.size (); i++)
+ for (vsize i = 0; i < note_column_1.size (); i++)
{
lines_.push_back (make_spanner ("Glissando", event_->self_scm ()));
lines_.back ()->set_bound (LEFT, note_heads[note_column_1[i]]);
if (start_glissandi)
{
if (stop_glissandi)
- programming_error ("overwriting glissando");
+ programming_error ("overwriting glissando");
stop_glissandi = true;
start_glissandi = false;
}
string msg = _ ("unterminated glissando");
if (event_)
- event_->origin ()->warning (msg);
+ event_->origin ()->warning (msg);
else
- warning (msg);
+ warning (msg);
- for (vsize i=0; i < lines_.size (); i++)
+ for (vsize i = 0; i < lines_.size (); i++)
lines_[i]->suicide ();
}
- for (vsize i=0; i < kill_me_.size (); i++)
+ for (vsize i = 0; i < kill_me_.size (); i++)
kill_me_[i]->suicide ();
}
ADD_ACKNOWLEDGER (Glissando_engraver, note_column);
ADD_TRANSLATOR (Glissando_engraver,
- /* doc */
- "Engrave glissandi.",
+ /* doc */
+ "Engrave glissandi.",
- /* create */
- "Glissando ",
+ /* create */
+ "Glissando ",
- /* read */
- "glissandoMap ",
+ /* read */
+ "glissandoMap ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "warn.hh"
LY_DEFINE (ly_format_output, "ly:format-output",
- 1, 0, 0, (SCM context),
- "Given a global context in its final state,"
- " process it and return the @code{Music_output} object"
- " in its final state.")
+ 1, 0, 0, (SCM context),
+ "Given a global context in its final state,"
+ " process it and return the @code{Music_output} object"
+ " in its final state.")
{
Global_context *g = dynamic_cast<Global_context *> (unsmob_context (context));
}
LY_DEFINE (ly_make_global_translator, "ly:make-global-translator",
- 1, 0, 0, (SCM global),
- "Create a translator group and connect it to the global context"
- " @var{global}. The translator group is returned.")
+ 1, 0, 0, (SCM global),
+ "Create a translator group and connect it to the global context"
+ " @var{global}. The translator group is returned.")
{
Global_context *g = dynamic_cast<Global_context *> (unsmob_context (global));
LY_ASSERT_TYPE (unsmob_global_context, global, 1);
}
LY_DEFINE (ly_make_global_context, "ly:make-global-context",
- 1, 0, 0, (SCM output_def),
- "Set up a global interpretation context, using the output"
- " block @var{output-def}. The context is returned.")
+ 1, 0, 0, (SCM output_def),
+ "Set up a global interpretation context, using the output"
+ " block @var{output-def}. The context is returned.")
{
LY_ASSERT_SMOB (Output_def, output_def, 1);
Output_def *odef = unsmob_output_def (output_def);
}
LY_DEFINE (ly_interpret_music_expression, "ly:interpret-music-expression",
- 2, 0, 0, (SCM mus, SCM ctx),
- "Interpret the music expression @var{mus} in the global context"
- " @var{ctx}. The context is returned in its final state.")
+ 2, 0, 0, (SCM mus, SCM ctx),
+ "Interpret the music expression @var{mus} in the global context"
+ " @var{ctx}. The context is returned in its final state.")
{
LY_ASSERT_SMOB (Music, mus, 1);
LY_ASSERT_TYPE (unsmob_global_context, ctx, 2);
}
LY_DEFINE (ly_run_translator, "ly:run-translator",
- 2, 1, 0, (SCM mus, SCM output_def),
- "Process @var{mus} according to @var{output-def}. An"
- " interpretation context is set up, and @var{mus} is"
- " interpreted with it. The context is returned in its"
- " final state.\n"
- "\n"
- "Optionally, this routine takes an object-key to"
- " to uniquely identify the score block containing it.")
+ 2, 1, 0, (SCM mus, SCM output_def),
+ "Process @var{mus} according to @var{output-def}. An"
+ " interpretation context is set up, and @var{mus} is"
+ " interpreted with it. The context is returned in its"
+ " final state.\n"
+ "\n"
+ "Optionally, this routine takes an object-key to"
+ " to uniquely identify the score block containing it.")
{
LY_ASSERT_SMOB (Music, mus, 1);
LY_ASSERT_SMOB (Output_def, output_def, 2);
/* We only need the most basic stuff to bootstrap the context tree */
event_source ()->add_listener (GET_LISTENER (create_context_from_event),
- ly_symbol2scm ("CreateContext"));
+ ly_symbol2scm ("CreateContext"));
event_source ()->add_listener (GET_LISTENER (prepare),
- ly_symbol2scm ("Prepare"));
+ ly_symbol2scm ("Prepare"));
events_below ()->register_as_listener (event_source_);
Context_def *globaldef = unsmob_context_def (definition_);
Global_context::get_score_context () const
{
return (scm_is_pair (context_list_))
- ? unsmob_context (scm_car (context_list_))
- : 0;
+ ? unsmob_context (scm_car (context_list_))
+ : 0;
}
SCM
Global_context::get_output ()
{
- Context * c = get_score_context ();
+ Context *c = get_score_context ();
if (c)
return c->get_property ("output");
else
Moment w;
w.set_infinite (1);
if (iter->ok ())
- w = iter->pending_moment ();
+ w = iter->pending_moment ();
w = sneaky_insert_extra_moment (w);
if (w.main_part_.is_infinity () || w > final_mom)
- break;
+ break;
if (w == prev_mom_)
- {
- programming_error ("Moment is not increasing. Aborting interpretation.");
- break ;
- }
+ {
+ programming_error ("Moment is not increasing. Aborting interpretation.");
+ break;
+ }
-
if (first)
- {
- /*
- Need this to get grace notes at start of a piece correct.
- */
- first = false;
- set_property ("measurePosition", w.smobbed_copy ());
- }
+ {
+ /*
+ Need this to get grace notes at start of a piece correct.
+ */
+ first = false;
+ set_property ("measurePosition", w.smobbed_copy ());
+ }
send_stream_event (this, "Prepare", 0,
- ly_symbol2scm ("moment"), w.smobbed_copy ());
+ ly_symbol2scm ("moment"), w.smobbed_copy ());
if (iter->ok ())
- iter->process (w);
+ iter->process (w);
send_stream_event (this, "OneTimeStep", 0, 0);
apply_finalizations ();
if (last_moment_.grace_part_ && !now.grace_part_)
{
for (SCM s = grace_settings_; scm_is_pair (s); s = scm_cdr (s))
- {
- SCM context = scm_caar (s);
- SCM entry = scm_cdar (s);
- SCM grob = scm_cadr (entry);
- SCM sym = scm_caddr (entry);
+ {
+ SCM context = scm_caar (s);
+ SCM entry = scm_cdar (s);
+ SCM grob = scm_cadr (entry);
+ SCM sym = scm_caddr (entry);
- execute_pushpop_property (unsmob_context (context),
- grob, sym, SCM_UNDEFINED);
- }
+ execute_pushpop_property (unsmob_context (context),
+ grob, sym, SCM_UNDEFINED);
+ }
grace_settings_ = SCM_EOL;
}
grace_settings_ = SCM_EOL;
for (SCM s = settings; scm_is_pair (s); s = scm_cdr (s))
- {
- SCM entry = scm_car (s);
- SCM context_name = scm_car (entry);
- SCM grob = scm_cadr (entry);
- SCM sym = scm_caddr (entry);
- SCM val = scm_cadr (scm_cddr (entry));
-
- Context *c = context ();
- while (c && !c->is_alias (context_name))
- c = c->get_parent_context ();
-
- if (c)
- {
- execute_pushpop_property (c,
- grob, sym, val);
- grace_settings_
- = scm_cons (scm_cons (c->self_scm (), entry), grace_settings_);
- }
- else
- programming_error ("cannot find context from graceSettings: "
- + ly_symbol2string (context_name));
- }
+ {
+ SCM entry = scm_car (s);
+ SCM context_name = scm_car (entry);
+ SCM grob = scm_cadr (entry);
+ SCM sym = scm_caddr (entry);
+ SCM val = scm_cadr (scm_cddr (entry));
+
+ Context *c = context ();
+ while (c && !c->is_alias (context_name))
+ c = c->get_parent_context ();
+
+ if (c)
+ {
+ execute_pushpop_property (c,
+ grob, sym, val);
+ grace_settings_
+ = scm_cons (scm_cons (c->self_scm (), entry), grace_settings_);
+ }
+ else
+ programming_error ("cannot find context from graceSettings: "
+ + ly_symbol2string (context_name));
+ }
}
last_moment_ = now_mom ();
#include "translator.icc"
ADD_TRANSLATOR (Grace_engraver,
- /* doc */
- "Set font size and other properties for grace notes.",
+ /* doc */
+ "Set font size and other properties for grace notes.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "graceSettings ",
+ /* read */
+ "graceSettings ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Moment last_moment_;
Spanner *grace_spacing_;
-
+
void process_music ();
void stop_translation_timestep ();
};
-
Grace_spacing_engraver::Grace_spacing_engraver ()
{
grace_spacing_ = 0;
grace_spacing_ = make_spanner ("GraceSpacing", SCM_EOL);
}
-
if (grace_spacing_ && (now.grace_part_ || last_moment_.grace_part_))
{
Grob *column = unsmob_grob (get_property ("currentMusicalColumn"));
Pointer_group_interface::add_grob (grace_spacing_,
- ly_symbol2scm ("columns"),
- column);
+ ly_symbol2scm ("columns"),
+ column);
column->set_object ("grace-spacing", grace_spacing_->self_scm ());
if (!grace_spacing_->get_bound (LEFT))
- grace_spacing_->set_bound (LEFT, column);
+ grace_spacing_->set_bound (LEFT, column);
else
- grace_spacing_->set_bound (RIGHT, column);
+ grace_spacing_->set_bound (RIGHT, column);
}
}
grace_spacing_ = 0;
}
-
ADD_TRANSLATOR (Grace_spacing_engraver,
- "Bookkeeping of shortest starting and playing notes in grace"
- " note runs.",
-
- /* create */
- "GraceSpacing ",
-
- /* read */
- "currentMusicalColumn ",
-
- /* write */
- ""
- );
+ "Bookkeeping of shortest starting and playing notes in grace"
+ " note runs.",
+
+ /* create */
+ "GraceSpacing ",
+
+ /* read */
+ "currentMusicalColumn ",
+
+ /* write */
+ ""
+ );
}
void fix_prefix (char const *name, int mask,
- int *current_set, int min_set, int max_set,
- Grob *primitive)
+ int *current_set, int min_set, int max_set,
+ Grob *primitive)
{
bool current = *current_set & mask;
bool min = min_set & mask;
/* compute head prefix set by inspecting primitive grob properties */
int prefix_set
- = (VIRGA *to_boolean (primitive->get_property ("virga")))
- | (STROPHA *to_boolean (primitive->get_property ("stropha")))
- | (INCLINATUM *to_boolean (primitive->get_property ("inclinatum")))
- | (AUCTUM *to_boolean (primitive->get_property ("auctum")))
- | (DESCENDENS *to_boolean (primitive->get_property ("descendens")))
- | (ASCENDENS *to_boolean (primitive->get_property ("ascendens")))
- | (ORISCUS *to_boolean (primitive->get_property ("oriscus")))
- | (QUILISMA *to_boolean (primitive->get_property ("quilisma")))
- | (DEMINUTUM *to_boolean (primitive->get_property ("deminutum")))
- | (CAVUM *to_boolean (primitive->get_property ("cavum")))
- | (LINEA *to_boolean (primitive->get_property ("linea")))
- | (PES_OR_FLEXA *to_boolean (primitive->get_property ("pes-or-flexa")));
+ = (VIRGA * to_boolean (primitive->get_property ("virga")))
+ | (STROPHA * to_boolean (primitive->get_property ("stropha")))
+ | (INCLINATUM * to_boolean (primitive->get_property ("inclinatum")))
+ | (AUCTUM * to_boolean (primitive->get_property ("auctum")))
+ | (DESCENDENS * to_boolean (primitive->get_property ("descendens")))
+ | (ASCENDENS * to_boolean (primitive->get_property ("ascendens")))
+ | (ORISCUS * to_boolean (primitive->get_property ("oriscus")))
+ | (QUILISMA * to_boolean (primitive->get_property ("quilisma")))
+ | (DEMINUTUM * to_boolean (primitive->get_property ("deminutum")))
+ | (CAVUM * to_boolean (primitive->get_property ("cavum")))
+ | (LINEA * to_boolean (primitive->get_property ("linea")))
+ | (PES_OR_FLEXA * to_boolean (primitive->get_property ("pes-or-flexa")));
/* check: ascendens and descendens exclude each other; same with
- auctum and deminutum */
+ auctum and deminutum */
if (prefix_set & DESCENDENS)
- {
- fix_prefix_set (&prefix_set,
- prefix_set & ~ASCENDENS,
- prefix_set & ~ASCENDENS,
- primitive);
- }
+ {
+ fix_prefix_set (&prefix_set,
+ prefix_set & ~ASCENDENS,
+ prefix_set & ~ASCENDENS,
+ primitive);
+ }
if (prefix_set & AUCTUM)
- {
- fix_prefix_set (&prefix_set,
- prefix_set & ~DEMINUTUM,
- prefix_set & ~DEMINUTUM,
- primitive);
- }
+ {
+ fix_prefix_set (&prefix_set,
+ prefix_set & ~DEMINUTUM,
+ prefix_set & ~DEMINUTUM,
+ primitive);
+ }
/* check: virga, quilisma and oriscus cannot be combined with any
- other prefix, but may be part of a pes or flexa */
+ other prefix, but may be part of a pes or flexa */
if (prefix_set & VIRGA)
- {
- fix_prefix_set (&prefix_set,
- VIRGA,
- VIRGA | PES_OR_FLEXA,
- primitive);
- }
+ {
+ fix_prefix_set (&prefix_set,
+ VIRGA,
+ VIRGA | PES_OR_FLEXA,
+ primitive);
+ }
if (prefix_set & QUILISMA)
- {
- fix_prefix_set (&prefix_set,
- QUILISMA,
- QUILISMA | PES_OR_FLEXA,
- primitive);
- }
+ {
+ fix_prefix_set (&prefix_set,
+ QUILISMA,
+ QUILISMA | PES_OR_FLEXA,
+ primitive);
+ }
if (prefix_set & ORISCUS)
- {
- fix_prefix_set (&prefix_set,
- ORISCUS,
- ORISCUS | PES_OR_FLEXA,
- primitive);
- }
+ {
+ fix_prefix_set (&prefix_set,
+ ORISCUS,
+ ORISCUS | PES_OR_FLEXA,
+ primitive);
+ }
/* check: auctum is the only valid optional prefix for stropha */
if (prefix_set & STROPHA)
- {
- fix_prefix_set (&prefix_set,
- STROPHA,
- STROPHA | AUCTUM,
- primitive);
- }
+ {
+ fix_prefix_set (&prefix_set,
+ STROPHA,
+ STROPHA | AUCTUM,
+ primitive);
+ }
/* check: inclinatum may be prefixed with auctum or deminutum only */
if (prefix_set & INCLINATUM)
- {
- fix_prefix_set (&prefix_set,
- INCLINATUM,
- INCLINATUM | AUCTUM | DEMINUTUM,
- primitive);
- }
+ {
+ fix_prefix_set (&prefix_set,
+ INCLINATUM,
+ INCLINATUM | AUCTUM | DEMINUTUM,
+ primitive);
+ }
/* check: semivocalis (deminutum but not inclinatum) must occur in
- combination with and only with pes or flexa */
+ combination with and only with pes or flexa */
else if (prefix_set & DEMINUTUM)
- {
- fix_prefix_set (&prefix_set,
- DEMINUTUM | PES_OR_FLEXA,
- DEMINUTUM | PES_OR_FLEXA,
- primitive);
- }
+ {
+ fix_prefix_set (&prefix_set,
+ DEMINUTUM | PES_OR_FLEXA,
+ DEMINUTUM | PES_OR_FLEXA,
+ primitive);
+ }
/* check: cavum and linea (either or both) may be applied only
- upon core punctum */
+ upon core punctum */
if (prefix_set & (CAVUM | LINEA))
- {
- fix_prefix_set (&prefix_set,
- 0,
- CAVUM | LINEA,
- primitive);
- }
+ {
+ fix_prefix_set (&prefix_set,
+ 0,
+ CAVUM | LINEA,
+ primitive);
+ }
/* all other combinations should be valid (unless I made a
- mistake) */
+ mistake) */
primitive->set_property ("prefix-set", scm_from_int (prefix_set));
}
int prefix_set = scm_to_int (primitive->get_property ("prefix-set"));
if (prefix_set & PES_OR_FLEXA)
- {
- if (!i) // ligature may not start with 2nd head of pes or flexa
- primitive->warning (_ ("cannot apply `\\~' on first head of ligature"));
- else if (pitch > prev_pitch) // pes
- {
- prev_context_info |= PES_LOWER;
- context_info |= PES_UPPER;
- }
- else if (pitch < prev_pitch) // flexa
- {
- prev_context_info |= FLEXA_LEFT;
- context_info |= FLEXA_RIGHT;
- }
- else // (pitch == prev_pitch)
- primitive->warning (_ ("cannot apply `\\~' on heads with identical pitch"));
- }
+ {
+ if (!i) // ligature may not start with 2nd head of pes or flexa
+ primitive->warning (_ ("cannot apply `\\~' on first head of ligature"));
+ else if (pitch > prev_pitch) // pes
+ {
+ prev_context_info |= PES_LOWER;
+ context_info |= PES_UPPER;
+ }
+ else if (pitch < prev_pitch) // flexa
+ {
+ prev_context_info |= FLEXA_LEFT;
+ context_info |= FLEXA_RIGHT;
+ }
+ else // (pitch == prev_pitch)
+ primitive->warning (_ ("cannot apply `\\~' on heads with identical pitch"));
+ }
if (prev_prefix_set & DEMINUTUM)
- context_info |= AFTER_DEMINUTUM;
+ context_info |= AFTER_DEMINUTUM;
if (prev_primitive)
- prev_primitive->set_property ("context-info",
- scm_from_int (prev_context_info));
+ prev_primitive->set_property ("context-info",
+ scm_from_int (prev_context_info));
prev_primitive = primitive;
prev_prefix_set = prefix_set;
prev_context_info = context_info;
}
if (prev_primitive)
prev_primitive->set_property ("context-info",
- scm_from_int (prev_context_info));
+ scm_from_int (prev_context_info));
}
void
Gregorian_ligature_engraver::build_ligature (Spanner *ligature,
- vector<Grob_info> primitives)
+ vector<Grob_info> primitives)
{
// apply style-independent checking and transformation
check_and_fix_all_prefixes (primitives);
if (prefix_set & mask)
{
if (!str->empty ())
- *str += ", ";
+ *str += ", ";
*str += name;
}
}
read by the associated item class, such as VaticanaLigature.--jr
*/
ADD_INTERFACE (Gregorian_ligature,
- "A gregorian ligature.",
+ "A gregorian ligature.",
- /* properties */
- "virga "
- "stropha "
- "inclinatum "
- "auctum "
- "descendens "
- "ascendens "
- "oriscus "
- "quilisma "
- "deminutum "
- "cavum "
- "linea "
- "pes-or-flexa "
- "context-info "
- "prefix-set "
- );
+ /* properties */
+ "virga "
+ "stropha "
+ "inclinatum "
+ "auctum "
+ "descendens "
+ "ascendens "
+ "oriscus "
+ "quilisma "
+ "deminutum "
+ "cavum "
+ "linea "
+ "pes-or-flexa "
+ "context-info "
+ "prefix-set "
+ );
Real staffline = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
- * staffline;
+ * staffline;
iv += -me->relative_coordinate (refp, Y_AXIS);
Stencil st = Lookup::filled_box (Box (Interval (0, thick),
- iv));
+ iv));
return st.smobbed_copy ();
}
Real staffline = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
- * staffline;
+ * staffline;
return ly_interval2scm (Interval (0, thick));
}
}
ADD_INTERFACE (Grid_line_interface,
- "A line that is spanned between grid-points.",
+ "A line that is spanned between grid-points.",
- /* properties */
- "elements "
- "thickness "
- );
+ /* properties */
+ "elements "
+ "thickness "
+ );
ADD_INTERFACE (Grid_point_interface,
- "A spanning point for grid lines.",
+ "A spanning point for grid lines.",
- /* properties */
- ""
- );
+ /* properties */
+ ""
+ );
class Grid_line_span_engraver : public Engraver
{
Item *spanline_;
- vector<Item*> lines_;
+ vector<Item *> lines_;
public:
TRANSLATOR_DECLARATIONS (Grid_line_span_engraver);
lines_.push_back (it);
if (lines_.size () >= 2 && !spanline_)
- {
- spanline_ = make_item ("GridLine", SCM_EOL);
- spanline_->set_parent (lines_[0], X_AXIS);
- }
+ {
+ spanline_ = make_item ("GridLine", SCM_EOL);
+ spanline_->set_parent (lines_[0], X_AXIS);
+ }
}
}
if (spanline_)
{
for (vsize i = 0; i < lines_.size (); i++)
- Grid_line_interface::add_grid_point (spanline_, lines_[i]);
+ Grid_line_interface::add_grid_point (spanline_, lines_[i]);
spanline_ = 0;
}
#include "translator.icc"
ADD_ACKNOWLEDGER (Grid_line_span_engraver, grid_point);
ADD_TRANSLATOR (Grid_line_span_engraver,
- /* doc */
- "This engraver makes cross-staff lines: It catches all normal"
- " lines and draws a single span line across them.",
+ /* doc */
+ "This engraver makes cross-staff lines: It catches all normal"
+ " lines and draws a single span line across them.",
- /* create */
- "GridLine ",
+ /* create */
+ "GridLine ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Moment now = now_mom ();
if (!now.main_part_.mod_rat (mom->main_part_))
- make_item ("GridPoint", SCM_EOL);
+ make_item ("GridPoint", SCM_EOL);
}
}
}
ADD_TRANSLATOR (Grid_point_engraver,
- /* doc */
- "Generate grid points.",
+ /* doc */
+ "Generate grid points.",
- /* create */
- "GridPoint ",
+ /* create */
+ "GridPoint ",
- /* read */
- "gridInterval ",
+ /* read */
+ "gridInterval ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "grob.hh"
LY_DEFINE (ly_grob_array_length, "ly:grob-array-length",
- 1, 0, 0,
- (SCM grob_arr),
- "Return the length of @var{grob-arr}.")
+ 1, 0, 0,
+ (SCM grob_arr),
+ "Return the length of @var{grob-arr}.")
{
LY_ASSERT_SMOB (Grob_array, grob_arr, 1);
Grob_array *me = unsmob_grob_array (grob_arr);
- return scm_from_int (me->size ());
+ return scm_from_int (me->size ());
}
-
LY_DEFINE (ly_grob_array_ref, "ly:grob-array-ref",
- 2, 0, 0,
- (SCM grob_arr, SCM index),
- "Retrieve the @var{index}th element of @var{grob-arr}.")
+ 2, 0, 0,
+ (SCM grob_arr, SCM index),
+ "Retrieve the @var{index}th element of @var{grob-arr}.")
{
Grob_array *me = unsmob_grob_array (grob_arr);
LY_ASSERT_SMOB (Grob_array, grob_arr, 1);
vsize i = scm_to_uint (index);
if (i == VPOS || i >= me->size ())
- scm_out_of_range (NULL, scm_from_unsigned_integer (i));
-
+ scm_out_of_range (NULL, scm_from_unsigned_integer (i));
+
return me->grob (i)->self_scm ();
}
LY_DEFINE (ly_grob_array_2_list, "ly:grob-array->list",
- 1, 0, 0,
- (SCM grob_arr),
- "Return the elements of @var{grob-arr} as a Scheme list.")
+ 1, 0, 0,
+ (SCM grob_arr),
+ "Return the elements of @var{grob-arr} as a Scheme list.")
{
Grob_array *me = unsmob_grob_array (grob_arr);
LY_ASSERT_SMOB (Grob_array, grob_arr, 1);
ordered_ = true;
}
-vector<Grob*> &
+vector<Grob *> &
Grob_array::array_reference ()
{
return grobs_;
}
-vector<Grob*> const &
+vector<Grob *> const &
Grob_array::array () const
{
return grobs_;
}
int
-Grob_array::print_smob (SCM arr, SCM port, scm_print_state*)
+Grob_array::print_smob (SCM arr, SCM port, scm_print_state *)
{
scm_puts ("#<Grob_array", port);
Grob_array::remove_duplicates ()
{
assert (!ordered_);
-
- vector_sort (grobs_, less<Grob*> ());
+
+ vector_sort (grobs_, less<Grob *> ());
::uniq (grobs_);
}
}
void
-Grob_array::set_array (vector<Grob*> const &src)
+Grob_array::set_array (vector<Grob *> const &src)
{
grobs_ = src;
}
axis_offset_symbol (Axis a)
{
return a == X_AXIS
- ? ly_symbol2scm ("X-offset")
- : ly_symbol2scm ("Y-offset");
+ ? ly_symbol2scm ("X-offset")
+ : ly_symbol2scm ("Y-offset");
}
SCM
axis_parent_positioning (Axis a)
{
return (a == X_AXIS)
- ? Grob::x_parent_positioning_proc
- : Grob::y_parent_positioning_proc;
+ ? Grob::x_parent_positioning_proc
+ : Grob::y_parent_positioning_proc;
}
-
-
/*
Replace
by
(+ (PROC GROB) (orig-proc GROB))
-
*/
void
add_offset_callback (Grob *g, SCM proc, Axis a)
&& !is_simple_closure (data))
{
g->set_property (axis_offset_symbol (a), proc);
- return ;
+ return;
}
if (ly_is_procedure (data))
- data = ly_make_simple_closure (scm_list_1 (data));
+ data = ly_make_simple_closure (scm_list_1 (data));
else if (is_simple_closure (data))
data = simple_closure_expression (data);
if (ly_is_procedure (proc))
proc = ly_make_simple_closure (scm_list_1 (proc));
-
+
SCM expr = scm_list_3 (plus, proc, data);
g->set_property (axis_offset_symbol (a), ly_make_simple_closure (expr));
}
-
/*
replace
by
- (PROC GROB (orig-proc GROB))
-
+ (PROC GROB (orig-proc GROB))
*/
void
chain_callback (Grob *g, SCM proc, SCM sym)
SCM data = g->get_property_data (sym);
if (ly_is_procedure (data))
- data = ly_make_simple_closure (scm_list_1 (data));
+ data = ly_make_simple_closure (scm_list_1 (data));
else if (is_simple_closure (data))
data = simple_closure_expression (data);
else
SCM expr = scm_list_2 (proc, data);
g->set_property (sym,
-
- // twice: one as a wrapper for grob property routines,
- // once for the actual delayed binding.
- ly_make_simple_closure (ly_make_simple_closure (expr)));
+
+ // twice: one as a wrapper for grob property routines,
+ // once for the actual delayed binding.
+ ly_make_simple_closure (ly_make_simple_closure (expr)));
}
void
return unsmob_stream_event (cause);
}
-vector<Context*>
+vector<Context *>
Grob_info::origin_contexts (Translator *end) const
{
Context *t = origin_trans_->context ();
- vector<Context*> r;
+ vector<Context *> r;
do
{
r.push_back (t);
all_ifaces = tab;
scm_permanent_object (tab);
}
-
+
SCM entry = scm_list_n (a, b, c, SCM_UNDEFINED);
scm_hashq_set_x (all_ifaces, a, entry);
}
LY_DEFINE (ly_add_interface, "ly:add-interface",
- 3, 0, 0, (SCM iface, SCM desc, SCM props),
- "Add a new grob interface. @var{iface} is the"
- " interface name, @var{desc} is the interface"
- " description, and @var{props} is the list of"
- " user-settable properties for the interface.")
+ 3, 0, 0, (SCM iface, SCM desc, SCM props),
+ "Add a new grob interface. @var{iface} is the"
+ " interface name, @var{desc} is the interface"
+ " description, and @var{props} is the list of"
+ " user-settable properties for the interface.")
{
LY_ASSERT_TYPE (ly_is_symbol, iface, 1);
LY_ASSERT_TYPE (scm_is_string, desc, 2);
}
LY_DEFINE (ly_all_grob_interfaces, "ly:all-grob-interfaces",
- 0, 0, 0, (),
- "Return the hash table with all grob interface descriptions.")
+ 0, 0, 0, (),
+ "Return the hash table with all grob interface descriptions.")
{
return all_ifaces;
}
#include "misc.hh"
SCM add_interface (char const *cxx_name,
- char const *descr,
- char const *vars)
+ char const *descr,
+ char const *vars)
{
string suffix ("-interface");
string lispy_name = camel_case_to_lisp_identifier (cxx_name);
if (sym == ly_symbol2scm ("meta"))
{
/*
- otherwise we get in a nasty recursion loop.
+ otherwise we get in a nasty recursion loop.
*/
return;
}
{
SCM iface = scm_hashq_ref (all_ifaces, scm_car (ifs), SCM_BOOL_F);
if (iface == SCM_BOOL_F)
- {
- string msg = to_string (_f ("Unknown interface `%s'",
- ly_symbol2string (scm_car (ifs)).c_str ()));
- programming_error (msg);
- continue;
- }
+ {
+ string msg = to_string (_f ("Unknown interface `%s'",
+ ly_symbol2string (scm_car (ifs)).c_str ()));
+ programming_error (msg);
+ continue;
+ }
found = found || (scm_c_memq (sym, scm_caddr (iface)) != SCM_BOOL_F);
}
if (!found)
{
string str = to_string (_f ("Grob `%s' has no interface for property `%s'",
- me->name ().c_str (),
- ly_symbol2string (sym).c_str ()));
+ me->name ().c_str (),
+ ly_symbol2string (sym).c_str ()));
programming_error (str);
}
}
};
bool
-operator< (Grob_pq_entry const &a, Grob_pq_entry const &b)
+operator < (Grob_pq_entry const &a, Grob_pq_entry const &b)
{
return a.end_ < b.end_;
}
void start_translation_timestep ();
void stop_translation_timestep ();
void process_acknowledged ();
-
+
vector<Grob_pq_entry> started_now_;
};
}
LY_DEFINE (ly_grob_pq_less_p, "ly:grob-pq<?",
- 2, 0, 0, (SCM a, SCM b),
- "Compare two grob priority queue entries."
- " This is an internal function.")
+ 2, 0, 0, (SCM a, SCM b),
+ "Compare two grob priority queue entries."
+ " This is an internal function.")
{
if (Moment::compare (*unsmob_moment (scm_car (a)),
- *unsmob_moment (scm_car (b))) < 0)
+ *unsmob_moment (scm_car (b))) < 0)
return SCM_BOOL_T;
else
return SCM_BOOL_F;
Moment l = get_event_length (ev, n);
if (!l.to_bool ())
- return;
+ return;
Moment end = n + l;
for (vsize i = 0; i < started_now_.size (); i++)
{
*tail = scm_acons (started_now_[i].end_.smobbed_copy (),
- started_now_[i].grob_->self_scm (),
- SCM_EOL);
+ started_now_[i].grob_->self_scm (),
+ SCM_EOL);
tail = SCM_CDRLOC (*tail);
}
while (scm_is_pair (busy) && *unsmob_moment (scm_caar (busy)) < now)
{
/*
- The grob-pq-engraver is not water tight, and stuff like
- tupletSpannerDuration confuses it.
+ The grob-pq-engraver is not water tight, and stuff like
+ tupletSpannerDuration confuses it.
*/
busy = scm_cdr (busy);
}
#include "translator.icc"
ADD_ACKNOWLEDGER (Grob_pq_engraver, grob);
ADD_TRANSLATOR (Grob_pq_engraver,
- /* doc */
- "Administrate when certain grobs (e.g., note heads) stop"
- " playing.",
+ /* doc */
+ "Administrate when certain grobs (e.g., note heads) stop"
+ " playing.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "busyGrobs ",
+ /* read */
+ "busyGrobs ",
- /* write */
- "busyGrobs "
- );
+ /* write */
+ "busyGrobs "
+ );
static SCM modification_callback = SCM_EOL;
static SCM cache_callback = SCM_EOL;
-
/*
-
FIXME: this should use ly:set-option interface instead.
-
*/
LY_DEFINE (ly_set_grob_modification_callback, "ly:set-grob-modification-callback",
- 1, 0, 0, (SCM cb),
- "Specify a procedure that will be called every time LilyPond"
- " modifies a grob property. The callback will receive as"
- " arguments the grob that is being modified, the name of the"
- " C++ file in which the modification was requested, the line"
- " number in the C++ file in which the modification was requested,"
- " the name of the function in which the modification was"
- " requested, the property to be changed, and the new value for"
- " the property.")
+ 1, 0, 0, (SCM cb),
+ "Specify a procedure that will be called every time LilyPond"
+ " modifies a grob property. The callback will receive as"
+ " arguments the grob that is being modified, the name of the"
+ " C++ file in which the modification was requested, the line"
+ " number in the C++ file in which the modification was requested,"
+ " the name of the function in which the modification was"
+ " requested, the property to be changed, and the new value for"
+ " the property.")
{
- modification_callback = (ly_is_procedure (cb)) ? cb : SCM_BOOL_F;
+ modification_callback = (ly_is_procedure (cb)) ? cb : SCM_BOOL_F;
return SCM_UNSPECIFIED;
}
LY_DEFINE (ly_set_property_cache_callback, "ly:set-property-cache-callback",
- 1, 0, 0, (SCM cb),
- "Specify a procedure that will be called whenever lilypond"
- " calculates a callback function and caches the result. The"
- " callback will receive as arguments the grob whose property it"
- " is, the name of the property, the name of the callback that"
- " calculated the property, and the new (cached) value of the"
- " property.")
+ 1, 0, 0, (SCM cb),
+ "Specify a procedure that will be called whenever lilypond"
+ " calculates a callback function and caches the result. The"
+ " callback will receive as arguments the grob whose property it"
+ " is, the name of the property, the name of the callback that"
+ " calculated the property, and the new (cached) value of the"
+ " property.")
{
- cache_callback = (ly_is_procedure (cb)) ? cb : SCM_BOOL_F;
+ cache_callback = (ly_is_procedure (cb)) ? cb : SCM_BOOL_F;
return SCM_UNSPECIFIED;
}
-
void
Grob::instrumented_set_property (SCM sym, SCM v,
- char const *file,
- int line,
- char const *fun)
+ char const *file,
+ int line,
+ char const *fun)
{
#ifndef NDEBUG
if (ly_is_procedure (modification_callback))
scm_apply_0 (modification_callback,
- scm_list_n (self_scm (),
- scm_from_locale_string (file),
- scm_from_int (line),
- scm_from_locale_string (fun),
- sym, v, SCM_UNDEFINED));
+ scm_list_n (self_scm (),
+ scm_from_locale_string (file),
+ scm_from_int (line),
+ scm_from_locale_string (fun),
+ sym, v, SCM_UNDEFINED));
#else
(void) file;
(void) line;
(void) fun;
#endif
-
+
internal_set_property (sym, v);
}
Grob::get_property_alist_chain (SCM def) const
{
return scm_list_n (mutable_property_alist_,
- immutable_property_alist_,
- def,
- SCM_UNDEFINED);
+ immutable_property_alist_,
+ def,
+ SCM_UNDEFINED);
}
extern void check_interfaces_for_property (Grob const *me, SCM sym);
Grob::internal_set_property (SCM sym, SCM v)
{
internal_set_value_on_alist (&mutable_property_alist_,
- sym, v);
+ sym, v);
}
if (do_internal_type_checking_global)
{
if (!ly_is_procedure (v)
- && !is_simple_closure (v)
- && v != ly_symbol2scm ("calculation-in-progress"))
- type_check_assignment (sym, v, ly_symbol2scm ("backend-type?"));
+ && !is_simple_closure (v)
+ && v != ly_symbol2scm ("calculation-in-progress"))
+ type_check_assignment (sym, v, ly_symbol2scm ("backend-type?"));
check_interfaces_for_property (this, sym);
}
if (profile_property_accesses)
note_property_access (&grob_property_lookup_table, sym);
#endif
-
+
SCM handle = scm_sloppy_assq (sym, mutable_property_alist_);
if (handle != SCM_BOOL_F)
return scm_cdr (handle);
{
SCM val = scm_cdr (handle);
if (!ly_is_procedure (val) && !is_simple_closure (val))
- type_check_assignment (sym, val, ly_symbol2scm ("backend-type?"));
+ type_check_assignment (sym, val, ly_symbol2scm ("backend-type?"));
check_interfaces_for_property (this, sym);
}
-
+
return (handle == SCM_BOOL_F) ? SCM_EOL : scm_cdr (handle);
}
if (val == ly_symbol2scm ("calculation-in-progress"))
{
programming_error (_f ("cyclic dependency: calculation-in-progress encountered for #'%s (%s)",
- ly_symbol2string (sym).c_str (),
- name ().c_str ()));
+ ly_symbol2string (sym).c_str (),
+ name ().c_str ()));
if (debug_property_callbacks)
- {
- message ("backtrace: ");
- print_property_callback_stack ();
- }
+ {
+ message ("backtrace: ");
+ print_property_callback_stack ();
+ }
}
#endif
-
+
if (ly_is_procedure (val)
|| is_simple_closure (val))
{
- Grob *me = ((Grob*)this);
+ Grob *me = ((Grob *)this);
val = me->try_callback_on_alist (&me->mutable_property_alist_, sym, val);
}
-
+
return val;
}
return call_pure_function (val, scm_list_1 (self_scm ()), start, end);
if (is_simple_closure (val))
return evaluate_with_simple_closure (self_scm (),
- simple_closure_expression (val),
- true, start, end);
+ simple_closure_expression (val),
+ true, start, end);
return val;
}
SCM
Grob::try_callback_on_alist (SCM *alist, SCM sym, SCM proc)
-{
+{
SCM marker = ly_symbol2scm ("calculation-in-progress");
/*
need to put a value in SYM to ensure that we don't get a
else if (is_simple_closure (proc))
{
value = evaluate_with_simple_closure (self_scm (),
- simple_closure_expression (proc),
- false, 0, 0);
+ simple_closure_expression (proc),
+ false, 0, 0);
}
-
+
#ifndef NDEBUG
if (debug_property_callbacks)
grob_property_callback_stack = scm_cdr (grob_property_callback_stack);
#endif
-
+
/*
If the function returns SCM_UNSPECIFIED, we assume the
property has been set with an explicit set_property ()
value = get_property_data (sym);
assert (value == SCM_EOL || value == marker);
if (value == marker)
- *alist = scm_assq_remove_x (*alist, marker);
+ *alist = scm_assq_remove_x (*alist, marker);
}
else
{
#ifndef NDEBUG
if (ly_is_procedure (cache_callback))
- scm_apply_0 (cache_callback,
- scm_list_n (self_scm (),
- sym,
- proc,
- value,
- SCM_UNDEFINED));
+ scm_apply_0 (cache_callback,
+ scm_list_n (self_scm (),
+ sym,
+ proc,
+ value,
+ SCM_UNDEFINED));
#endif
internal_set_value_on_alist (alist, sym, value);
}
-
+
return value;
}
note_property_access (&grob_property_lookup_table, sym);
SCM s = scm_sloppy_assq (sym, object_alist_);
-
+
if (s != SCM_BOOL_F)
{
SCM val = scm_cdr (s);
if (ly_is_procedure (val)
- || is_simple_closure (val))
- {
- Grob *me = ((Grob*)this);
- val = me->try_callback_on_alist (&me->object_alist_, sym, val);
- }
-
+ || is_simple_closure (val))
+ {
+ Grob *me = ((Grob *)this);
+ val = me->try_callback_on_alist (&me->object_alist_, sym, val);
+ }
+
return val;
}
SCM scm_call_pure_function = ly_lily_module_constant ("call-pure-function");
return scm_apply_0 (scm_call_pure_function,
- scm_list_4 (unpure, args, scm_from_int (start), scm_from_int (end)));
+ scm_list_4 (unpure, args, scm_from_int (start), scm_from_int (end)));
}
#include "paper-score.hh"
#include "simple-closure.hh"
#include "system.hh"
-#include "warn.hh" // error ()
+#include "warn.hh" // error ()
LY_DEFINE (ly_grob_property_data, "ly:grob-property-data",
- 2, 0, 0, (SCM grob, SCM sym),
- "Return the value for property @var{sym} of @var{grob},"
- " but do not process callbacks.")
+ 2, 0, 0, (SCM grob, SCM sym),
+ "Return the value for property @var{sym} of @var{grob},"
+ " but do not process callbacks.")
{
Grob *sc = unsmob_grob (grob);
}
LY_DEFINE (ly_grob_set_property_x, "ly:grob-set-property!",
- 3, 0, 0, (SCM grob, SCM sym, SCM val),
- "Set @var{sym} in grob @var{grob} to value @var{val}.")
+ 3, 0, 0, (SCM grob, SCM sym, SCM val),
+ "Set @var{sym} in grob @var{grob} to value @var{val}.")
{
Grob *sc = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
}
LY_DEFINE (ly_grob_set_nested_property_x, "ly:grob-set-nested-property!",
- 3, 0, 0, (SCM grob, SCM symlist, SCM val),
- "Set nested property @var{symlist} in grob @var{grob} to value @var{val}.")
+ 3, 0, 0, (SCM grob, SCM symlist, SCM val),
+ "Set nested property @var{symlist} in grob @var{grob} to value @var{val}.")
{
Grob *sc = unsmob_grob (grob);
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_grob_property, "ly:grob-property",
- 2, 1, 0, (SCM grob, SCM sym, SCM val),
- "Return the value for property @var{sym} of @var{grob}."
- " If no value is found, return @var{val} or @code{'()}"
- " if @var{val} is not specified.")
+ 2, 1, 0, (SCM grob, SCM sym, SCM val),
+ "Return the value for property @var{sym} of @var{grob}."
+ " If no value is found, return @var{val} or @code{'()}"
+ " if @var{val} is not specified.")
{
Grob *sc = unsmob_grob (grob);
SCM retval = sc->internal_get_property (sym);
if (retval == SCM_EOL)
retval = val;
-
+
return retval;
}
-
LY_DEFINE (ly_grob_interfaces, "ly:grob-interfaces",
- 1, 0, 0, (SCM grob),
- "Return the interfaces list of grob @var{grob}.")
+ 1, 0, 0, (SCM grob),
+ "Return the interfaces list of grob @var{grob}.")
{
Grob *sc = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
return sc->interfaces ();
}
LY_DEFINE (ly_grob_object, "ly:grob-object",
- 2, 0, 0, (SCM grob, SCM sym),
- "Return the value of a pointer in grob @var{grob} of property"
- " @var{sym}. It returns @code{'()} (end-of-list) if @var{sym}"
- " is undefined in @var{grob}.")
+ 2, 0, 0, (SCM grob, SCM sym),
+ "Return the value of a pointer in grob @var{grob} of property"
+ " @var{sym}. It returns @code{'()} (end-of-list) if @var{sym}"
+ " is undefined in @var{grob}.")
{
Grob *sc = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
return sc->internal_get_object (sym);
}
-
LY_DEFINE (ly_grob_set_object_x, "ly:grob-set-object!",
- 3, 0, 0, (SCM grob, SCM sym, SCM val),
- "Set @var{sym} in grob @var{grob} to value @var{val}.")
+ 3, 0, 0, (SCM grob, SCM sym, SCM val),
+ "Set @var{sym} in grob @var{grob} to value @var{val}.")
{
Grob *sc = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
/* TODO: make difference between scaled and unscalead variable in
calling (i.e different funcs.) */
LY_DEFINE (ly_grob_layout, "ly:grob-layout",
- 1, 0, 0, (SCM grob),
- "Get @code{\\layout} definition from grob @var{grob}.")
+ 1, 0, 0, (SCM grob),
+ "Get @code{\\layout} definition from grob @var{grob}.")
{
Grob *sc = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
return sc->layout ()->self_scm ();
}
LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain",
- 1, 1, 0, (SCM grob, SCM global),
- "Get an alist chain for grob @var{grob}, with @var{global} as"
- " the global default. If unspecified, @code{font-defaults}"
- " from the layout block is taken.")
+ 1, 1, 0, (SCM grob, SCM global),
+ "Get an alist chain for grob @var{grob}, with @var{global} as"
+ " the global default. If unspecified, @code{font-defaults}"
+ " from the layout block is taken.")
{
Grob *sc = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
if (global == SCM_UNDEFINED)
{
global = sc->layout ()->lookup_variable (ly_symbol2scm ("font-defaults"));
if (global == SCM_UNDEFINED)
- global = SCM_EOL;
+ global = SCM_EOL;
}
return sc->get_property_alist_chain (global);
}
LY_DEFINE (ly_grob_extent, "ly:grob-extent",
- 3, 0, 0, (SCM grob, SCM refp, SCM axis),
- "Get the extent in @var{axis} direction of @var{grob} relative to"
- " the grob @var{refp}.")
+ 3, 0, 0, (SCM grob, SCM refp, SCM axis),
+ "Get the extent in @var{axis} direction of @var{grob} relative to"
+ " the grob @var{refp}.")
{
Grob *sc = unsmob_grob (grob);
Grob *ref = unsmob_grob (refp);
-
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_SMOB (Grob, refp, 2);
LY_ASSERT_TYPE (is_axis, axis, 3);
Axis a = Axis (scm_to_int (axis));
-
if (ref->common_refpoint (sc, a) != ref)
{
// ugh. should use other error message
}
LY_DEFINE (ly_grob_robust_relative_extent, "ly:grob-robust-relative-extent",
- 3, 0, 0, (SCM grob, SCM refp, SCM axis),
- "Get the extent in @var{axis} direction of @var{grob} relative to"
- " the grob @var{refp}, or @code{(0,0)} if empty.")
+ 3, 0, 0, (SCM grob, SCM refp, SCM axis),
+ "Get the extent in @var{axis} direction of @var{grob} relative to"
+ " the grob @var{refp}, or @code{(0,0)} if empty.")
{
Grob *sc = unsmob_grob (grob);
Grob *ref = unsmob_grob (refp);
-
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_SMOB (Grob, refp, 2);
LY_ASSERT_TYPE (is_axis, axis, 3);
Axis a = Axis (scm_to_int (axis));
-
+
if (ref->common_refpoint (sc, a) != ref)
{
// ugh. should use other error message
}
LY_DEFINE (ly_grob_relative_coordinate, "ly:grob-relative-coordinate",
- 3, 0, 0, (SCM grob, SCM refp, SCM axis),
- "Get the coordinate in @var{axis} direction of @var{grob} relative"
- " to the grob @var{refp}.")
+ 3, 0, 0, (SCM grob, SCM refp, SCM axis),
+ "Get the coordinate in @var{axis} direction of @var{grob} relative"
+ " to the grob @var{refp}.")
{
Grob *sc = unsmob_grob (grob);
Grob *ref = unsmob_grob (refp);
-
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_SMOB (Grob, refp, 2);
LY_ASSERT_TYPE (is_axis, axis, 3);
Axis a = Axis (scm_to_int (axis));
-
if (ref->common_refpoint (sc, a) != ref)
{
// ugh. should use other error message
return scm_from_double (sc->relative_coordinate (ref, a));
}
-
LY_DEFINE (ly_grob_parent, "ly:grob-parent",
- 2, 0, 0, (SCM grob, SCM axis),
- "Get the parent of @var{grob}. @var{axis} is 0 for the X-axis,"
- " 1@tie{}for the Y-axis.")
+ 2, 0, 0, (SCM grob, SCM axis),
+ "Get the parent of @var{grob}. @var{axis} is 0 for the X-axis,"
+ " 1@tie{}for the Y-axis.")
{
Grob *sc = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_TYPE (is_axis, axis, 2);
}
LY_DEFINE (ly_grob_set_parent_x, "ly:grob-set-parent!",
- 3, 0, 0, (SCM grob, SCM axis, SCM parent_grob),
- "Set @var{parent-grob} the parent of grob @var{grob} in axis @var{axis}.")
+ 3, 0, 0, (SCM grob, SCM axis, SCM parent_grob),
+ "Set @var{parent-grob} the parent of grob @var{grob} in axis @var{axis}.")
{
Grob *gr = unsmob_grob (grob);
Grob *parent = unsmob_grob (parent_grob);
}
LY_DEFINE (ly_grob_properties, "ly:grob-properties",
- 1, 0, 0, (SCM grob),
- "Get the mutable properties of @var{grob}.")
+ 1, 0, 0, (SCM grob),
+ "Get the mutable properties of @var{grob}.")
{
Grob *g = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
/* FIXME: uhg? copy/read only? */
}
LY_DEFINE (ly_grob_basic_properties, "ly:grob-basic-properties",
- 1, 0, 0, (SCM grob),
- "Get the immutable properties of @var{grob}.")
+ 1, 0, 0, (SCM grob),
+ "Get the immutable properties of @var{grob}.")
{
Grob *g = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
/* FIXME: uhg? copy/read only? */
}
LY_DEFINE (ly_grob_system, "ly:grob-system",
- 1, 0, 0, (SCM grob),
- "Return the system grob of @var{grob}.")
+ 1, 0, 0, (SCM grob),
+ "Return the system grob of @var{grob}.")
{
Grob *me = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
if (System *g = me->get_system ())
}
LY_DEFINE (ly_grob_original, "ly:grob-original",
- 1, 0, 0, (SCM grob),
- "Return the unbroken original grob of @var{grob}.")
+ 1, 0, 0, (SCM grob),
+ "Return the unbroken original grob of @var{grob}.")
{
Grob *me = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
return me->original () ? me->original ()->self_scm () : me->self_scm ();
}
-
LY_DEFINE (ly_grob_suicide_x, "ly:grob-suicide!",
- 1, 0, 0, (SCM grob),
- "Kill @var{grob}.")
+ 1, 0, 0, (SCM grob),
+ "Kill @var{grob}.")
{
Grob *me = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
me->suicide ();
}
LY_DEFINE (ly_grob_translate_axis_x, "ly:grob-translate-axis!",
- 3, 0, 0, (SCM grob, SCM d, SCM a),
- "Translate @var{grob} on axis@tie{}@var{a} over"
- " distance@tie{}@var{d}.")
+ 3, 0, 0, (SCM grob, SCM d, SCM a),
+ "Translate @var{grob} on axis@tie{}@var{a} over"
+ " distance@tie{}@var{d}.")
{
Grob *me = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_TYPE (scm_is_number, d, 2);
LY_ASSERT_TYPE (is_axis, a, 3);
}
LY_DEFINE (ly_grob_default_font, "ly:grob-default-font",
- 1, 0, 0, (SCM grob),
- "Return the default font for grob @var{grob}.")
+ 1, 0, 0, (SCM grob),
+ "Return the default font for grob @var{grob}.")
{
Grob *gr = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
return Font_interface::get_default_font (gr)->self_scm ();
}
-
/*
TODO: consider swapping order, so we can do
(grob-common-refpoint a b c d e)
*/
LY_DEFINE (ly_grob_common_refpoint, "ly:grob-common-refpoint",
- 3, 0, 0, (SCM grob, SCM other, SCM axis),
- "Find the common refpoint of @var{grob} and @var{other}"
- " for @var{axis}.")
+ 3, 0, 0, (SCM grob, SCM other, SCM axis),
+ "Find the common refpoint of @var{grob} and @var{other}"
+ " for @var{axis}.")
{
-
+
Grob *gr = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_SMOB (Grob, other, 2);
LY_ASSERT_TYPE (is_axis, axis, 3);
- Grob *refp = gr->common_refpoint (o, Axis (scm_to_int (axis)));
+ Grob *refp = gr->common_refpoint (o, Axis (scm_to_int (axis)));
return refp ? refp->self_scm () : SCM_BOOL_F;
}
LY_DEFINE (ly_grob_common_refpoint_of_array, "ly:grob-common-refpoint-of-array",
- 3, 0, 0, (SCM grob, SCM others, SCM axis),
- "Find the common refpoint of @var{grob} and @var{others}"
- " (a grob-array) for @var{axis}.")
+ 3, 0, 0, (SCM grob, SCM others, SCM axis),
+ "Find the common refpoint of @var{grob} and @var{others}"
+ " (a grob-array) for @var{axis}.")
{
Grob *gr = unsmob_grob (grob);
-
+
LY_ASSERT_SMOB (Grob, grob, 1);
LY_ASSERT_SMOB (Grob_array, others, 2);
}
LY_DEFINE (ly_grob_chain_callback, "ly:grob-chain-callback",
- 3, 0, 0, (SCM grob, SCM proc, SCM sym),
- "Find the callback that is stored as property"
- " @var{sym} of grob @var{grob} and chain @var{proc}"
- " to the head of this, meaning that it is called"
- " using @var{grob} and the previous callback's result.")
+ 3, 0, 0, (SCM grob, SCM proc, SCM sym),
+ "Find the callback that is stored as property"
+ " @var{sym} of grob @var{grob} and chain @var{proc}"
+ " to the head of this, meaning that it is called"
+ " using @var{grob} and the previous callback's result.")
{
Grob *gr = unsmob_grob (grob);
Grob::mark_smob (SCM ses)
{
ASSERT_LIVE_IS_ALLOWED ();
-
+
Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
scm_gc_mark (s->immutable_property_alist_);
return new Grob (*this);
}
-Grob::Grob (SCM basicprops)
+Grob::Grob (SCM basicprops)
{
-
+
/* FIXME: default should be no callback. */
self_scm_ = SCM_EOL;
layout_ = 0;
immutable_property_alist_ = basicprops;
mutable_property_alist_ = SCM_EOL;
object_alist_ = SCM_EOL;
-
+
/* We do smobify_self () as the first step. Since the object lives
on the heap, none of its SCM variables are protected from
GC. After smobify_self (), they are. */
SCM object_cbs = scm_assq (ly_symbol2scm ("object-callbacks"), meta);
if (scm_is_pair (object_cbs))
- {
- for (SCM s = scm_cdr (object_cbs); scm_is_pair (s); s = scm_cdr (s))
- set_object (scm_caar (s), scm_cdar (s));
- }
+ {
+ for (SCM s = scm_cdr (object_cbs); scm_is_pair (s); s = scm_cdr (s))
+ set_object (scm_caar (s), scm_cdar (s));
+ }
}
-
+
if (get_property_data ("X-extent") == SCM_EOL)
set_property ("X-extent", Grob::stencil_width_proc);
if (get_property_data ("Y-extent") == SCM_EOL)
bool transparent = to_boolean (get_property ("transparent"));
if (transparent)
- retval = Stencil (m->extent_box (), SCM_EOL);
+ retval = Stencil (m->extent_box (), SCM_EOL);
else
- {
- SCM expr = m->expr ();
- expr = scm_list_3 (ly_symbol2scm ("grob-cause"),
- self_scm (), expr);
+ {
+ SCM expr = m->expr ();
+ expr = scm_list_3 (ly_symbol2scm ("grob-cause"),
+ self_scm (), expr);
- retval = Stencil (m->extent_box (), expr);
- }
+ retval = Stencil (m->extent_box (), expr);
+ }
SCM rot = get_property ("rotation");
if (scm_is_pair (rot))
- {
- Real angle = scm_to_double (scm_car (rot));
- Real x = scm_to_double (scm_cadr (rot));
- Real y = scm_to_double (scm_caddr (rot));
+ {
+ Real angle = scm_to_double (scm_car (rot));
+ Real x = scm_to_double (scm_cadr (rot));
+ Real y = scm_to_double (scm_caddr (rot));
- retval.rotate_degrees (angle, Offset (x, y));
- }
+ retval.rotate_degrees (angle, Offset (x, y));
+ }
/* color support... see interpret_stencil_expression () for more... */
SCM color = get_property ("color");
if (scm_is_pair (color))
- {
- SCM expr = scm_list_3 (ly_symbol2scm ("color"),
- color,
- retval.expr ());
+ {
+ SCM expr = scm_list_3 (ly_symbol2scm ("color"),
+ color,
+ retval.expr ());
- retval = Stencil (retval.extent_box (), expr);
- }
+ retval = Stencil (retval.extent_box (), expr);
+ }
/* process whiteout */
/* a grob has to be visible, otherwise the whiteout property has no effect */
/* to add a round-filled-box stencil to the stencil list */
retval
= *unsmob_stencil (scm_call_1 (ly_lily_module_constant ("stencil-whiteout"),
- retval.smobbed_copy()));
+ retval.smobbed_copy ()));
}
}
one system in the whole score and we can find it just by following
parent pointers. */
System *
-Grob::get_system(Grob *me)
+Grob::get_system (Grob *me)
{
Grob *p = me->get_parent (X_AXIS);
return p ? get_system (p) : dynamic_cast<System *>(me);
properties, and a special function fixes FOO */
{
for (SCM s = object_alist_; scm_is_pair (s); s = scm_cdr (s))
- sp->substitute_one_mutable_property (scm_caar (s), scm_cdar (s));
+ sp->substitute_one_mutable_property (scm_caar (s), scm_cdar (s));
}
System *system = get_system ();
{
Item *it = dynamic_cast<Item *> (this);
substitute_object_links (scm_from_int (it->break_status_dir ()),
- original ()->object_alist_);
+ original ()->object_alist_);
}
}
if (isinf (y) || isnan (y))
{
programming_error (_ ("Infinity or NaN encountered"));
- return ;
+ return;
}
-
+
if (!dim_cache_[a].offset_)
dim_cache_[a].offset_ = new Real (y);
else
- *dim_cache_[a].offset_ += y;
+ *dim_cache_[a].offset_ += y;
}
/* Find the offset relative to D. If D equals THIS, then it is 0.
Real off = get_offset (a);
if (refp == dim_cache_[a].parent_)
return off;
-
+
off += dim_cache_[a].parent_->relative_coordinate (refp, a);
return off;
if (dim_cache_[Y_AXIS].offset_)
{
if (to_boolean (get_property ("pure-Y-offset-in-progress")))
- programming_error ("cyclic chain in pure-Y-offset callbacks");
+ programming_error ("cyclic chain in pure-Y-offset callbacks");
off = *dim_cache_[Y_AXIS].offset_;
}
dim_cache_[Y_AXIS].offset_ = new Real (0.0);
set_property ("pure-Y-offset-in-progress", SCM_BOOL_T);
off = robust_scm2double (call_pure_function (proc,
- scm_list_1 (self_scm ()),
- start, end),
- 0.0);
+ scm_list_1 (self_scm ()),
+ start, end),
+ 0.0);
del_property ("pure-Y-offset-in-progress");
delete dim_cache_[Y_AXIS].offset_;
dim_cache_[Y_AXIS].offset_ = 0;
{
Real trans = 0;
if (Align_interface::has_interface (p) && !dim_cache_[Y_AXIS].offset_)
- trans = Align_interface::get_pure_child_y_translation (p, this, start, end);
+ trans = Align_interface::get_pure_child_y_translation (p, this, start, end);
return off + trans + p->pure_relative_y_coordinate (refp, start, end);
}
if (pure && a != Y_AXIS)
programming_error ("tried to get pure X-offset");
return (pure && a == Y_AXIS) ? pure_relative_y_coordinate (refp, start, end)
- : relative_coordinate (refp, a);
+ : relative_coordinate (refp, a);
}
/****************************************************************
if (dim_cache_[axis].extent_)
{
/*
- Ugh, this is not accurate; will flush property, causing
- callback to be called if.
+ Ugh, this is not accurate; will flush property, causing
+ callback to be called if.
*/
del_property ((axis == X_AXIS) ? ly_symbol2scm ("X-extent") : ly_symbol2scm ("Y-extent"));
delete dim_cache_[axis].extent_;
dim_cache_[axis].extent_ = 0;
if (get_parent (axis))
- get_parent (axis)->flush_extent_cache (axis);
+ get_parent (axis)->flush_extent_cache (axis);
}
}
-
Interval
Grob::extent (Grob *refp, Axis a) const
{
else
{
/*
- Order is significant: ?-extent may trigger suicide.
+ Order is significant: ?-extent may trigger suicide.
*/
- SCM ext_sym =
- (a == X_AXIS)
- ? ly_symbol2scm ("X-extent")
- : ly_symbol2scm ("Y-extent");
-
+ SCM ext_sym
+ = (a == X_AXIS)
+ ? ly_symbol2scm ("X-extent")
+ : ly_symbol2scm ("Y-extent");
+
SCM ext = internal_get_property (ext_sym);
if (is_number_pair (ext))
- real_ext.unite (ly_scm2interval (ext));
+ real_ext.unite (ly_scm2interval (ext));
- SCM min_ext_sym =
- (a == X_AXIS)
- ? ly_symbol2scm ("minimum-X-extent")
- : ly_symbol2scm ("minimum-Y-extent");
+ SCM min_ext_sym
+ = (a == X_AXIS)
+ ? ly_symbol2scm ("minimum-X-extent")
+ : ly_symbol2scm ("minimum-Y-extent");
SCM min_ext = internal_get_property (min_ext_sym);
if (is_number_pair (min_ext))
- real_ext.unite (ly_scm2interval (min_ext));
+ real_ext.unite (ly_scm2interval (min_ext));
- ((Grob*)this)->dim_cache_[a].extent_ = new Interval (real_ext);
+ ((Grob *)this)->dim_cache_[a].extent_ = new Interval (real_ext);
}
-
+
real_ext.translate (offset);
-
+
return real_ext;
}
for (Grob const *c = this; c; c = c->dim_cache_[a].parent_)
for (Grob const *d = s; d; d = d->dim_cache_[a].parent_)
if (d == c)
- return (Grob *) d;
+ return (Grob *) d;
return 0;
}
return dim_cache_[a].parent_;
}
-
void
Grob::fixup_refpoint ()
{
Grob *parent = get_parent (ax);
if (!parent)
- continue;
+ continue;
if (parent->get_system () != get_system () && get_system ())
- {
- Grob *newparent = parent->find_broken_piece (get_system ());
- set_parent (newparent, ax);
- }
+ {
+ Grob *newparent = parent->find_broken_piece (get_system ());
+ set_parent (newparent, ax);
+ }
if (Item *i = dynamic_cast<Item *> (this))
- {
- Item *parenti = dynamic_cast<Item *> (parent);
-
- if (parenti && i)
- {
- Direction my_dir = i->break_status_dir ();
- if (my_dir != parenti->break_status_dir ())
- {
- Item *newparent = parenti->find_prebroken_piece (my_dir);
- set_parent (newparent, ax);
- }
- }
- }
+ {
+ Item *parenti = dynamic_cast<Item *> (parent);
+
+ if (parenti && i)
+ {
+ Direction my_dir = i->break_status_dir ();
+ if (my_dir != parenti->break_status_dir ())
+ {
+ Item *newparent = parenti->find_prebroken_piece (my_dir);
+ set_parent (newparent, ax);
+ }
+ }
+ }
}
}
-
/****************************************************************
MESSAGES
****************************************************************/
::warning (s);
}
-
string
Grob::name () const
{
::message (s);
}
-
ADD_INTERFACE (Grob,
- "A grob represents a piece of music notation.\n"
- "\n"
- "All grobs have an X and Y@tie{}position on the page. These"
- " X and Y@tie{}positions are stored in a relative format, thus"
- " they can easily be combined by stacking them, hanging one"
- " grob to the side of another, or coupling them into grouping"
- " objects.\n"
- "\n"
- "Each grob has a reference point (a.k.a.@: parent): The"
- " position of a grob is stored relative to that reference"
- " point. For example, the X@tie{}reference point of a staccato"
- " dot usually is the note head that it applies to. When the"
- " note head is moved, the staccato dot moves along"
- " automatically.\n"
- "\n"
- "A grob is often associated with a symbol, but some grobs do"
- " not print any symbols. They take care of grouping objects."
- " For example, there is a separate grob that stacks staves"
- " vertically. The @ref{NoteCollision} object is also an"
- " abstract grob: It only moves around chords, but doesn't print"
- " anything.\n"
- "\n"
- "Grobs have properties (Scheme variables) that can be read and"
- " set. Two types of them exist: immutable and mutable."
- " Immutable variables define the default style and behavior."
- " They are shared between many objects. They can be changed"
- " using @code{\\override} and @code{\\revert}. Mutable"
- " properties are variables that are specific to one grob."
- " Typically, lists of other objects, or results from"
- " computations are stored in mutable properties. In"
- " particular, every call to @code{ly:grob-set-property!}"
- " (or its C++ equivalent) sets a mutable property.\n"
- "\n"
- "The properties @code{after-line-breaking} and"
- " @code{before-line-breaking} are dummies that are not"
- " user-serviceable.",
-
- /* properties */
- "X-extent "
- "X-offset "
- "Y-extent "
- "Y-offset "
- "after-line-breaking "
- "avoid-slur "
- "axis-group-parent-X "
- "axis-group-parent-Y "
- "before-line-breaking "
- "cause "
- "color "
- "cross-staff "
- "extra-X-extent "
- "extra-Y-extent "
- "extra-offset "
- "interfaces "
- "layer "
- "meta "
- "minimum-X-extent "
- "minimum-Y-extent "
- "outside-staff-horizontal-padding "
- "outside-staff-padding "
- "outside-staff-priority "
- "pure-Y-offset-in-progress "
- "rotation "
- "springs-and-rods "
- "staff-symbol "
- "stencil "
- "transparent "
- "whiteout "
- );
+ "A grob represents a piece of music notation.\n"
+ "\n"
+ "All grobs have an X and Y@tie{}position on the page. These"
+ " X and Y@tie{}positions are stored in a relative format, thus"
+ " they can easily be combined by stacking them, hanging one"
+ " grob to the side of another, or coupling them into grouping"
+ " objects.\n"
+ "\n"
+ "Each grob has a reference point (a.k.a.@: parent): The"
+ " position of a grob is stored relative to that reference"
+ " point. For example, the X@tie{}reference point of a staccato"
+ " dot usually is the note head that it applies to. When the"
+ " note head is moved, the staccato dot moves along"
+ " automatically.\n"
+ "\n"
+ "A grob is often associated with a symbol, but some grobs do"
+ " not print any symbols. They take care of grouping objects."
+ " For example, there is a separate grob that stacks staves"
+ " vertically. The @ref{NoteCollision} object is also an"
+ " abstract grob: It only moves around chords, but doesn't print"
+ " anything.\n"
+ "\n"
+ "Grobs have properties (Scheme variables) that can be read and"
+ " set. Two types of them exist: immutable and mutable."
+ " Immutable variables define the default style and behavior."
+ " They are shared between many objects. They can be changed"
+ " using @code{\\override} and @code{\\revert}. Mutable"
+ " properties are variables that are specific to one grob."
+ " Typically, lists of other objects, or results from"
+ " computations are stored in mutable properties. In"
+ " particular, every call to @code{ly:grob-set-property!}"
+ " (or its C++ equivalent) sets a mutable property.\n"
+ "\n"
+ "The properties @code{after-line-breaking} and"
+ " @code{before-line-breaking} are dummies that are not"
+ " user-serviceable.",
+
+ /* properties */
+ "X-extent "
+ "X-offset "
+ "Y-extent "
+ "Y-offset "
+ "after-line-breaking "
+ "avoid-slur "
+ "axis-group-parent-X "
+ "axis-group-parent-Y "
+ "before-line-breaking "
+ "cause "
+ "color "
+ "cross-staff "
+ "extra-X-extent "
+ "extra-Y-extent "
+ "extra-offset "
+ "interfaces "
+ "layer "
+ "meta "
+ "minimum-X-extent "
+ "minimum-Y-extent "
+ "outside-staff-horizontal-padding "
+ "outside-staff-padding "
+ "outside-staff-priority "
+ "pure-Y-offset-in-progress "
+ "rotation "
+ "springs-and-rods "
+ "staff-symbol "
+ "stencil "
+ "transparent "
+ "whiteout "
+ );
/****************************************************************
CALLBACKS
return ly_interval2scm (e);
}
-
MAKE_SCHEME_CALLBACK (Grob, stencil_height, 1);
SCM
Grob::stencil_height (SCM smob)
return scm_from_double (0.0);
}
-
MAKE_SCHEME_CALLBACK (Grob, x_parent_positioning, 1);
SCM
Grob::x_parent_positioning (SCM smob)
{
Grob *me = unsmob_grob (smob);
-
+
Grob *par = me->get_parent (X_AXIS);
if (par)
(void) par->get_property ("positioning-done");
return grob_stencil_extent (me, X_AXIS);
}
-
Grob *
common_refpoint_of_list (SCM elist, Grob *common, Axis a)
{
for (; scm_is_pair (elist); elist = scm_cdr (elist))
if (Grob *s = unsmob_grob (scm_car (elist)))
{
- if (common)
- common = common->common_refpoint (s, a);
- else
- common = s;
+ if (common)
+ common = common->common_refpoint (s, a);
+ else
+ common = s;
}
return common;
}
Grob *
-common_refpoint_of_array (vector<Grob*> const &arr, Grob *common, Axis a)
+common_refpoint_of_array (vector<Grob *> const &arr, Grob *common, Axis a)
{
for (vsize i = 0; i < arr.size (); i++)
if (common)
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2006--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "lily-guile.hh"
-#include "main.hh"
-#include "warn.hh"
+#include "lily-guile.hh"
+#include "main.hh"
+#include "warn.hh"
/*
INIT
*/
-
typedef void (*Void_fptr) ();
vector<Void_fptr> *scm_init_funcs_;
{
progress_indication ("[");
scm_display (scm_c_eval_string ("(%search-load-path \"lily.scm\")"),
- scm_current_error_port ());
+ scm_current_error_port ());
progress_indication ("]\n");
}
{
Grob *me = unsmob_grob (smob);
Real height = robust_scm2double (me->get_property ("height"), 0.0)
- * Staff_symbol_referencer::staff_space (me);
+ * Staff_symbol_referencer::staff_space (me);
Real thickness = robust_scm2double (me->get_property ("thickness"), 1)
- * Staff_symbol_referencer::line_thickness (me);
+ * Staff_symbol_referencer::line_thickness (me);
height += thickness / 2;
return ly_interval2scm (Interval (-height, height));
Spanner *next = me->broken_neighbor (RIGHT);
Stencil *s = next->get_stencil ();
if (!s || s->is_empty ())
- broken[RIGHT] = false;
+ broken[RIGHT] = false;
}
Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS);
*/
bool circled_tip = ly_scm2bool (me->get_property ("circled-tip"));
Real height = robust_scm2double (me->get_property ("height"), 0.2)
- * Staff_symbol_referencer::staff_space (me);
+ * Staff_symbol_referencer::staff_space (me);
/*
FIXME: 0.525 is still just a guess...
*/
Real thick = 1.0;
if (circled_tip)
thick = robust_scm2double (me->get_property ("thickness"), 1.0)
- * Staff_symbol_referencer::line_thickness (me);
+ * Staff_symbol_referencer::line_thickness (me);
do
{
Item *b = bounds[d];
x_points[d] = b->relative_coordinate (common, X_AXIS);
if (broken [d])
- {
- if (d == LEFT)
- x_points[d] = b->extent (common, X_AXIS)[RIGHT];
- }
+ {
+ if (d == LEFT)
+ x_points[d] = b->extent (common, X_AXIS)[RIGHT];
+ }
else
- {
- if (Text_interface::has_interface (b))
- {
- Interval e = b->extent (common, X_AXIS);
- if (!e.is_empty ())
- x_points[d] = e[-d] - d * padding;
- }
- else
- {
- bool neighbor_found = false;
- Spanner *adjacent;
- extract_grob_set (me, "adjacent-spanners", neighbors);
- for (vsize i = 0; i < neighbors.size (); i++)
- {
- /*
- FIXME: this will fuck up in case of polyphonic
- notes in other voices. Need to look at note-columns
- in the current staff/voice.
- */
- adjacent = dynamic_cast<Spanner *> (neighbors[i]);
- if (adjacent
- && (adjacent->get_bound (-d)->get_column ()
- == b->get_column ()))
- {
- neighbor_found = true;
- break;
- }
- }
+ {
+ if (Text_interface::has_interface (b))
+ {
+ Interval e = b->extent (common, X_AXIS);
+ if (!e.is_empty ())
+ x_points[d] = e[-d] - d * padding;
+ }
+ else
+ {
+ bool neighbor_found = false;
+ Spanner *adjacent;
+ extract_grob_set (me, "adjacent-spanners", neighbors);
+ for (vsize i = 0; i < neighbors.size (); i++)
+ {
+ /*
+ FIXME: this will fuck up in case of polyphonic
+ notes in other voices. Need to look at note-columns
+ in the current staff/voice.
+ */
+ adjacent = dynamic_cast<Spanner *> (neighbors[i]);
+ if (adjacent
+ && (adjacent->get_bound (-d)->get_column ()
+ == b->get_column ()))
+ {
+ neighbor_found = true;
+ break;
+ }
+ }
- Interval e = robust_relative_extent (b, common, X_AXIS);
- if (neighbor_found)
- {
- if (Hairpin::has_interface (adjacent))
- {
- /*
- Handle back-to-back hairpins with a circle in the middle
- */
- if (circled_tip && (grow_dir != d))
- x_points[d] = e.center () + d * (rad - thick / 2.0);
- /*
- If we're hung on a paper column, that means we're not
- adjacent to a text-dynamic, and we may move closer. We
- make the padding a little smaller, here.
- */
- else
- x_points[d] = e.center () - d * padding / 3;
- }
- // Our neighbor is a dynamic text spanner, so add the
- // same amount of padding as for text dynamics
- else
- x_points[d] = e[-d] - d * padding;
- }
- else
- {
- if (Note_column::has_interface (b)
- && Note_column::has_rests (b))
- x_points[d] = e[-d];
- else
- x_points[d] = e[d];
+ Interval e = robust_relative_extent (b, common, X_AXIS);
+ if (neighbor_found)
+ {
+ if (Hairpin::has_interface (adjacent))
+ {
+ /*
+ Handle back-to-back hairpins with a circle in the middle
+ */
+ if (circled_tip && (grow_dir != d))
+ x_points[d] = e.center () + d * (rad - thick / 2.0);
+ /*
+ If we're hung on a paper column, that means we're not
+ adjacent to a text-dynamic, and we may move closer. We
+ make the padding a little smaller, here.
+ */
+ else
+ x_points[d] = e.center () - d * padding / 3;
+ }
+ // Our neighbor is a dynamic text spanner, so add the
+ // same amount of padding as for text dynamics
+ else
+ x_points[d] = e[-d] - d * padding;
+ }
+ else
+ {
+ if (Note_column::has_interface (b)
+ && Note_column::has_rests (b))
+ x_points[d] = e[-d];
+ else
+ x_points[d] = e[d];
- Item *bound = me->get_bound (d);
- if (bound->is_non_musical (bound))
- x_points[d] -= d * padding;
- }
- }
- }
+ Item *bound = me->get_bound (d);
+ if (bound->is_non_musical (bound))
+ x_points[d] -= d * padding;
+ }
+ }
+ }
}
while (flip (&d) != LEFT);
if (width < 0)
{
me->warning (_ ((grow_dir < 0) ? "decrescendo too small"
- : "crescendo too small"));
+ : "crescendo too small"));
width = 0;
}
if (circled_tip && !broken[tip_dir])
{
if (grow_dir > 0)
- x = rad * 2.0;
+ x = rad * 2.0;
else if (grow_dir < 0)
- width -= rad *2.0;
+ width -= rad * 2.0;
}
mol = Line_interface::line (me, Offset (x, starth), Offset (width, endh));
mol.add_stencil (Line_interface::line (me,
- Offset (x, -starth),
- Offset (width, -endh)));
+ Offset (x, -starth),
+ Offset (width, -endh)));
/*
Support al/del niente notation by putting a circle at the
/* Hmmm, perhaps we should have a Lookup::circle () method? */
Stencil circle (extent,
- scm_list_4 (ly_symbol2scm ("circle"),
- scm_from_double (rad),
- scm_from_double (thick),
- SCM_BOOL_F));
+ scm_list_4 (ly_symbol2scm ("circle"),
+ scm_from_double (rad),
+ scm_from_double (thick),
+ SCM_BOOL_F));
/*
- don't add another circle if the hairpin is broken
+ don't add another circle if the hairpin is broken
*/
if (!broken[tip_dir])
- mol.add_at_edge (X_AXIS, tip_dir, Stencil (circle), 0);
+ mol.add_at_edge (X_AXIS, tip_dir, Stencil (circle), 0);
}
mol.translate_axis (x_points[LEFT]
- - bounds[LEFT]->relative_coordinate (common, X_AXIS),
- X_AXIS);
+ - bounds[LEFT]->relative_coordinate (common, X_AXIS),
+ X_AXIS);
return mol.smobbed_copy ();
}
ADD_INTERFACE (Hairpin,
- "A hairpin crescendo or decrescendo.",
+ "A hairpin crescendo or decrescendo.",
- /* properties */
- "adjacent-spanners "
- "circled-tip "
- "bound-padding "
- "grow-direction "
- "height "
- );
+ /* properties */
+ "adjacent-spanners "
+ "circled-tip "
+ "bound-padding "
+ "grow-direction "
+ "height "
+ );
#include "translator.icc"
/*
- TODO: fold together with axis_group_engraver?
+ TODO: fold together with axis_group_engraver?
*/
class Hara_kiri_engraver : public Axis_group_engraver
TRANSLATOR_DECLARATIONS (Hara_kiri_engraver);
};
-
Hara_kiri_engraver::Hara_kiri_engraver ()
{
interesting_ = SCM_EOL;
if (staffline_)
{
for (SCM s = interesting_; scm_is_pair (s); s = scm_cdr (s))
- {
- if (i.grob ()->internal_has_interface (scm_car (s)))
- Hara_kiri_group_spanner::add_interesting_item (staffline_, i.grob ());
- }
+ {
+ if (i.grob ()->internal_has_interface (scm_car (s)))
+ Hara_kiri_group_spanner::add_interesting_item (staffline_, i.grob ());
+ }
}
}
-
ADD_ACKNOWLEDGER (Hara_kiri_engraver, grob);
ADD_TRANSLATOR (Hara_kiri_engraver,
- /* doc */
- "Like @code{Axis_group_engraver}, but make a hara-kiri"
- " spanner, and add interesting items (i.e., note heads, lyric"
- " syllables, and normal rests).",
+ /* doc */
+ "Like @code{Axis_group_engraver}, but make a hara-kiri"
+ " spanner, and add interesting items (i.e., note heads, lyric"
+ " syllables, and normal rests).",
- /* create */
- "VerticalAxisGroup ",
+ /* create */
+ "VerticalAxisGroup ",
- /* read */
- "keepAliveInterfaces ",
+ /* read */
+ "keepAliveInterfaces ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
if (val >= min && val <= max)
return true;
else if (val < min)
- return find_in_range (vector, mid+1, hi, min, max);
+ return find_in_range (vector, mid + 1, hi, min, max);
return find_in_range (vector, low, mid, min, max);
}
{
int len = scm_c_vector_length (important);
if (find_in_range (important, 0, len, start, end))
- return false;
+ return false;
}
else /* build the important-columns-cache */
{
vector<int> ranks;
for (vsize i = 0; i < worth.size (); i++)
- {
- Interval_t<int> iv = worth[i]->spanned_rank_interval ();
- for (int j = iv[LEFT]; j <= iv[RIGHT]; j++)
- ranks.push_back (j);
- }
+ {
+ Interval_t<int> iv = worth[i]->spanned_rank_interval ();
+ for (int j = iv[LEFT]; j <= iv[RIGHT]; j++)
+ ranks.push_back (j);
+ }
vector_sort (ranks, less<int> ());
uniq (ranks);
SCM scm_vec = scm_c_make_vector (ranks.size (), SCM_EOL);
for (vsize i = 0; i < ranks.size (); i++)
- scm_vector_set_x (scm_vec, scm_from_int (i), scm_from_int (ranks[i]));
+ scm_vector_set_x (scm_vec, scm_from_int (i), scm_from_int (ranks[i]));
me->set_property ("important-column-ranks", scm_vec);
return request_suicide (me, start, end);
void
Hara_kiri_group_spanner::consider_suicide (Grob *me)
{
- Spanner *sp = dynamic_cast<Spanner*> (me);
+ Spanner *sp = dynamic_cast<Spanner *> (me);
int left = sp->get_bound (LEFT)->get_column ()->get_rank ();
int right = sp->get_bound (RIGHT)->get_column ()->get_rank ();
if (!request_suicide (me, left, right))
return;
- vector<Grob*> childs;
+ vector<Grob *> childs;
Axis_group_interface::get_children (me, &childs);
for (vsize i = 0; i < childs.size (); i++)
childs[i]->suicide ();
}
ADD_INTERFACE (Hara_kiri_group_spanner,
- "A group spanner that keeps track of interesting items. If it"
- " doesn't contain any after line breaking, it removes itself"
- " and all its children.",
-
- /* properties */
- "items-worth-living "
- "important-column-ranks "
- "keep-alive-with "
- "remove-empty "
- "remove-first "
- );
-
+ "A group spanner that keeps track of interesting items. If it"
+ " doesn't contain any after line breaking, it removes itself"
+ " and all its children.",
+
+ /* properties */
+ "items-worth-living "
+ "important-column-ranks "
+ "keep-alive-with "
+ "remove-empty "
+ "remove-first "
+ );
{
pop_count_++;
if (pop_count_ > bracket_stack_.size ())
- ev->origin ()->warning (_ ("do not have that many brackets"));
+ ev->origin ()->warning (_ ("do not have that many brackets"));
}
else
{
{
Side_position_interface::add_support (bracket_stack_[i], gi.grob ());
Pointer_group_interface::add_grob (bracket_stack_[i],
- ly_symbol2scm ("columns"), gi.grob ());
+ ly_symbol2scm ("columns"), gi.grob ());
add_bound_item (bracket_stack_[i],
- gi.grob ());
+ gi.grob ());
}
}
Spanner *sp = make_spanner ("HorizontalBracket", events_[k]->self_scm ());
for (vsize i = 0; i < bracket_stack_.size (); i++)
- /* sp is the smallest, it should be added to the bigger brackets. */
- Side_position_interface::add_support (bracket_stack_[i], sp);
+ /* sp is the smallest, it should be added to the bigger brackets. */
+ Side_position_interface::add_support (bracket_stack_[i], sp);
bracket_stack_.push_back (sp);
}
}
ADD_ACKNOWLEDGER (Horizontal_bracket_engraver, note_column);
ADD_TRANSLATOR (Horizontal_bracket_engraver,
- /* doc */
- "Create horizontal brackets over notes for musical analysis"
- " purposes.",
+ /* doc */
+ "Create horizontal brackets over notes for musical analysis"
+ " purposes.",
- /* create */
- "HorizontalBracket ",
+ /* create */
+ "HorizontalBracket ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "horizontal-bracket.hh"
+#include "horizontal-bracket.hh"
#include "lookup.hh"
#include "side-position-interface.hh"
#include "spanner.hh"
#include "item.hh"
-
Stencil
Horizontal_bracket::make_bracket (Grob *me,
- Real length,
- Axis a, Direction dir)
+ Real length,
+ Axis a, Direction dir)
{
Drul_array<Real> edge_height = robust_scm2interval (me->get_property ("edge-height"),
- Interval (1.0, 1.0));
+ Interval (1.0, 1.0));
Drul_array<Real> flare = robust_scm2interval (me->get_property ("bracket-flare"),
- Interval (0, 0));
+ Interval (0, 0));
Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"),
- Interval (0, 0));
+ Interval (0, 0));
-
// Make sure that it points in the correct direction:
scale_drul (&edge_height, Real (-dir));
-
+
Interval empty;
Offset start;
start[a] = length;
- Drul_array<bool> connect_to_other =
- robust_scm2booldrul (me->get_property ("connect-to-neighbor"),
- Drul_array<bool> (false, false));
+ Drul_array<bool> connect_to_other
+ = robust_scm2booldrul (me->get_property ("connect-to-neighbor"),
+ Drul_array<bool> (false, false));
Direction d = LEFT;
do
{
if (connect_to_other[d])
- {
- edge_height[d] = 0.0;
- flare[d] = 0.0;
- shorten[d] = 0.0;
- }
+ {
+ edge_height[d] = 0.0;
+ flare[d] = 0.0;
+ shorten[d] = 0.0;
+ }
}
while (flip (&d) != LEFT);
-
+
/*
- ugh, Tuplet_bracket should use Horizontal_bracket, not the other way around.
+ ugh, Tuplet_bracket should use Horizontal_bracket, not the other way around.
*/
- return Tuplet_bracket::make_bracket (me, other_axis (a), start,
- edge_height, empty, flare, shorten);
+ return Tuplet_bracket::make_bracket (me, other_axis (a), start,
+ edge_height, empty, flare, shorten);
}
-
Stencil
Horizontal_bracket::make_enclosing_bracket (Grob *me, Grob *refpoint,
- vector<Grob*> grobs,
- Axis a, Direction dir)
+ vector<Grob *> grobs,
+ Axis a, Direction dir)
{
Grob *common = common_refpoint_of_array (grobs, refpoint, a);
Interval ext = Axis_group_interface::relative_group_extent (grobs, common, a);
Spanner *me = unsmob_spanner (smob);
extract_grob_set (me, "columns", gs);
- vector<Grob*> enclosed = gs;
+ vector<Grob *> enclosed = gs;
if (!gs.size ())
{
me->suicide ();
{
Item *b = me->get_bound (d);
if (b->break_status_dir ())
- enclosed.push_back (b);
+ enclosed.push_back (b);
}
while (flip (&d) != LEFT);
-
+
Stencil b = make_enclosing_bracket (me, me, enclosed, X_AXIS, get_grob_direction (me));
return b.smobbed_copy ();
}
ADD_INTERFACE (Horizontal_bracket,
- "A horizontal bracket encompassing notes.",
-
- /* properties */
- "bracket-flare "
- "columns "
- "edge-height "
- "shorten-pair "
- "connect-to-neighbor "
- );
+ "A horizontal bracket encompassing notes.",
+
+ /* properties */
+ "bracket-flare "
+ "columns "
+ "edge-height "
+ "shorten-pair "
+ "connect-to-neighbor "
+ );
{
extract_item_set (sp, "heads", heads);
if (heads.size ())
- sp->set_bound (RIGHT, heads.back ());
+ sp->set_bound (RIGHT, heads.back ());
}
}
completize_hyphen (hyphen_);
if (!hyphen_->get_bound (RIGHT))
- {
- hyphen_->warning (_ ("removing unterminated hyphen"));
- hyphen_->suicide ();
- }
+ {
+ hyphen_->warning (_ ("removing unterminated hyphen"));
+ hyphen_->suicide ();
+ }
hyphen_ = 0;
}
completize_hyphen (finished_hyphen_);
if (!finished_hyphen_->get_bound (RIGHT))
- {
- if (finished_ev_)
- finished_hyphen_->warning (_ ("unterminated hyphen; removing"));
- finished_hyphen_->suicide ();
- }
+ {
+ if (finished_ev_)
+ finished_hyphen_->warning (_ ("unterminated hyphen; removing"));
+ finished_hyphen_->suicide ();
+ }
finished_hyphen_ = 0;
}
}
ADD_ACKNOWLEDGER (Hyphen_engraver, lyric_syllable);
ADD_TRANSLATOR (Hyphen_engraver,
- /* doc */
- "Create lyric hyphens and distance constraints between words.",
+ /* doc */
+ "Create lyric hyphens and distance constraints between words.",
- /* create */
- "LyricHyphen "
- "LyricSpace ",
+ /* create */
+ "LyricHyphen "
+ "LyricSpace ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
/* This defines the primitve `make-box', which returns a new smob of
type `box', initialized to `#f'. */
LY_DEFINE (ly_export, "ly:export",
- 1, 0, 0, (SCM arg),
- "Export a Scheme object to the parser"
- " so it is treated as an identifier.")
+ 1, 0, 0, (SCM arg),
+ "Export a Scheme object to the parser"
+ " so it is treated as an identifier.")
{
SCM_RETURN_NEWSMOB (package_tag, arg);
}
#endif
#ifndef YY_START
-#define YY_START \
+#define YY_START \
((yy_start - 1) / 2)
#define YYSTATE YY_START
#endif
/* Flex >= 2.5.29 has include stack; but we don't use that yet. */
#if !HAVE_FLEXLEXER_YY_CURRENT_BUFFER
-#define yy_current_buffer \
+#define yy_current_buffer \
(yy_buffer_stack != 0 ? yy_buffer_stack[yy_buffer_stack_top] : 0)
#endif
string msg = _f ("cannot find file: `%s'", name);
msg += "\n";
msg += _f ("(search path: `%s')",
- (current_dir.length () ? (current_dir + PATHSEP) : "") + sources->path_->to_string ().c_str ());
+ (current_dir.length () ? (current_dir + PATHSEP) : "") + sources->path_->to_string ().c_str ());
LexerError (msg.c_str ());
return;
}
{
string spaces = "";
for (size_t i = 0; i < state_stack_.size (); i++)
- spaces += " ";
+ spaces += " ";
progress_indication (string ("\n") + spaces + string ("[") + file->name_string ());
}
{
string spaces = "";
for (size_t i = 0; i < state_stack_.size (); i++)
- spaces += " ";
+ spaces += " ";
progress_indication (string ("\n") + spaces + string ("[") + name);
}
include_stack_.push_back (file);
DECLARE_SCHEME_CALLBACK (height, (SCM));
DECLARE_SCHEME_CALLBACK (width, (SCM));
DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM));
-
- DECLARE_GROB_INTERFACE();
+
+ DECLARE_GROB_INTERFACE ();
static string get_fontcharname (string style, int alteration);
static vector<Box> accurate_boxes (Grob *me, Grob **common);
static SCM get_stencil (Grob *me);
DECLARE_SCHEME_CALLBACK (alignment_callback, (SCM element));
static void add_accidental (Grob *, Grob *);
- static vector<Grob*> get_relevant_accidentals (vector<Grob*> const &elts, Grob *left);
+ static vector<Grob *> get_relevant_accidentals (vector<Grob *> const &elts, Grob *left);
static void split_accidentals (Grob *accs,
- vector<Grob*> *break_reminder,
- vector<Grob*> *real_acc);
+ vector<Grob *> *break_reminder,
+ vector<Grob *> *real_acc);
- DECLARE_SCHEME_CALLBACK(calc_positioning_done, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM));
+ DECLARE_GROB_INTERFACE ();
};
#endif /* ACCIDENTAL_PLACEMENT_HH */
public:
DECLARE_SCHEME_CALLBACK (align_to_minimum_distances, (SCM));
DECLARE_SCHEME_CALLBACK (align_to_ideal_distances, (SCM));
- static void align_elements_to_minimum_distances(Grob *, Axis a);
- static void align_elements_to_ideal_distances(Grob *);
- static vector<Real> get_minimum_translations (Grob *, vector<Grob*> const&, Axis a);
- static vector<Real> get_minimum_translations_without_min_dist (Grob *, vector<Grob*> const&, Axis a);
- static vector<Real> get_pure_minimum_translations (Grob *, vector<Grob*> const&,
- Axis a, int start, int end);
+ static void align_elements_to_minimum_distances (Grob *, Axis a);
+ static void align_elements_to_ideal_distances (Grob *);
+ static vector<Real> get_minimum_translations (Grob *, vector<Grob *> const &, Axis a);
+ static vector<Real> get_minimum_translations_without_min_dist (Grob *, vector<Grob *> const &, Axis a);
+ static vector<Real> get_pure_minimum_translations (Grob *, vector<Grob *> const &,
+ Axis a, int start, int end);
static void set_ordered (Grob *);
static Axis axis (Grob *);
static void add_element (Grob *, Grob *);
static int get_count (Grob *, Grob *);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Real get_pure_child_y_translation (Grob *, Grob *child, int start, int end);
protected:
- static vector<Real> internal_get_minimum_translations (Grob *, vector<Grob*> const&,
- Axis a,
- bool include_fixed_spacing,
- bool pure, int start, int end);
+ static vector<Real> internal_get_minimum_translations (Grob *, vector<Grob *> const &,
+ Axis a,
+ bool include_fixed_spacing,
+ bool pure, int start, int end);
};
#endif /* ALIGN_INTERFACE_HH */
#include <pango/pangoft2.h>
#endif
-
/*
Interface to all fonts (both system fonts and fonts loaded
via Pango).
#endif
map<string, Index_to_charcode_map > filename_charcode_maps_map_;
-
+
All_font_metrics (All_font_metrics const &);
public:
Index_to_charcode_map const *get_index_to_charcode_map (string filename,
- int face_index,
- FT_Face face);
+ int face_index,
+ FT_Face face);
All_font_metrics (string search_path);
~All_font_metrics ();
Pango_font *find_pango_font (PangoFontDescription const *description,
- Real scale);
+ Real scale);
Font_metric *find_font (string name);
Open_type_font *find_otf (string name);
#include "lily-proto.hh"
#include "grob-interface.hh"
-
class Arpeggio
{
public:
DECLARE_SCHEME_CALLBACK (brew_chord_slur, (SCM));
DECLARE_SCHEME_CALLBACK (width, (SCM));
DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif /* ARPEGGIO_HH */
#include "stream-event.hh"
SCM articulation_list (vector<Stream_event *> notes,
- vector<Stream_event *> articulations,
- char const *articulation_name);
+ vector<Stream_event *> articulations,
+ char const *articulation_name);
#endif /* ARTICULATIONS_HH */
void add_audio_item (Audio_item *i);
Moment when () const;
- vector<Audio_item*> audio_items_;
+ vector<Audio_item *> audio_items_;
Moment when_;
- int ticks () const ;
+ int ticks () const;
protected:
void offset_when (Moment m);
friend class Score_performer;
Stream_event *event_;
Translator *origin_trans_;
- vector<Context*> origin_contexts (Translator *) const;
+ vector<Context *> origin_contexts (Translator *) const;
Audio_element_info (Audio_element *, Stream_event *);
Audio_element_info ();
Audio_element ();
virtual ~Audio_element ();
- DECLARE_CLASSNAME(Audio_element);
+ DECLARE_CLASSNAME (Audio_element);
virtual char const *name () const;
};
Audio_column *get_column () const;
virtual void render ();
-
+
private:
Audio_item (Audio_item const &);
Audio_item &operator = (Audio_item const &);
{
public:
Direction grow_dir_;
- vector<Audio_dynamic*> dynamics_;
-
+ vector<Audio_dynamic *> dynamics_;
virtual void render ();
- void add_absolute (Audio_dynamic*);
+ void add_absolute (Audio_dynamic *);
Audio_span_dynamic ();
};
-
class Audio_key : public Audio_item
{
public:
Pitch pitch_;
Moment length_mom_;
Pitch transposing_;
- Audio_dynamic* dynamic_;
-
+ Audio_dynamic *dynamic_;
+
Audio_note *tied_;
bool tie_event_;
};
{
public:
enum Type
- {
- TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC,
- MARKER, CUE_POINT
- };
+ {
+ TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC,
+ MARKER, CUE_POINT
+ };
Audio_text (Audio_text::Type type, string text_string);
void output (Midi_stream &midi_stream_r, int track, bool port);
Audio_staff ();
-
+
bool percussion_;
bool merge_unisons_;
- vector<Audio_item*> audio_items_;
+ vector<Audio_item *> audio_items_;
};
#endif // AUDIO_STAFF_HH
{
protected:
Spanner *staffline_;
- vector<Grob*> elts_;
+ vector<Grob *> elts_;
void process_music ();
virtual void finalize ();
DECLARE_ACKNOWLEDGER (grob);
virtual Spanner *get_spanner ();
virtual void add_element (Grob *);
virtual bool must_be_last () const;
-
+
public:
TRANSLATOR_DECLARATIONS (Axis_group_engraver);
};
DECLARE_SCHEME_CALLBACK (calc_pure_relevant_items, (SCM));
DECLARE_SCHEME_CALLBACK (calc_pure_relevant_spanners, (SCM));
DECLARE_SCHEME_CALLBACK (calc_pure_y_common, (SCM));
- static Interval relative_group_extent (vector<Grob*> const &list,
- Grob *common, Axis);
+ static Interval relative_group_extent (vector<Grob *> const &list,
+ Grob *common, Axis);
static Interval relative_pure_height (Grob *me, int start, int end);
static Interval combine_pure_heights (Grob *me, SCM, int, int);
static Interval sum_partial_pure_heights (Grob *me, int, int);
static Interval part_of_line_pure_height (Grob *me, bool begin, int, int);
static bool has_outside_staff_parent (Grob *me);
- static Skyline_pair skyline_spacing (Grob *me, vector<Grob*> elements);
+ static Skyline_pair skyline_spacing (Grob *me, vector<Grob *> elements);
static void add_element (Grob *me, Grob *);
static void set_axes (Grob *, Axis, Axis);
static bool has_axis (Grob *, Axis);
- static void get_children (Grob *, vector<Grob*> *);
+ static void get_children (Grob *, vector<Grob *> *);
static Interval staff_extent (Grob *me, Grob *ref, Axis, Grob *staff, Axis);
static SCM calc_common (Grob *, Axis);
- static Real minimum_distance (Grob*, Grob*, Axis);
- static SCM calc_maybe_pure_staff_staff_spacing (Grob*, bool, int, int);
- DECLARE_GROB_INTERFACE();
+ static Real minimum_distance (Grob *, Grob *, Axis);
+ static SCM calc_maybe_pure_staff_staff_spacing (Grob *, bool, int, int);
+ DECLARE_GROB_INTERFACE ();
};
#endif /* AXIS_GROUP_INTERFACE_HH */
class Bar_line
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Stencil dashed_bar_line (Grob *me, Interval const &extent, Real thick);
static Stencil tick_bar_line (Grob *me, Real h, bool rounded);
static Stencil compound_barline (Grob *, string, Interval const &extent,
- bool rounded);
+ bool rounded);
static Stencil simple_barline (Grob *, Real wid, Interval const &extent,
- bool rounded);
+ bool rounded);
static Interval bar_y_extent (Grob *, Grob *);
static bool non_empty_barline (Grob *me);
#include "beam.hh"
#include "interval.hh"
-#include "lily-guile.hh"
-#include "lily-proto.hh"
+#include "lily-guile.hh"
+#include "lily-proto.hh"
#include "main.hh" // DEBUG_BEAM_SCORING
-#include "std-vector.hh"
-#include "stem-info.hh"
+#include "std-vector.hh"
+#include "stem-info.hh"
-enum Scorers {
+enum Scorers
+{
// Should be ordered by increasing expensiveness.
ORIGINAL_DISTANCE,
SLOPE_IDEAL,
Beam_configuration ();
bool done () const;
void add (Real demerit, const string &reason);
- static Beam_configuration* new_config(Interval start,
- Interval offset);
+ static Beam_configuration *new_config (Interval start,
+ Interval offset);
};
// Comparator for a queue of Beam_configuration*.
class Beam_configuration_less
{
public:
- bool operator() (Beam_configuration* const& l, Beam_configuration* const& r)
+ bool operator () (Beam_configuration *const &l, Beam_configuration *const &r)
{
// Invert
return l->demerits > r->demerits;
}
};
-
struct Beam_quant_parameters
{
Real SECONDARY_BEAM_DEMERIT;
Real COLLISION_PADDING;
Real HORIZONTAL_INTER_QUANT_PENALTY;
Real STEM_COLLISION_FACTOR;
-
+
void fill (Grob *him);
};
-struct Beam_collision {
+struct Beam_collision
+{
Real x_;
Interval y_;
Real base_penalty_;
// Need to add beam_config->y to get actual offsets.
Interval beam_y_;
};
-
/*
Parameters for a single beam. Precomputed to save time in
scoring individual configurations.
TODO - use trailing _ on data members.
-
+
*/
class Beam_scoring_problem
{
public:
Beam_scoring_problem (Grob *me, Drul_array<Real> ys);
- Drul_array<Real> solve() const;
+ Drul_array<Real> solve () const;
private:
Grob *beam;
Interval unquanted_y;
-
+
Real staff_space;
Real beam_thickness;
Real line_thickness;
Real musical_dy;
Interval x_span;
-
+
vector<Stem_info> stem_infos;
/*
*/
vector<Real> base_lengths;
vector<Real> stem_xpositions;
-
+
Grob *common[2];
bool is_xstaff;
bool is_knee;
Real beam_translation;
vector<Beam_collision> collisions_;
vector<Beam_segment> segments_;
-
+
void init_stems ();
- void init_collisions (vector<Grob*> grobs);
+ void init_collisions (vector<Grob *> grobs);
void add_collision (Real x, Interval y, Real factor);
-
- void one_scorer (Beam_configuration* config) const;
+
+ void one_scorer (Beam_configuration *config) const;
Beam_configuration *force_score (SCM inspect_quants,
- const vector<Beam_configuration*> &configs) const;
- Real y_at (Real x, Beam_configuration const* c) const;
+ const vector<Beam_configuration *> &configs) const;
+ Real y_at (Real x, Beam_configuration const *c) const;
// Scoring functions:
void score_forbidden_quants (Beam_configuration *config) const;
void score_slope_ideal (Beam_configuration *config) const;
void score_slope_direction (Beam_configuration *config) const;
void score_slope_musical (Beam_configuration *config) const;
- void score_stem_lengths (Beam_configuration* config) const;
- void generate_quants(vector<Beam_configuration*>* scores) const;
+ void score_stem_lengths (Beam_configuration *config) const;
+ void generate_quants (vector<Beam_configuration *>* scores) const;
void score_collisions (Beam_configuration *config) const;
};
struct Beam_segment
{
int vertical_count_;
- Interval horizontal_;
+ Interval horizontal_;
Beam_segment ();
};
-bool beam_segment_less (Beam_segment const& a, Beam_segment const& b);
+bool beam_segment_less (Beam_segment const &a, Beam_segment const &b);
-struct Beam_stem_segment
+struct Beam_stem_segment
{
Beam_stem_segment ();
int max_connect_;
};
-
bool operator <(Beam_stem_segment const &a, Beam_stem_segment const &b);
class Beam
static int normal_stem_count (Grob *);
static Grob *first_normal_stem (Grob *);
static Grob *last_normal_stem (Grob *);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static void add_stem (Grob *, Grob *);
static bool is_cross_staff (Grob *);
static bool is_knee (Grob *);
static Real get_beam_translation (Grob *me);
static Real get_beam_thickness (Grob *me);
static void connect_beams (Grob *me);
- static vector<Beam_segment> get_beam_segments (Grob *me_grob, Grob **common);
+ static vector<Beam_segment> get_beam_segments (Grob *me_grob, Grob **common);
static Interval no_visible_stem_positions (Grob *me, Interval default_value);
-
+
DECLARE_SCHEME_CALLBACK (rest_collision_callback, (SCM element, SCM prev_off));
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (calc_beaming, (SCM));
DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
DECLARE_SCHEME_CALLBACK (calc_positions, (SCM));
DECLARE_SCHEME_CALLBACK (calc_least_squares_positions, (SCM, SCM));
- DECLARE_SCHEME_CALLBACK (calc_normal_stems, (SCM));
+ DECLARE_SCHEME_CALLBACK (calc_normal_stems, (SCM));
DECLARE_SCHEME_CALLBACK (calc_concaveness, (SCM));
DECLARE_SCHEME_CALLBACK (set_stem_lengths, (SCM));
DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
DECLARE_SCHEME_CALLBACK (shift_region_to_valid, (SCM, SCM));
DECLARE_SCHEME_CALLBACK (slope_damping, (SCM, SCM));
DECLARE_SCHEME_CALLBACK (quanting, (SCM, SCM));
-
+
static int get_direction_beam_count (Grob *me, Direction d);
private:
friend class Beam_scoring_problem;
-
+
static Direction get_default_dir (Grob *);
static void set_stem_directions (Grob *, Direction);
static void consider_auto_knees (Grob *);
static void set_stem_shorten (Grob *);
static int forced_stem_count (Grob *);
static Real calc_stem_y (Grob *, Grob *s, Grob **c,
- Real, Real, Direction,
- Drul_array<Real> pos, bool french);
+ Real, Real, Direction,
+ Drul_array<Real> pos, bool french);
};
-
#endif /* BEAM_HH */
Moment measure_length_;
Beaming_options ();
- void from_context (Context*);
+ void from_context (Context *);
};
struct Beam_rhythmic_element
public:
Beaming_pattern ();
- void beamify (Beaming_options const&);
+ void beamify (Beaming_options const &);
void de_grace ();
void add_stem (Moment d, int beams, bool invisible);
int beamlet_count (int idx, Direction d) const;
bool invisibility (int idx) const;
Moment start_moment (int idx) const;
Moment end_moment (int idx) const;
- Beaming_pattern* split_pattern(int idx);
+ Beaming_pattern *split_pattern (int idx);
private:
vector<Beam_rhythmic_element> infos_;
- Direction flag_direction (Beaming_options const&, vsize) const;
- void find_rhythmic_importance (Beaming_options const&);
+ Direction flag_direction (Beaming_options const &, vsize) const;
+ void find_rhythmic_importance (Beaming_options const &);
void unbeam_invisible_stems ();
};
vector<Real> solve_derivative (Offset) const;
Interval extent (Axis) const;
Interval control_point_extent (Axis) const;
-
+
Polynomial polynomial (Axis)const;
Offset curve_point (Real t) const;
Real curve_coordinate (Real t, Axis) const;
void translate (vector<Offset> *array, Offset o);
Bezier slur_shape (Real width, Real height_limit,
- Real height_proportion);
+ Real height_proportion);
Real slur_height (Real width, Real height_limit, Real height_proportion);
void get_slur_indent_height (Real *indent, Real *height, Real width, Real h_inf, Real r_0);
void add_score (SCM);
void add_bookpart (SCM);
Paper_book *process (Output_def *def_paper,
- Output_def *def_layout);
+ Output_def *def_layout);
Paper_book *process (Output_def *default_paper,
- Output_def *default_layout,
- Paper_book *parent_part);
+ Output_def *default_layout,
+ Paper_book *parent_part);
void set_keys ();
protected:
void add_scores_to_bookpart ();
bool error_found ();
void process_score (SCM score,
- Paper_book *output_paper_book,
- Output_def *layout);
+ Paper_book *output_paper_book,
+ Output_def *layout);
void process_bookparts (Paper_book *output_paper_book,
- Output_def *paper,
- Output_def *layout);
+ Output_def *paper,
+ Output_def *layout);
};
DECLARE_UNSMOB (Book, book);
DECLARE_SIMPLE_SMOBS (Box);
public:
Interval &x () {return interval_a_[X_AXIS]; }
- Interval &y (){ return interval_a_[Y_AXIS]; }
- Interval x () const{ return interval_a_[X_AXIS]; }
- Interval y () const{return interval_a_[Y_AXIS]; }
+ Interval &y () { return interval_a_[Y_AXIS]; }
+ Interval x () const { return interval_a_[X_AXIS]; }
+ Interval y () const {return interval_a_[Y_AXIS]; }
Interval operator [] (Axis a) const;
Interval &operator [] (Axis a);
class Break_alignment_interface
{
public:
- static vector<Grob*> ordered_elements (Grob *me);
- DECLARE_GROB_INTERFACE();
+ static vector<Grob *> ordered_elements (Grob *me);
+ DECLARE_GROB_INTERFACE ();
static void add_element (Grob *me, Grob *add);
static SCM break_align_order (Item *me);
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM element));
DECLARE_SCHEME_CALLBACK (calc_average_anchor, (SCM));
DECLARE_SCHEME_CALLBACK (calc_extent_aligned_anchor, (SCM));
DECLARE_SCHEME_CALLBACK (calc_break_visibility, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
struct Break_alignable_interface
{
DECLARE_SCHEME_CALLBACK (self_align_callback, (SCM element));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif // BREAK_ALIGN_INTERFACE_HH
DECLARE_SCHEME_CALLBACK (finalis, (SCM));
DECLARE_SCHEME_CALLBACK (offset_callback, (SCM element));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif // BREATHING_SIGN_HH
/* constructor is public */
virtual void process (Moment);
DECLARE_SCHEME_CALLBACK (constructor, ());
- DECLARE_CLASSNAME(Change_iterator);
+ DECLARE_CLASSNAME (Change_iterator);
private:
void error (string);
{
public:
DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif // CHORD_NAME_HH
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
/* construction */
- DECLARE_CLASSNAME(Chord_tremolo_iterator);
+ DECLARE_CLASSNAME (Chord_tremolo_iterator);
Chord_tremolo_iterator ();
protected:
virtual SCM get_music_list () const;
{
DECLARE_SCHEME_CALLBACK (calc_glyph_name, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif /* CLEF_HH */
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif // CLUSTER_HH
protected:
virtual void build_ligature (Spanner *ligature,
- vector<Grob_info> primitives) = 0;
+ vector<Grob_info> primitives) = 0;
virtual void typeset_ligature (Spanner *ligature,
- vector<Grob_info> primitives);
+ vector<Grob_info> primitives);
virtual void move_related_items_to_column (Item *, Paper_column *, Real);
private:
void collect_accidentals (Spanner *, vector<Grob_info>);
struct Column_x_positions
{
- vector<Grob*> cols_;
- vector<Grob*> loose_cols_;
+ vector<Grob *> cols_;
+ vector<Grob *> loose_cols_;
vector<Real> config_;
Real force_;
Line_shape piggyback (Line_shape mount, Real padding) const;
};
-struct Line_details {
+struct Line_details
+{
Grob *last_column_;
Real force_;
Line_shape shape_;
page, where each stencil represents
a different footnote. */
Interval refpoint_extent_; /* The refpoints of the first and last
- spaceable staff in this line. min-distance
- should be measured from the bottom
- refpoint_extent of one line to the
- top refpoint_extent of the next. */
+ spaceable staff in this line. min-distance
+ should be measured from the bottom
+ refpoint_extent of one line to the
+ top refpoint_extent of the next. */
Real tallness_; /* Y-extent, adjusted according to begin/rest-of-line*/
Real padding_; /* compulsory space after this system (if we're not
- last on a page) */
+ last on a page) */
Real title_padding_;
Real min_distance_;
Real title_min_distance_;
vector<vsize> start_; /* the columns at which we might be asked to start breaking */
vector<vsize> starting_breakpoints_; /* the corresponding index in breaks_ */
- vector<Grob*> all_;
+ vector<Grob *> all_;
vector<vsize> breaks_;
void initialize ();
#include "virtual-methods.hh"
#include <set>
-
/*
The definition of a interpretation context as given in the
input. The lists are stored in order of definition.
SCM get_translator_group_type () const { return translator_group_type_; }
void set_acceptor (SCM accepts, bool add);
- VIRTUAL_COPY_CONSTRUCTOR(Context_def, Context_def);
+ VIRTUAL_COPY_CONSTRUCTOR (Context_def, Context_def);
- vector<Context_def*> path_to_acceptable_context (SCM type_string,
- Output_def *,
- SCM) const;
- vector<Context_def*> internal_path_to_acceptable_context (SCM type_string,
- Output_def *,
- SCM,
- set<const Context_def *> *seen) const;
+ vector<Context_def *> path_to_acceptable_context (SCM type_string,
+ Output_def *,
+ SCM) const;
+ vector<Context_def *> internal_path_to_acceptable_context (SCM type_string,
+ Output_def *,
+ SCM,
+ set<const Context_def *> *seen) const;
Context *instantiate (SCM extra_ops);
SCM to_alist () const;
#include "lily-proto.hh"
-
class Context_handle
{
public:
#include "smobs.hh"
#include "virtual-methods.hh"
-
/*
Modifications for an interpretation context as given in the
input.
Context (Context const &src);
DECLARE_SMOBS (Context);
- DECLARE_CLASSNAME(Context);
+ DECLARE_CLASSNAME (Context);
void terminate ();
private:
friend class Context_handle;
int iterator_count_;
-
+
/* Used internally by create_context */
Stream_event *infant_event_;
SCM definition_;
/* Additions to the Context_def, given by \with */
SCM definition_mods_;
-
+
SCM properties_scm_;
SCM context_list_;
SCM accepts_list_;
SCM aliases_;
Translator_group *implementation_;
string id_string_;
-
+
/* Events reported in the context is sent to this dispatcher. */
Dispatcher *event_source_;
DECLARE_LISTENER (set_property_from_event);
DECLARE_LISTENER (unset_property_from_event);
-
+
public:
string id_string () const { return id_string_; }
SCM children_contexts () const { return context_list_; }
Context *where_defined (SCM name_sym, SCM *value) const;
void unset_property (SCM var_sym);
- void instrumented_set_property (SCM, SCM, const char*, int, const char*);
+ void instrumented_set_property (SCM, SCM, const char *, int, const char *);
void internal_set_property (SCM var_sym, SCM value);
Context *create_context (Context_def *, string, SCM);
bool is_removable () const;
Context *find_create_context (SCM context_name,
- string id, SCM ops);
+ string id, SCM ops);
Context *create_unique_context (SCM context_name, string context_id,
- SCM ops);
- vector<Context_def*> path_to_acceptable_context (SCM alias) const;
+ SCM ops);
+ vector<Context_def *> path_to_acceptable_context (SCM alias) const;
};
/*
void apply_property_operations (Context *tg, SCM pre_init_ops);
void execute_revert_property (Context *context,
- SCM context_property,
- SCM grob_property_path);
+ SCM context_property,
+ SCM grob_property_path);
void execute_pushpop_property (Context *trg, SCM prop, SCM eltprop, SCM val);
void sloppy_general_pushpop_property (Context *context,
- SCM context_property, SCM grob_property_path, SCM val);
+ SCM context_property, SCM grob_property_path, SCM val);
SCM updated_grob_properties (Context *tg, SCM sym);
Context *find_context_below (Context *where,
- SCM type_sym, string id);
+ SCM type_sym, string id);
bool melisma_busy (Context *);
Context *get_voice_to_lyrics (Context *lyrics);
void set_context_property_on_children (Context *trans, SCM sym, SCM val);
/* Shorthand for creating and broadcasting stream events. */
-#define send_stream_event(ctx, type, origin, ...) \
-{ \
- SCM props[] = { __VA_ARGS__, 0 }; \
- ctx->internal_send_stream_event (ly_symbol2scm (type), origin, props); \
+#define send_stream_event(ctx, type, origin, ...) \
+{ \
+ SCM props[] = { __VA_ARGS__, 0 }; \
+ ctx->internal_send_stream_event (ly_symbol2scm (type), origin, props); \
}
SCM nested_property_alist (SCM alist, SCM prop_path, SCM value);
struct Custos
{
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
private:
static void add_streepjes (Grob *me, int pos, int interspaces, Stencil *custos_);
Grob *parent_;
void init ();
void clear ();
-
+
friend class Grob;
-
+
Dimension_cache (Dimension_cache const &);
~Dimension_cache ();
Dimension_cache ();
#include "lily-proto.hh"
#include "grob-interface.hh"
-
class Grob;
/**
static int compare (Grob *const &, Grob *const &);
static void add_head (Grob *dotcol, Grob *rh);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (side_position, (SCM));
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM));
};
Box dot_extents_;
bool extremal_head_;
Interval x_extent_;
-
+
Dot_position ()
{
dot_ = 0;
struct Dot_configuration : public map<int, Dot_position>
{
Dot_formatting_problem const *problem_;
-
+
Dot_configuration (Dot_formatting_problem const &);
Real x_offset () const;
int badness () const;
#ifndef DOT_FORMATTING_PROBLEM_HH
#define DOT_FORMATTING_PROBLEM_HH
-
#include "skyline.hh"
#include "std-vector.hh"
void register_configuration (Dot_configuration const &);
Dot_configuration *best () const;
Dot_formatting_problem (vector<Box> const &boxes, Interval base_x);
- ~Dot_formatting_problem();
+ ~Dot_formatting_problem ();
};
#endif
{
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif // DOTS_HH
#endif /* ENGRAVERGROUP_HH */
-
class Engraver : public Translator
{
Grob *internal_make_grob (SCM sym, SCM cause, char const *name,
- char const *f, int l, char const *fun);
+ char const *f, int l, char const *fun);
friend SCM ly_engraver_make_grob (SCM, SCM, SCM);
friend class Engraver_group;
protected:
Grob_info make_grob_info (Grob *, SCM cause);
Item *internal_make_item (SCM sym, SCM cause, char const *name,
- char const *f, int l, char const *fun);
+ char const *f, int l, char const *fun);
Spanner *internal_make_spanner (SCM sym, SCM cause, char const *name,
- char const *f, int l, char const *fun);
+ char const *f, int l, char const *fun);
Paper_column *internal_make_column (SCM sym, char const *name,
- char const *f, int l, char const *fun);
+ char const *f, int l, char const *fun);
/**
override other ctor
#define make_spanner(x, cause) internal_make_spanner (ly_symbol2scm (x), cause, x, __FILE__, __LINE__, __FUNCTION__)
#define make_paper_column(x) internal_make_column (ly_symbol2scm (x), x, __FILE__, __LINE__, __FUNCTION__)
-Engraver* unsmob_engraver (SCM eng);
+Engraver *unsmob_engraver (SCM eng);
bool ly_is_grob_cause (SCM obj);
#endif // ENGRAVER_HH
/**
Find a bottom notation context to deliver events to.
*/
- DECLARE_CLASSNAME(Event_chord_iterator);
+ DECLARE_CLASSNAME (Event_chord_iterator);
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2006--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
- Erik Sandberg <mandolaerik@gmail.com>
+ Erik Sandberg <mandolaerik@gmail.com>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
class Event_iterator : public Simple_music_iterator
{
- DECLARE_CLASSNAME(Event_iterator);
+ DECLARE_CLASSNAME (Event_iterator);
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
static SCM text_font_alist_chain (Grob *);
static SCM music_font_alist_chain (Grob *);
static Font_metric *get_default_font (Grob *);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif /* FONT_INTERFACE_HH */
class Font_metric
{
- DECLARE_CLASSNAME(Font_metric);
+ DECLARE_CLASSNAME (Font_metric);
public:
SCM description_;
PQueue<Moment> extra_mom_pq_;
Output_def *output_def_;
- DECLARE_CLASSNAME(Global_context);
+ DECLARE_CLASSNAME (Global_context);
friend class Output_def;
public:
#ifndef GLOBAL_CTOR_HH
#define GLOBAL_CTOR_HH
-#define ADD_GLOBAL_CTOR_WITHNAME(y, x) \
- class Global_ctor_ ## y \
- { \
- public: \
- Global_ctor_ ## y () \
- { \
- add_constructor (x); \
- } \
- } \
+#define ADD_GLOBAL_CTOR_WITHNAME(y, x) \
+ class Global_ctor_ ## y \
+ { \
+ public: \
+ Global_ctor_ ## y () \
+ { \
+ add_constructor (x); \
+ } \
+ } \
_ ## y ## _ctor_init;
#define ADD_GLOBAL_CTOR(x) ADD_GLOBAL_CTOR_WITHNAME (x, x);
public:
virtual void process (Moment);
DECLARE_SCHEME_CALLBACK (constructor, ());
- DECLARE_CLASSNAME(Grace_iterator);
+ DECLARE_CLASSNAME (Grace_iterator);
Moment pending_moment () const;
};
virtual void listen_pes_or_flexa (Stream_event *ev);
virtual void build_ligature (Spanner *ligature, vector<Grob_info> primitives);
virtual void transform_heads (Spanner *ligature,
- vector<Grob_info> primitives) = 0;
+ vector<Grob_info> primitives) = 0;
void stop_translation_timestep ();
};
#include "std-string.hh"
#include "grob-interface.hh"
-
class Gregorian_ligature
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static string prefixes_to_str (Grob *);
};
#include "lily-proto.hh"
#include "grob-interface.hh"
-
class Grid_line_interface
{
public:
static void add_grid_point (Grob *me, Grob *b);
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (width, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
class Grid_point_interface
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif /* GRID_LINE_INTERFACE_HH */
class Grob_array
{
- vector<Grob*> grobs_;
+ vector<Grob *> grobs_;
bool ordered_;
DECLARE_SIMPLE_SMOBS (Grob_array);
void remove_duplicates ();
void clear ();
void add (Grob *x) { grobs_.push_back (x); }
- void set_array (vector<Grob*> const &src);
- vector<Grob*> &array_reference ();
- vector<Grob*> const &array () const;
+ void set_array (vector<Grob *> const &src);
+ vector<Grob *> &array_reference ();
+ vector<Grob *> const &array () const;
static SCM make_array ();
};
DECLARE_UNSMOB (Grob_array, grob_array);
-vector<Grob*> const &ly_scm2link_array (SCM x);
+vector<Grob *> const &ly_scm2link_array (SCM x);
SCM grob_list_to_grob_array (SCM lst);
SCM grob_array_to_list (Grob_array *array);
Grob *grob_;
Direction start_end_;
-
friend class Engraver;
public:
Direction start_end () const { return start_end_; }
Context *context () const;
Stream_event *event_cause () const;
Stream_event *ultimate_event_cause () const;
- vector<Context*> origin_contexts (Translator *) const;
+ vector<Context *> origin_contexts (Translator *) const;
Grob_info (Translator *, Grob *);
Grob_info ();
#include "lily-guile.hh"
#define DECLARE_GROB_INTERFACE() \
- static SCM interface_symbol_; \
+ static SCM interface_symbol_; \
static bool has_interface (Grob*)
-#define ADD_INTERFACE(cl, b, c) \
+#define ADD_INTERFACE(cl, b, c) \
SCM cl::interface_symbol_; \
- bool cl::has_interface (Grob *me) \
- { \
- return me->internal_has_interface (interface_symbol_); \
- } \
- void cl ## _init_ifaces () \
- { \
- cl::interface_symbol_ = add_interface (#cl, b, c); \
- } \
+ bool cl::has_interface (Grob *me) \
+ { \
+ return me->internal_has_interface (interface_symbol_); \
+ } \
+ void cl ## _init_ifaces () \
+ { \
+ cl::interface_symbol_ = add_interface (#cl, b, c); \
+ } \
ADD_SCM_INIT_FUNC (cl ## ifaces, cl ## _init_ifaces);
SCM add_interface (char const *cxx_name,
- char const *descr,
- char const *vars);
+ char const *descr,
+ char const *vars);
SCM ly_add_interface (SCM, SCM, SCM);
void internal_add_interface (SCM, SCM, SCM);
{
private:
DECLARE_SMOBS (Grob);
- DECLARE_CLASSNAME(Grob);
-
+ DECLARE_CLASSNAME (Grob);
+
void init ();
protected:
SCM immutable_property_alist_;
SCM mutable_property_alist_;
SCM object_alist_;
-
+
/*
If this is a property, it accounts for 25% of the property
lookups.
*/
SCM interfaces_;
-
+
void substitute_object_links (SCM, SCM);
Real get_offset (Axis a) const;
SCM try_callback (SCM, SCM);
void internal_set_value_on_alist (SCM *alist, SCM sym, SCM val);
public:
-
+
/* friends */
friend class Spanner;
friend class System;
Grob *original () const { return original_; }
SCM interfaces () const { return interfaces_; }
- /* life & death */
+ /* life & death */
Grob (SCM basic_props);
Grob (Grob const &);
virtual Grob *clone () const;
SCM internal_get_object (SCM symbol) const;
void internal_set_object (SCM sym, SCM val);
void internal_del_property (SCM symbol);
- void instrumented_set_property (SCM, SCM, char const*, int, char const*);
+ void instrumented_set_property (SCM, SCM, char const *, int, char const *);
void internal_set_property (SCM sym, SCM val);
- /* messages */
+ /* messages */
void warning (string) const;
void programming_error (string) const;
-
/* class hierarchy */
virtual System *get_system () const;
static System *get_system (Grob *);
/* interfaces */
bool internal_has_interface (SCM intf);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
/* offsets */
void translate_axis (Real, Axis);
/* refpoints */
Grob *common_refpoint_of_list (SCM elt_list, Grob *, Axis a);
-Grob *common_refpoint_of_array (vector<Grob*> const &, Grob *, Axis a);
+Grob *common_refpoint_of_array (vector<Grob *> const &, Grob *, Axis a);
System *get_root_system (Grob *me);
-/* extents */
+/* extents */
Interval robust_relative_extent (Grob *, Grob *, Axis);
/* offset/extent callbacks. */
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif // HAIRPIN_HH
DECLARE_SCHEME_CALLBACK (pure_height, (SCM smob, SCM start, SCM end));
DECLARE_SCHEME_CALLBACK (force_hara_kiri_in_y_parent_callback, (SCM));
DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static bool request_suicide (Grob *me, int start, int end);
static bool request_suicide_alone (Grob *me, int start, int end);
static void consider_suicide (Grob *me);
DECLARE_SCHEME_CALLBACK (print, (SCM));
static Stencil make_bracket (Grob *, Real, Axis, Direction);
static Stencil make_enclosing_bracket (Grob *me, Grob *refpoint,
- vector<Grob*> grobs,
- Axis a, Direction dir);
- DECLARE_GROB_INTERFACE();
+ vector<Grob *> grobs,
+ Axis a, Direction dir);
+ DECLARE_GROB_INTERFACE ();
};
#endif /* HORIZONTAL_BRACKET_HH */
protected:
bool close_input ();
- vector<Source_file*> include_stack_;
+ vector<Source_file *> include_stack_;
vector<int> char_count_stack_;
vector<string> pending_string_includes_;
Source_file *get_source_file () const;
virtual void new_input (string s, Sources *);
-
+
void new_input (string name, string data, Sources *);
void add_string_include (string data);
-
+
char const *here_str0 () const;
};
Input ();
};
-
#include "smobs.hh"
SCM make_input (Input spot);
{
Drul_array<Item *> broken_to_drul_;
- DECLARE_CLASSNAME(Item);
+ DECLARE_CLASSNAME (Item);
public:
Item (SCM);
Item (Item const &);
virtual Grob *clone () const;
static bool is_non_musical (Grob *);
- static bool break_visible(Grob *);
+ static bool break_visible (Grob *);
bool is_broken () const;
virtual bool pure_is_visible (int start, int end) const;
virtual void handle_prebroken_dependencies ();
virtual Interval_t<int> spanned_rank_interval () const;
virtual Interval pure_height (Grob *ref, int start, int end);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
protected:
virtual void discretionary_processing ();
void copy_breakable_items ();
void process_music ();
virtual Spanner *create_ligature_spanner () = 0;
virtual void typeset_ligature (Spanner *ligature,
- vector<Grob_info> primitives) = 0;
+ vector<Grob_info> primitives) = 0;
virtual Spanner *current_ligature ();
SCM brew_ligature_primitive_proc;
scm_or_str2symbol (char const *c) { return scm_from_locale_symbol (c); }
inline SCM
-scm_or_str2symbol (SCM s) {
+scm_or_str2symbol (SCM s)
+{
assert (scm_is_symbol (s));
return s;
}
variable per ly_symbol2scm() use, and one boolean evaluation for
every call.
*/
-#define ly_symbol2scm(x) \
- ({ \
- static SCM cached; \
- /* We store this one locally, since G++ -O2 fucks up else */ \
- SCM value = cached; \
- if (__builtin_constant_p ((x))) \
- { \
- if (!cached) \
- value = cached = scm_gc_protect_object (scm_or_str2symbol (x)); \
- } \
- else \
- value = scm_or_str2symbol (x); \
- value; \
+#define ly_symbol2scm(x) \
+ ({ \
+ static SCM cached; \
+ /* We store this one locally, since G++ -O2 fucks up else */ \
+ SCM value = cached; \
+ if (__builtin_constant_p ((x))) \
+ { \
+ if (!cached) \
+ value = cached = scm_gc_protect_object (scm_or_str2symbol (x)); \
+ } \
+ else \
+ value = scm_or_str2symbol (x); \
+ value; \
})
#else
inline SCM ly_symbol2scm (char const *x) { return scm_from_locale_symbol ((x)); }
exports list of the module.
*/
-#define ly_lily_module_constant(x) \
- ({ \
- static SCM cached; \
- /* We store this one locally, since G++ -O2 fucks up else */ \
- SCM value = cached; \
- if (__builtin_constant_p ((x))) \
- { \
- if (!cached) \
- value = cached = scm_eval (scm_from_locale_symbol (x), \
- global_lily_module); \
- } \
- else \
- value = scm_eval (scm_from_locale_symbol (x), global_lily_module); \
- value; \
+#define ly_lily_module_constant(x) \
+ ({ \
+ static SCM cached; \
+ /* We store this one locally, since G++ -O2 fucks up else */ \
+ SCM value = cached; \
+ if (__builtin_constant_p ((x))) \
+ { \
+ if (!cached) \
+ value = cached = scm_eval (scm_from_locale_symbol (x), \
+ global_lily_module); \
+ } \
+ else \
+ value = scm_eval (scm_from_locale_symbol (x), global_lily_module); \
+ value; \
})
/*
Adds the NAME as a Scheme function, and a variable to store the SCM
version of the function in the static variable NAME_proc
*/
-#define DECLARE_SCHEME_CALLBACK(NAME, ARGS) \
- static SCM NAME ARGS; \
+#define DECLARE_SCHEME_CALLBACK(NAME, ARGS) \
+ static SCM NAME ARGS; \
static SCM NAME ## _proc
#define ADD_TYPE_PREDICATE(func, type_name) \
void \
- func ## _type_adder () \
+ func ## _type_adder () \
{\
- ly_add_type_predicate ((Type_predicate_ptr)func, type_name); \
+ ly_add_type_predicate ((Type_predicate_ptr)func, type_name); \
}\
ADD_SCM_INIT_FUNC(func ## _type_adder_ctor, \
- func ## _type_adder);
+ func ## _type_adder);
#define ADD_TYPE_PREDICATE(func, type_name) \
void \
- func ## _type_adder () \
+ func ## _type_adder () \
{\
- ly_add_type_predicate ((Type_predicate_ptr)func, type_name); \
+ ly_add_type_predicate ((Type_predicate_ptr)func, type_name); \
}\
ADD_SCM_INIT_FUNC(func ## _type_adder_ctor, \
- func ## _type_adder);
+ func ## _type_adder);
string mangle_cxx_identifier (string);
Make TYPE::FUNC available as a Scheme function.
*/
#define MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE, FUNC, ARGCOUNT, OPTIONAL_COUNT, DOC) \
- SCM TYPE ::FUNC ## _proc; \
- void \
- TYPE ## _ ## FUNC ## _init_functions () \
- { \
+ SCM TYPE ::FUNC ## _proc; \
+ void \
+ TYPE ## _ ## FUNC ## _init_functions () \
+ { \
string cxx = string (#TYPE) + "::" + string (#FUNC); \
string id = mangle_cxx_identifier (cxx); \
- TYPE ::FUNC ## _proc = scm_c_define_gsubr (id.c_str(), \
- (ARGCOUNT-OPTIONAL_COUNT), OPTIONAL_COUNT, 0, \
- (scm_t_subr) TYPE::FUNC); \
+ TYPE ::FUNC ## _proc = scm_c_define_gsubr (id.c_str(), \
+ (ARGCOUNT-OPTIONAL_COUNT), OPTIONAL_COUNT, 0, \
+ (scm_t_subr) TYPE::FUNC); \
ly_add_function_documentation (TYPE :: FUNC ## _proc, id.c_str(), "", \
- DOC); \
- scm_c_export (id.c_str (), NULL); \
- } \
- \
- ADD_SCM_INIT_FUNC (TYPE ## _ ## FUNC ## _callback, \
- TYPE ## _ ## FUNC ## _init_functions);
-
-#define MAKE_DOCUMENTED_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT, DOC) \
+ DOC); \
+ scm_c_export (id.c_str (), NULL); \
+ } \
+ \
+ ADD_SCM_INIT_FUNC (TYPE ## _ ## FUNC ## _callback, \
+ TYPE ## _ ## FUNC ## _init_functions);
+
+#define MAKE_DOCUMENTED_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT, DOC) \
MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE, FUNC, ARGCOUNT, 0, DOC);
-#define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT) \
+#define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT) \
MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE,FUNC,ARGCOUNT, 0, "");
void ly_add_function_documentation (SCM proc, string fname, string varlist, string doc);
void ly_check_name (string cxx, string fname);
-#define ADD_SCM_INIT_FUNC(name, func) \
- class name ## _scm_initter \
- { \
- public: \
- name ## _scm_initter () \
- { \
- add_scm_init_func (func); \
- } \
- } \
+#define ADD_SCM_INIT_FUNC(name, func) \
+ class name ## _scm_initter \
+ { \
+ public: \
+ name ## _scm_initter () \
+ { \
+ add_scm_init_func (func); \
+ } \
+ } \
_ ## name ## _scm_initter;
/* end define */
#define LY_DEFINE_WITHOUT_DECL(INITPREFIX, FNAME, PRIMNAME, REQ, OPT, VAR, \
- ARGLIST, DOCSTRING) \
- SCM FNAME ## _proc; \
- void \
- INITPREFIX ## init () \
- { \
- FNAME ## _proc = scm_c_define_gsubr (PRIMNAME, REQ, OPT, VAR, \
- (scm_t_subr) FNAME); \
+ ARGLIST, DOCSTRING) \
+ SCM FNAME ## _proc; \
+ void \
+ INITPREFIX ## init () \
+ { \
+ FNAME ## _proc = scm_c_define_gsubr (PRIMNAME, REQ, OPT, VAR, \
+ (scm_t_subr) FNAME); \
ly_check_name (#FNAME, PRIMNAME);\
- ly_add_function_documentation (FNAME ## _proc, PRIMNAME, #ARGLIST, \
- DOCSTRING); \
- scm_c_export (PRIMNAME, NULL); \
- } \
+ ly_add_function_documentation (FNAME ## _proc, PRIMNAME, #ARGLIST, \
+ DOCSTRING); \
+ scm_c_export (PRIMNAME, NULL); \
+ } \
ADD_SCM_INIT_FUNC (INITPREFIX ## init_unique_prefix, INITPREFIX ## init); \
- SCM \
+ SCM \
FNAME ARGLIST
-#define LY_DEFINE(FNAME, PRIMNAME, REQ, OPT, VAR, ARGLIST, DOCSTRING) \
- SCM FNAME ARGLIST; \
+#define LY_DEFINE(FNAME, PRIMNAME, REQ, OPT, VAR, ARGLIST, DOCSTRING) \
+ SCM FNAME ARGLIST; \
LY_DEFINE_WITHOUT_DECL (FNAME, FNAME, PRIMNAME, REQ, OPT, VAR, ARGLIST, \
- DOCSTRING)
+ DOCSTRING)
#define LY_DEFINE_MEMBER_FUNCTION(CLASS, FNAME, PRIMNAME, REQ, OPT, VAR, \
- ARGLIST, DOCSTRING) \
- SCM FNAME ARGLIST; \
+ ARGLIST, DOCSTRING) \
+ SCM FNAME ARGLIST; \
LY_DEFINE_WITHOUT_DECL (CLASS ## FNAME, CLASS::FNAME, PRIMNAME, REQ, OPT, \
- VAR, ARGLIST, DOCSTRING)
+ VAR, ARGLIST, DOCSTRING)
#define get_property(x) internal_get_property (ly_symbol2scm (x))
#define get_pure_property(x,y,z) \
#define set_property(x, y) internal_set_property (ly_symbol2scm (x), y)
#endif
-
-
-#define LY_ASSERT_TYPE(pred, var, number) \
- { \
+#define LY_ASSERT_TYPE(pred, var, number) \
+ { \
if (!pred (var)) \
- { \
- scm_wrong_type_arg_msg(mangle_cxx_identifier (__FUNCTION__).c_str(), \
- number, var, \
- predicate_to_typename ((void*) &pred).c_str()); \
- } \
+ { \
+ scm_wrong_type_arg_msg(mangle_cxx_identifier (__FUNCTION__).c_str(), \
+ number, var, \
+ predicate_to_typename ((void*) &pred).c_str()); \
+ } \
}
#define LY_ASSERT_SMOB(klass, var, number) LY_ASSERT_TYPE(klass::unsmob, var, number)
-
-
#endif /* LILY_GUILE_MACROS_HH */
Hack for various MacOS incarnations.
*/
#ifndef GUILE_ELLIPSIS
-#define GUILE_ELLIPSIS
+#define GUILE_ELLIPSIS
#endif
#include "guile-compatibility.hh"
string robust_scm2string (SCM, string);
Rational robust_scm2rational (SCM, Rational);
-
SCM ly_quote_scm (SCM s);
bool type_check_assignment (SCM val, SCM sym, SCM type_symbol);
string print_scm_val (SCM val);
SCM ly_hash_table_keys (SCM tab);
SCM ly_assoc_prepend_x (SCM alist, SCM key, SCM val);
-inline bool ly_is_fraction (SCM x) { return SCM_FRACTIONP(x) || scm_is_integer (x); }
-
+inline bool ly_is_fraction (SCM x) { return SCM_FRACTIONP (x) || scm_is_integer (x); }
+
inline bool ly_is_list (SCM x) { return SCM_NFALSEP (scm_list_p (x)); }
inline bool ly_cheap_is_list (SCM x) { return scm_is_pair (x) || x == SCM_EOL; }
inline bool ly_is_procedure (SCM x) { return SCM_NFALSEP (scm_procedure_p (x)); }
/*
snarfing.
*/
-void add_scm_init_func (void (*) ());
+void add_scm_init_func (void ( *) ());
extern "C" {
typedef SCM (*Scheme_function_unknown) (GUILE_ELLIPSIS);
typedef SCM (*Scheme_function_3) (GUILE_ELLIPSIS);
#endif
-
/*
Inline these for performance reasons.
*/
inline SCM ly_cdr (SCM x) { return SCM_CDR (x); }
inline bool ly_is_pair (SCM x) { return SCM_I_CONSP (x); }
-
-
-#include "std-vector.hh"
+#include "std-vector.hh"
template<class T>
SCM
-ly_cxx_vector_to_list (vector<T> const &src)
+ly_cxx_vector_to_list (vector<T> const &src)
{
SCM l = SCM_EOL;
- for (vsize i = src.size (); i --; )
+ for (vsize i = src.size (); i--;)
l = scm_cons (src[i]->self_scm (), l);
return l;
}
-
SCM ly_offsets2scm (vector<Offset> os);
vector<Offset> ly_scm2offsets (SCM s);
void *lexval_;
Input *lexloc_;
bool is_main_input_;
-
+
Sources *sources_;
/* Scheme hash tables with (oct name acc) values, and symbol keys. */
Lily_lexer (Sources *, Lily_parser *);
Lily_lexer (Lily_lexer const &, Lily_parser *);
int yylex ();
-
+
void add_lexed_char (int);
void prepare_for_next_token ();
char const *here_str0 () const;
Simultaneous_music *get_chord (Pitch tonic,
- vector<Pitch> *adds, vector<Pitch> *subs,
- Pitch *inversion, Pitch *bass, Duration d);
+ vector<Pitch> *adds, vector<Pitch> *subs,
+ Pitch *inversion, Pitch *bass, Duration d);
void set_chord_tremolo (int type);
void set_last_duration (Duration const *);
void set_last_pitch (Pitch const *);
void parser_error (Input const &, string);
void set_yydebug (bool);
- SCM make_scope () const;
+ SCM make_scope () const;
};
DECLARE_UNSMOB (Lily_parser, lily_parser);
class yyFlexLexer;
typedef void (*Engraver_void_function_engraver_grob_info) (Engraver *,
- Grob_info);
+ Grob_info);
typedef void (*Translator_void_method_ptr) (Translator *);
#endif /* LILY_PROTO_HH */
struct Line_interface
{
static Stencil line (Grob *me, Offset from, Offset to);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Stencil make_zigzag_line (Grob *me,
- Offset from,
- Offset to);
+ Offset from,
+ Offset to);
static Stencil make_trill_line (Grob *me,
- Offset from,
- Offset to);
+ Offset from,
+ Offset to);
static Stencil make_dashed_line (Real th, Offset from, Offset to, Real, Real);
static Stencil make_line (Real th, Offset from, Offset to);
static Stencil make_arrow (Offset beg, Offset end, Real thick,
- Real length, Real width);
+ Real length, Real width);
static Stencil arrows (Grob *me, Offset from, Offset to,
- bool from_arrow,
- bool to_arrow);
+ bool from_arrow,
+ bool to_arrow);
};
#endif /* LINE_INTERFACE_HH */
register a method as an event handler in a dispatcher, then you
must:
- - declare the method using the DECLARE_LISTENER macro.
+ - declare the method using the DECLARE_LISTENER macro.
class Foo
{
DECLARE_LISTENER (method);
Stream_distributor *d = (...);
Listener l = GET_LISTENER (foo->method);
d->register_listener (l, "EventClass");
-
+
Whenever d hears a stream-event ev of class "EventClass",
the implemented procedure is called.
#include "smobs.hh"
-typedef struct {
+typedef struct
+{
void (*listen_callback) (void *, SCM);
void (*mark_callback) (void *);
} Listener_function_table;
-class Listener {
+class Listener
+{
void *target_;
Listener_function_table *type_;
public:
};
DECLARE_UNSMOB (Listener, listener);
-#define IMPLEMENT_LISTENER(cl, method) \
-void \
-cl :: method ## _callback (void *self, SCM ev) \
-{ \
- cl *s = (cl *)self; \
- s->method (ev); \
-} \
-void \
-cl :: method ## _mark (void *self) \
-{ \
- cl *s = (cl *)self; \
- scm_gc_mark (s->self_scm ()); \
-} \
-Listener \
-cl :: method ## _listener () const \
-{ \
- static Listener_function_table callbacks; \
- callbacks.listen_callback = &cl::method ## _callback; \
- callbacks.mark_callback = &cl::method ## _mark; \
- return Listener (this, &callbacks); \
+#define IMPLEMENT_LISTENER(cl, method) \
+void \
+cl :: method ## _callback (void *self, SCM ev) \
+{ \
+ cl *s = (cl *)self; \
+ s->method (ev); \
+} \
+void \
+cl :: method ## _mark (void *self) \
+{ \
+ cl *s = (cl *)self; \
+ scm_gc_mark (s->self_scm ()); \
+} \
+Listener \
+cl :: method ## _listener () const \
+{ \
+ static Listener_function_table callbacks; \
+ callbacks.listen_callback = &cl::method ## _callback; \
+ callbacks.mark_callback = &cl::method ## _mark; \
+ return Listener (this, &callbacks); \
}
#define GET_LISTENER(proc) proc ## _listener ()
-#define DECLARE_LISTENER(name) \
- inline void name (SCM); \
- static void name ## _callback (void *self, SCM ev); \
- static void name ## _mark (void *self); \
+#define DECLARE_LISTENER(name) \
+ inline void name (SCM); \
+ static void name ## _callback (void *self, SCM ev); \
+ static void name ## _mark (void *self); \
Listener name ## _listener () const
#endif /* LISTENER_HH */
static Stencil rotated_box (Real slope, Real width, Real thick, Real blot);
static Stencil round_filled_polygon (vector<Offset> const &points, Real blotdiameter);
static Stencil frame (Box b, Real thick, Real blot);
- static Stencil slur (Bezier controls, Real cthick, Real thick,
+ static Stencil slur (Bezier controls, Real cthick, Real thick,
SCM dash_definition);
static Stencil bezier_sandwich (Bezier top_curve, Bezier bottom_curve,
Real thickness);
typedef SCM (*scm_t_hash_handle_fn) (GUILE_ELLIPSIS);
#endif
-
#endif /* LY_MODULE_HH */
#include "lily-guile-macros.hh"
#include "smobs.hh"
-#define IMPLEMENT_TYPE_P(CL, FUNCNAME) \
- SCM CL ## _type_p_proc; \
- void init_type_ ## CL () \
- { \
- SCM subr = scm_c_define_gsubr (FUNCNAME, 1, 0, 0, \
- (scm_t_subr) CL::smob_p); \
- CL ## _type_p_proc = subr; \
- ly_add_function_documentation (subr, FUNCNAME, "(SCM x)", \
- "Is @var{x} a @code{" #CL "} object?"); \
- scm_c_export (FUNCNAME, NULL); \
- } \
+#define IMPLEMENT_TYPE_P(CL, FUNCNAME) \
+ SCM CL ## _type_p_proc; \
+ void init_type_ ## CL () \
+ { \
+ SCM subr = scm_c_define_gsubr (FUNCNAME, 1, 0, 0, \
+ (scm_t_subr) CL::smob_p); \
+ CL ## _type_p_proc = subr; \
+ ly_add_function_documentation (subr, FUNCNAME, "(SCM x)", \
+ "Is @var{x} a @code{" #CL "} object?"); \
+ scm_c_export (FUNCNAME, NULL); \
+ } \
ADD_SCM_INIT_FUNC (init_type_ ## CL, init_type_ ## CL)
-#define IMPLEMENT_BASE_SMOBS(CL) \
+#define IMPLEMENT_BASE_SMOBS(CL) \
void \
- CL ## _type_adder () \
+ CL ## _type_adder () \
{\
- ly_add_type_predicate ((void*) &CL::unsmob, #CL); \
+ ly_add_type_predicate ((void*) &CL::unsmob, #CL); \
}\
ADD_SCM_INIT_FUNC(CL ## _type_adder_ctor, \
- CL ## _type_adder);\
- const char *CL::smob_name_ = #CL; \
- scm_t_bits 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 () \
- { \
- smob_tag_ = scm_make_smob_type (#CL, 0); \
- scm_set_smob_mark (smob_tag_, CL::mark_smob); \
- scm_set_smob_free (smob_tag_, CL::free_smob); \
- scm_set_smob_print (smob_tag_, CL::print_smob); \
- scm_set_smob_equalp (smob_tag_, CL::equal_p); \
- } \
- \
- size_t \
- CL::free_smob (SCM ses) \
- { \
- CL *s = (CL *) SCM_CELL_WORD_1 (ses); \
- delete s; \
+ CL ## _type_adder);\
+ const char *CL::smob_name_ = #CL; \
+ scm_t_bits 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 () \
+ { \
+ smob_tag_ = scm_make_smob_type (#CL, 0); \
+ scm_set_smob_mark (smob_tag_, CL::mark_smob); \
+ scm_set_smob_free (smob_tag_, CL::free_smob); \
+ scm_set_smob_print (smob_tag_, CL::print_smob); \
+ scm_set_smob_equalp (smob_tag_, CL::equal_p); \
+ } \
+ \
+ size_t \
+ CL::free_smob (SCM ses) \
+ { \
+ CL *s = (CL *) SCM_CELL_WORD_1 (ses); \
+ delete s; \
/* scm_gc_unregister_collectable_memory (s, sizeof (CL), #CL " smob"); */ \
- return SMOB_FREE_RETURN_VAL (CL); \
- } \
- \
+ return SMOB_FREE_RETURN_VAL (CL); \
+ } \
+ \
ADD_SCM_INIT_FUNC (CL, CL::init_smobs)
-#define IMPLEMENT_SIMPLE_SMOBS(CL) \
- IMPLEMENT_BASE_SMOBS (CL); \
- SCM CL::smobbed_copy () const \
- { \
- CL *ptr = new CL (*this); \
- SCM s; \
- s = scm_cons (SCM_PACK (CL::smob_tag_), SCM_PACK (ptr)); \
+#define IMPLEMENT_SIMPLE_SMOBS(CL) \
+ IMPLEMENT_BASE_SMOBS (CL); \
+ SCM CL::smobbed_copy () const \
+ { \
+ CL *ptr = new CL (*this); \
+ SCM s; \
+ s = scm_cons (SCM_PACK (CL::smob_tag_), SCM_PACK (ptr)); \
scm_gc_register_collectable_memory ((CL *)this, sizeof (CL), #CL " smob"); \
- \
- return s; \
+ \
+ return s; \
}
-#define IMPLEMENT_SMOBS(CL) \
- IMPLEMENT_BASE_SMOBS (CL) \
- void \
- CL::smobify_self () \
- { \
- protection_cons_ = SCM_EOL; \
- self_scm_ = unprotected_smobify_self (); \
- protect (); \
- } \
- void \
- CL::protect () \
- { \
- protect_smob (self_scm_, &protection_cons_); \
- } \
- SCM \
- CL::unprotect () \
- { \
- unprotect_smob (self_scm_, &protection_cons_); \
- return self_scm_; \
- } \
- SCM \
- CL::unprotected_smobify_self () \
- { \
- /* \
- This is local. We don't assign to self_scm_ directly, to assure \
- that S isn't GC-ed from under us. \
- \
+#define IMPLEMENT_SMOBS(CL) \
+ IMPLEMENT_BASE_SMOBS (CL) \
+ void \
+ CL::smobify_self () \
+ { \
+ protection_cons_ = SCM_EOL; \
+ self_scm_ = unprotected_smobify_self (); \
+ protect (); \
+ } \
+ void \
+ CL::protect () \
+ { \
+ protect_smob (self_scm_, &protection_cons_); \
+ } \
+ SCM \
+ CL::unprotect () \
+ { \
+ unprotect_smob (self_scm_, &protection_cons_); \
+ return self_scm_; \
+ } \
+ SCM \
+ CL::unprotected_smobify_self () \
+ { \
+ /* \
+ This is local. We don't assign to self_scm_ directly, to assure \
+ that S isn't GC-ed from under us. \
+ \
We don't use smobbed_self () to ensure that mark_smob () doesn't \
have to deal half-initialized objects: scm_done_malloc ( ) might \
trigger GC.the warning in smobs.hh is just to be doubleplus \
goodly sure \
- */ \
- SCM s; \
- SCM_NEWSMOB (s, CL::smob_tag_, this); \
- self_scm_ = s; \
+ */ \
+ SCM s; \
+ SCM_NEWSMOB (s, CL::smob_tag_, this); \
+ self_scm_ = s; \
scm_gc_register_collectable_memory (this, sizeof (CL), #CL " smob"); \
- return s; \
+ return s; \
}
-#define IMPLEMENT_DEFAULT_EQUAL_P(CL) \
- SCM \
- CL::equal_p (SCM a, SCM b) \
- { \
- return a == b ? SCM_BOOL_T : SCM_BOOL_F; \
+#define IMPLEMENT_DEFAULT_EQUAL_P(CL) \
+ SCM \
+ CL::equal_p (SCM a, SCM b) \
+ { \
+ return a == b ? SCM_BOOL_T : SCM_BOOL_F; \
}
#endif /* LY_SMOBS_ICC */
class Lyric_extender
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (print, (SCM));
};
{
public:
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (print, (SCM));
};
extern File_path global_path;
extern const char *LILYPOND_DATADIR;
-
/*
Debugging options: switch on
#include "grob-interface.hh"
#include "lily-proto.hh"
-
class Measure_grouping
{
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif /* MEASURE_GROUPING_SPANNER_HH */
class Melody_spanner
{
public:
- DECLARE_GROB_INTERFACE();
- static void add_stem (Grob*, Grob*);
- DECLARE_SCHEME_CALLBACK(calc_neutral_stem_direction, (SCM));
+ DECLARE_GROB_INTERFACE ();
+ static void add_stem (Grob *, Grob *);
+ DECLARE_SCHEME_CALLBACK (calc_neutral_stem_direction, (SCM));
};
#endif /* MELODY_SPANNER_HH */
#include "lily-proto.hh"
#include "grob-interface.hh"
-
/*
* These are all possible mensural ligature primitives.
*/
{
DECLARE_SCHEME_CALLBACK (brew_ligature_primitive, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif /* MENSURAL_LIGATURE_HH */
#include "virtual-methods.hh"
#include "std-vector.hh"
-
/**
timed MIDI event
*/
string to_string () const;
};
-
-
-
/**
variable sized MIDI data
*/
int port_;
DECLARE_CLASSNAME (Midi_track);
- vector<Midi_event*> events_;
+ vector<Midi_event *> events_;
Midi_track (int number, bool port);
~Midi_track ();
#include "std-vector.hh"
string int2midi_varint_string (int i);
-
+
/**
Any piece of midi information.
static Midi_item *get_midi (Audio_item *a);
-
virtual string to_string () const = 0;
};
Real seconds_;
};
-
/**
Change instrument event
*/
Audio_note *audio_;
-
static int const c0_pitch_ = 60;
Byte dynamic_byte_;
};
{
public:
enum Type
- {
- TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC,
- MARKER, CUE_POINT
- };
+ {
+ TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC,
+ MARKER, CUE_POINT
+ };
DECLARE_CLASSNAME (Midi_text);
Midi_text (Audio_text *);
~Midi_walker ();
void process ();
- void operator ++ (int);
+ void operator ++(int);
bool ok () const;
void finalize ();
void do_start_note (Midi_note *note);
void do_stop_notes (int);
void output_event (int, Midi_item *l);
- Midi_item *get_midi (Audio_item*);
+ Midi_item *get_midi (Audio_item *);
Midi_track *track_;
bool percussion_;
bool merge_unisons_;
vsize index_;
- vector<Audio_item*> items_;
+ vector<Audio_item *> items_;
PQueue<Midi_note_event> stop_note_queue;
int last_tick_;
- vector<Midi_item*> midi_events_;
+ vector<Midi_item *> midi_events_;
};
#endif // MIDI_WALKER_HH
inline int
shift_left (int value, int shiftamount)
{
- if (shiftamount < 0) return (value >> -shiftamount);
+ if (shiftamount < 0) return (value >> -shiftamount);
else return (value << shiftamount);
}
linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2)
{
return (x2 - x) / (x2 - x1) * y1
- + (x - x1) / (x2 - x1) * y2;
+ + (x - x1) / (x2 - x1) * y2;
}
Real directed_round (Real f, Direction d);
-Real peak_around (Real epsilon, Real threshold, Real x);
+Real peak_around (Real epsilon, Real threshold, Real x);
Real convex_amplifier (Real standard_x, Real increase_factor, Real x);
string camel_case_to_lisp_identifier (string in);
vsize utf8_char_len (char);
IMPLEMENT_ARITHMETIC_OPERATOR (Moment, +);
IMPLEMENT_ARITHMETIC_OPERATOR (Moment, -);
-IMPLEMENT_ARITHMETIC_OPERATOR (Moment, /);
+IMPLEMENT_ARITHMETIC_OPERATOR (Moment, / );
IMPLEMENT_ARITHMETIC_OPERATOR (Moment, *);
-IMPLEMENT_ARITHMETIC_OPERATOR (Moment, %);
+IMPLEMENT_ARITHMETIC_OPERATOR (Moment, % );
DECLARE_UNSMOB (Moment, moment);
int compare (Moment const &, Moment const &);
class Multi_measure_rest
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (percent, (SCM));
static void add_column (Grob *, Item *);
DECLARE_SCHEME_CALLBACK (set_text_rods, (SCM));
DECLARE_SCHEME_CALLBACK (centered_stencil, (SCM));
-
static void calculate_spacing_rods (Grob *me, Real length);
static Stencil big_rest (Grob *, Real);
static Stencil symbol_stencil (Grob *, Real);
Moment music_length_;
Moment start_mom_;
- DECLARE_CLASSNAME(Music_iterator);
+ DECLARE_CLASSNAME (Music_iterator);
DECLARE_SMOBS (Music_iterator);
Music_iterator (Music_iterator const &);
bool is_child_context (Context *me, Context *child);
-#define IMPLEMENT_CTOR_CALLBACK(Class) \
+#define IMPLEMENT_CTOR_CALLBACK(Class) \
LY_DEFINE_MEMBER_FUNCTION (Class, constructor, \
- mangle_cxx_identifier (string (#Class) + "::constructor").c_str(), \
- 0, 0, 0, \
- (), \
- "") \
- { \
- Class *c = (new Class); \
- return c->unprotect (); \
+ mangle_cxx_identifier (string (#Class) + "::constructor").c_str(), \
+ 0, 0, 0, \
+ (), \
+ "") \
+ { \
+ Class *c = (new Class); \
+ return c->unprotect (); \
}
DECLARE_UNSMOB (Music_iterator, iterator);
class Music_output
{
DECLARE_SMOBS (Music_output);
- DECLARE_CLASSNAME(Music_output);
+ DECLARE_CLASSNAME (Music_output);
protected:
Music_output ();
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
Music_wrapper_iterator ();
- DECLARE_CLASSNAME(Music_wrapper_iterator);
+ DECLARE_CLASSNAME (Music_wrapper_iterator);
virtual void derived_substitute (Context *f, Context *t);
virtual void derived_mark () const;
/// Scale the music in time by #factor#.
void compress (Moment factor);
-
+
// Broadcast the event in a context's event-source.
void send_to_context (Context *c);
DECLARE_SCHEME_CALLBACK (duration_length_callback, (SCM));
-
+
protected:
virtual SCM copy_mutable_properties () const;
virtual void type_check_assignment (SCM, SCM) const;
#include "grob-interface.hh"
#include "lily-proto.hh"
-
/**
Resolve conflicts between various Note_columns (chords).
class Note_collision_interface
{
public:
- static SCM automatic_shift (Grob *, Drul_array<vector<Grob*> >);
+ static SCM automatic_shift (Grob *, Drul_array<vector<Grob *> >);
static SCM forced_shift (Grob *);
- static Drul_array<vector<Grob*> > get_clash_groups (Grob *me);
+ static Drul_array<vector<Grob *> > get_clash_groups (Grob *me);
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM smob));
static void add_column (Grob *me, Grob *ncol);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif // COLLISION_HH
#include "grob-interface.hh"
#include "lily-proto.hh"
-
/** a struct for treating a group of noteheads (noteheads, stem
(chord) and scripts) as a single entity.
static bool has_rests (Grob *me);
static Grob *dot_column (Grob *me);
static Interval cross_staff_extent (Grob *me, Grob *refp);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Item *get_stem (Grob *);
};
#include "stencil.hh"
#include "grob-interface.hh"
-
class Note_head
{
public:
DECLARE_SCHEME_CALLBACK (stem_x_shift, (SCM));
DECLARE_SCHEME_CALLBACK (calc_stem_attachment, (SCM));
DECLARE_SCHEME_CALLBACK (include_ledger_line_height, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Real stem_attachment_coordinate (Grob *, Axis a);
static int get_balltype (Grob *);
class Note_spacing
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Spring get_spacing (Grob *me, Item *, Real, Real);
static void stem_dir_correction (Grob *me, Item *next_col, Real incr,
- Real *, Real *);
+ Real *, Real *);
};
#endif /* NOTE_SPACING_HH */
#ifndef OPEN_TYPE_FONT_HH
#define OPEN_TYPE_FONT_HH
-
#include "font-metric.hh"
Index_to_charcode_map make_index_to_charcode_map (FT_Face face);
-void get_unicode_name (char*s, FT_ULong code);
-void get_glyph_index_name (char*s, FT_ULong code);
+void get_unicode_name (char *s, FT_ULong code);
+void get_glyph_index_name (char *s, FT_ULong code);
class Open_type_font : public Font_metric
{
Index_to_charcode_map index_to_charcode_map_;
Open_type_font (FT_Face);
- DECLARE_CLASSNAME(Open_type_font);
+ DECLARE_CLASSNAME (Open_type_font);
public:
SCM get_subfonts () const;
SCM get_global_table () const;
SCM get_char_table () const;
SCM glyph_list () const;
-
+
string get_otf_table (string tag) const;
static SCM make_otf (string);
string font_name () const;
string get_otf_table (FT_Face face, string tag);
FT_Face open_ft_face (string str, FT_Long idx);
-
#endif /* OPEN_TYPE_FONT_HH */
{
/*
index into system_specs_, if this is VPOS, the Break_position represents the
- start of the book.
+ start of the book.
*/
vsize system_spec_index_;
/* if system_spec_index_ indexes a score, then we start at the score_brk_'th
possible page-break in the score */
- vsize score_break_;
+ vsize score_break_;
/* if system_spec_index_ indexes a score, this points to the broken column */
- Grob *col_;
+ Grob *col_;
bool score_ender_;
/* if non-zero, this is the (fixed, uncompressed) number of lines between
this Break_position and the previous. */
int forced_line_count_;
- Break_position (vsize s=VPOS, vsize brk=VPOS, Grob *g=NULL, bool end=false)
+ Break_position (vsize s = VPOS, vsize brk = VPOS, Grob *g = NULL, bool end = false)
{
system_spec_index_ = s;
score_break_ = brk;
/*
lexicographic in (system_spec_index_, score_break_)
*/
- bool operator< (const Break_position &other)
+ bool operator < (const Break_position &other)
{
return (system_spec_index_ == VPOS && other.system_spec_index_ != VPOS)
- || (system_spec_index_ < other.system_spec_index_)
- || (system_spec_index_ == other.system_spec_index_ && score_break_ < other.score_break_);
+ || (system_spec_index_ < other.system_spec_index_)
+ || (system_spec_index_ == other.system_spec_index_ && score_break_ < other.score_break_);
}
- bool operator<= (const Break_position &other)
+ bool operator <= (const Break_position &other)
{
return (system_spec_index_ == VPOS)
- || (system_spec_index_ < other.system_spec_index_ && other.system_spec_index_ != VPOS)
- || (system_spec_index_ == other.system_spec_index_ && score_break_ <= other.score_break_);
+ || (system_spec_index_ < other.system_spec_index_ && other.system_spec_index_ != VPOS)
+ || (system_spec_index_ == other.system_spec_index_ && score_break_ <= other.score_break_);
}
};
typedef bool (*Break_predicate) (Grob *);
typedef bool (*Prob_break_predicate) (Prob *);
typedef vector<vsize> Line_division;
-
+
/*
TODO: naming.
int line_count_status (int line_count) const;
bool too_many_lines (int line_count) const;
bool too_few_lines (int line_count) const;
- Real min_whitespace_at_top_of_page (Line_details const&) const;
- Real min_whitespace_at_bottom_of_page (Line_details const&) const;
+ Real min_whitespace_at_top_of_page (Line_details const &) const;
+ Real min_whitespace_at_bottom_of_page (Line_details const &) const;
int orphan_penalty () const;
protected:
vsize min_system_count (vsize start, vsize end);
vsize max_system_count (vsize start, vsize end);
-
void break_into_pieces (vsize start, vsize end, Line_division const &div);
SCM systems ();
SCM footnotes ();
void set_current_breakpoints (vsize start,
- vsize end,
- vsize system_count,
- Line_division lower_bound = Line_division (),
- Line_division upper_bound = Line_division ());
+ vsize end,
+ vsize system_count,
+ Line_division lower_bound = Line_division (),
+ Line_division upper_bound = Line_division ());
void set_to_ideal_line_configuration (vsize start, vsize end);
vsize current_configuration_count () const;
Line_division current_configuration (vsize configuration_index) const;
Page_spacing_result space_systems_on_n_pages (vsize configuration_index,
- vsize n, vsize first_page_num);
+ vsize n, vsize first_page_num);
Page_spacing_result space_systems_on_n_or_one_more_pages (vsize configuration_index, vsize n,
- vsize first_page_num,
- Real penalty_for_fewer_pages);
+ vsize first_page_num,
+ Real penalty_for_fewer_pages);
Page_spacing_result space_systems_on_best_pages (vsize configuration_index,
- vsize first_page_num);
+ vsize first_page_num);
Page_spacing_result space_systems_with_fixed_number_per_page (vsize configuration_index,
- vsize first_page_num);
+ vsize first_page_num);
Page_spacing_result pack_systems_on_least_pages (vsize configuration_index,
- vsize first_page_num);
+ vsize first_page_num);
vsize min_page_count (vsize configuration_index, vsize first_page_num);
bool all_lines_stretched (vsize configuration_index);
Real blank_page_penalty () const;
vector<Break_position> chunk_list (vsize start, vsize end);
Line_division system_count_bounds (vector<Break_position> const &chunks, bool min);
void line_breaker_args (vsize i,
- Break_position const &start,
- Break_position const &end,
- vsize *line_breaker_start,
- vsize *line_breaker_end);
+ Break_position const &start,
+ Break_position const &end,
+ vsize *line_breaker_start,
+ vsize *line_breaker_end);
void line_divisions_rec (vsize system_count,
- Line_division const &min,
- Line_division const &max,
- Line_division *cur);
+ Line_division const &min,
+ Line_division const &max,
+ Line_division *cur);
vector<Line_details> line_details (vsize start, vsize end, Line_division const &div);
Page_spacing_result space_systems_on_1_page (vector<Line_details> const &lines, Real page_height, bool ragged);
class Page_layout_problem
{
public:
- Page_layout_problem (Paper_book*, SCM page, SCM systems, int footnote_count);
+ Page_layout_problem (Paper_book *, SCM page, SCM systems, int footnote_count);
SCM solution (bool ragged);
void set_header_height (Real);
void set_footer_height (Real);
- static bool read_spacing_spec (SCM spec, Real* dest, SCM sym);
+ static bool read_spacing_spec (SCM spec, Real *dest, SCM sym);
static bool is_spaceable (Grob *g);
static SCM get_details (Grob *g);
static vsize get_footnote_count (SCM lines);
static SCM get_footnotes_from_lines (SCM lines, int counter, Paper_book *pb);
- static Stencil* get_footnote_separator_stencil (Output_def *paper);
+ static Stencil *get_footnote_separator_stencil (Output_def *paper);
static SCM get_spacing_spec (Grob *before, Grob *after, bool pure, int start, int end);
static Real get_fixed_spacing (Grob *before, Grob *after, int spaceable_index, bool pure, int start, int end);
static void add_footnotes_to_footer (SCM footnotes, Stencil *foot, Paper_book *pb);
protected:
- void append_system (System*, Spring const&, Real indent, Real padding);
- void append_prob (Prob*, Spring const&, Real padding);
+ void append_system (System *, Spring const &, Real indent, Real padding);
+ void append_prob (Prob *, Spring const &, Real padding);
void solve_rod_spring_problem (bool ragged);
SCM find_system_offsets ();
- void distribute_loose_lines (vector<Grob*> const&, vector<Real> const&, Real, Real);
+ void distribute_loose_lines (vector<Grob *> const &, vector<Real> const &, Real, Real);
- static void build_system_skyline (vector<Grob*> const&, vector<Real> const&, Skyline* up, Skyline* down);
- static vector<Grob*> filter_dead_elements (vector<Grob*> const&);
+ static void build_system_skyline (vector<Grob *> const &, vector<Real> const &, Skyline *up, Skyline *down);
+ static vector<Grob *> filter_dead_elements (vector<Grob *> const &);
// This is a union (in spirit).
// Either staves must be empty or prob must be null.
- typedef struct Element {
+ typedef struct Element
+ {
Prob *prob;
- vector<Grob*> staves;
+ vector<Grob *> staves;
vector<Real> min_offsets;
// Store the appropriate '*-*-spacing 'padding,
// for spacing any adjacent loose line
Real padding;
- Element (vector<Grob*> const& a, vector<Real> const& o, Real p)
+ Element (vector<Grob *> const &a, vector<Real> const &o, Real p)
{
staves = a;
min_offsets = o;
}
} Element;
- static Interval first_staff_extent (Element const&);
- static Interval last_staff_extent (Element const&);
- static Interval prob_extent (Prob*);
- static SCM get_details (Element const&);
- static SCM details_get_property (SCM details, const char*);
- static void alter_spring_from_spacing_spec (SCM spec, Spring* spring);
- static void mark_as_spaceable (Grob*);
+ static Interval first_staff_extent (Element const &);
+ static Interval last_staff_extent (Element const &);
+ static Interval prob_extent (Prob *);
+ static SCM get_details (Element const &);
+ static SCM details_get_property (SCM details, const char *);
+ static void alter_spring_from_spacing_spec (SCM spec, Spring *spring);
+ static void mark_as_spaceable (Grob *);
vector<Spring> springs_;
vector<Element> elements_;
// to represent the system count of several pages simultaneously,
// it could be that one page has too many systems while another
// has too few.
-typedef enum {
+typedef enum
+{
SYSTEM_COUNT_OK = 0,
SYSTEM_COUNT_TOO_MANY = 1,
SYSTEM_COUNT_TOO_FEW = 2
} System_count_status;
-struct Page_spacing_result {
+struct Page_spacing_result
+{
vector<vsize> systems_per_page_;
vector<Real> force_;
Real penalty_;
Real average_force () const;
vsize page_count () const;
- void print () const;
+ void print () const;
Page_spacing_result ();
};
const Real BAD_SPACING_PENALTY = 1e6;
const Real TERRIBLE_SPACING_PENALTY = 1e8;
-
/* for page_count > 2, we use a dynamic algorithm similar to
constrained-breaking -- we have a class that stores the intermediate
calculations so they can be reused for querying different page counts.
class Page_spacer
{
public:
- Page_spacer (vector<Line_details> const &lines, vsize first_page_num, Page_breaking const*);
+ Page_spacer (vector<Line_details> const &lines, vsize first_page_num, Page_breaking const *);
Page_spacing_result solve (vsize page_count);
Page_spacing_result solve ();
vsize total_page_count (Break_node const &b);
Break_node put_systems_on_pages (vsize start,
- vsize end,
- vsize configuration,
- vsize page_number);
+ vsize end,
+ vsize configuration,
+ vsize page_number);
SCM make_lines (vector<Break_node> *breaks);
SCM make_pages (vector<Break_node> const &breaks, SCM systems);
public:
SCM physical_font_tab () const;
Pango_font (PangoFT2FontMap *,
- PangoFontDescription const *,
- Real);
+ PangoFontDescription const *,
+ Real);
~Pango_font ();
- string description_string () const;
+ string description_string () const;
SCM font_file_name () const;
void register_font_file (string, string, int);
PangoFontDescription *
symbols_to_pango_font_description (SCM family,
- SCM style,
- SCM variant,
- SCM weight,
- SCM stretch);
+ SCM style,
+ SCM variant,
+ SCM weight,
+ SCM stretch);
Font_metric *
select_pango_font (Output_def *layout, SCM chain);
void add_score_title (SCM);
SCM get_score_title (SCM);
-
+
public:
SCM header_;
SCM header_0_;
SCM pages ();
SCM get_system_specs ();
-
Stencil book_title ();
Stencil score_title (SCM);
-
+
void classic_output (SCM output_channel);
void output (SCM output_channel);
protected:
void classic_output_aux (SCM output,
- int *first_performance_number);
+ int *first_performance_number);
int output_aux (SCM output_channel,
- bool is_last,
- int *first_page_number,
- int *first_performance_number);
+ bool is_last,
+ int *first_page_number,
+ int *first_performance_number);
};
DECLARE_UNSMOB (Paper_book, paper_book)
DECLARE_ACKNOWLEDGER (staff_spacing);
System *system_;
- vector<Stream_event*> break_events_;
- vector<Stream_event*> label_events_;
- int breaks_; // used for stat printing
+ vector<Stream_event *> break_events_;
+ vector<Stream_event *> label_events_;
+ int breaks_; // used for stat printing
Paper_column *command_column_;
Paper_column *musical_column_;
- vector<Item*> items_;
+ vector<Item *> items_;
bool first_;
bool made_columns_;
Moment last_moment_;
virtual System *get_system () const;
void set_system (System *);
- static int compare (Grob * const &a,
- Grob * const &b);
+ static int compare (Grob *const &a,
+ Grob *const &b);
static bool less_than (Grob *const &a,
- Grob *const &b);
+ Grob *const &b);
int get_rank () const { return rank_; }
void set_rank (int);
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static int get_rank (Grob const *);
static bool is_musical (Grob *);
static Moment when_mom (Grob *);
SCM systems_;
SCM paper_systems_;
- mutable vector<Grob*> cols_;
+ mutable vector<Grob *> cols_;
mutable vector<vsize> break_indices_;
mutable vector<vsize> break_ranks_;
public:
Paper_score (Output_def *);
-
- DECLARE_CLASSNAME(Paper_score);
+
+ DECLARE_CLASSNAME (Paper_score);
Output_def *layout () const;
System *root_system () const;
vector<Column_x_positions> calc_breaking ();
vector<vsize> get_break_indices () const;
vector<vsize> get_break_ranks () const;
- vector<Grob*> get_columns () const;
+ vector<Grob *> get_columns () const;
SCM get_paper_systems ();
protected:
void find_break_indices () const;
bool safe_;
Lily_parser *parser_;
- Parse_start() {
+ Parse_start ()
+ {
str = 0;
nchars = 0;
safe_ = false;
parser_ = 0;
- }
+ }
};
SCM catch_protected_parse_body (void *);
class Percent_repeat_item_interface
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (beat_slash, (SCM));
DECLARE_SCHEME_CALLBACK (double_percent, (SCM));
static Stencil x_percent (Grob *, int);
class Performance : public Music_output
{
public:
- Performance (bool ports=false);
+ Performance (bool ports = false);
~Performance ();
- DECLARE_CLASSNAME(Performance);
+ DECLARE_CLASSNAME (Performance);
void add_element (Audio_element *p);
virtual void process ();
void print () const;
void write_output (string filename) const;
- vector<Audio_staff*> audio_staffs_;
- vector<Audio_element*> audio_elements_;
+ vector<Audio_staff *> audio_staffs_;
+ vector<Audio_element *> audio_elements_;
Output_def *midi_;
bool ports_;
};
#include "smobs.hh"
#include "rational.hh"
-
/*
A "tonal" pitch. This is a pitch used in diatonal western music
(24 quartertones in an octave), as opposed to a frequency in Hz or a
DECLARE_SIMPLE_SMOBS (Pitch);
};
-
-enum {
+enum
+{
DOUBLE_FLAT = -4,
THREE_Q_FLAT,
FLAT,
static void add_grob (Grob *, SCM nm, SCM x);
static void add_unordered_grob (Grob *, SCM nm, Grob *);
static void set_ordered (Grob *, SCM, bool);
- static Grob_array *get_grob_array (Grob*, SCM);
- static Grob *find_grob (Grob*, SCM, bool (*pred) (Grob*));
+ static Grob_array *get_grob_array (Grob *, SCM);
+ static Grob *find_grob (Grob *, SCM, bool (*pred) (Grob *));
};
-vector<Grob*> const &internal_extract_grob_array (Grob const *elt, SCM symbol);
-vector<Item*> internal_extract_item_array (Grob const *elt, SCM symbol);
+vector<Grob *> const &internal_extract_grob_array (Grob const *elt, SCM symbol);
+vector<Item *> internal_extract_item_array (Grob const *elt, SCM symbol);
#define extract_grob_array(x, prop) internal_extract_grob_array (x, ly_symbol2scm (prop))
#define extract_item_array(x, prop) internal_extract_item_array (x, ly_symbol2scm (prop))
This is dubious coding style, but lets not risk that we change the
representation of grob sets again.
*/
-#define extract_grob_set(grob, prop, set) \
+#define extract_grob_set(grob, prop, set) \
vector<Grob*> const &set (internal_extract_grob_array (grob, ly_symbol2scm (prop)))
-#define extract_item_set(grob, prop, set) \
+#define extract_item_set(grob, prop, set) \
vector<Item*> set (internal_extract_item_array (grob, ly_symbol2scm (prop)))
#endif /* POINTER_GROUP_INTERFACE_HH */
#include "stencil.hh"
#include "virtual-methods.hh"
-
/*
A formatted "system" (A block of titling also is a Property_object)
class Prob
{
DECLARE_SMOBS (Prob);
- DECLARE_CLASSNAME(Prob);
+ DECLARE_CLASSNAME (Prob);
void init_vars ();
protected:
SCM mutable_property_alist_;
SCM immutable_property_alist_;
SCM type_;
-
+
virtual void derived_mark () const;
virtual SCM copy_mutable_properties () const;
- virtual void type_check_assignment (SCM,SCM) const;
-
+ virtual void type_check_assignment (SCM, SCM) const;
+
public:
Prob (SCM, SCM);
Prob (Prob const &);
SCM type () const { return type_; }
SCM get_property_alist (bool _mutable) const;
SCM internal_get_property (SCM sym) const;
- void instrumented_set_property (SCM, SCM, const char*, int, const char*);
+ void instrumented_set_property (SCM, SCM, const char *, int, const char *);
void internal_set_property (SCM sym, SCM val);
};
-DECLARE_UNSMOB(Prob,prob);
+DECLARE_UNSMOB (Prob, prob);
SCM ly_prob_set_property_x (SCM system, SCM sym, SCM value);
SCM ly_prob_property (SCM prob, SCM sym, SCM val);
SCM ly_prob_type_p (SCM obj, SCM sym);
-
+
#endif /* PROPERTY_OBJECT_HH */
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
DECLARE_SCHEME_CALLBACK (once_finalization, (SCM, SCM, SCM));
- DECLARE_CLASSNAME(Property_iterator);
+ DECLARE_CLASSNAME (Property_iterator);
protected:
virtual void do_quit ();
{
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
- DECLARE_CLASSNAME(Property_unset_iterator);
+ DECLARE_CLASSNAME (Property_unset_iterator);
protected:
virtual void process (Moment);
};
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
DECLARE_SCHEME_CALLBACK (once_finalization, (SCM, SCM));
- DECLARE_CLASSNAME(Push_property_iterator);
+ DECLARE_CLASSNAME (Push_property_iterator);
protected:
virtual void process (Moment);
virtual void do_quit ();
{
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
- DECLARE_CLASSNAME(Pop_property_iterator);
+ DECLARE_CLASSNAME (Pop_property_iterator);
protected:
virtual void process (Moment);
};
public:
static void add_column (Grob *me, Grob *);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM element));
DECLARE_SCHEME_CALLBACK (force_shift_callback_rest, (SCM element, SCM off));
static SCM do_shift (Grob *);
public:
DECLARE_SCHEME_CALLBACK (y_offset_callback, (SCM));
DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static string glyph_name (Grob *, int, string, bool);
- static SCM brew_internal_stencil (Grob*, bool);
- static SCM generic_extent_callback (Grob*, Axis);
+ static SCM brew_internal_stencil (Grob *, bool);
+ static SCM generic_extent_callback (Grob *, Axis);
static void translate (Grob *me, int dy);
DECLARE_SCHEME_CALLBACK (polyphonic_offset_callback, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
static Item *get_dots (Grob *);
static int dot_count (Grob *);
DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif // RHYTHMIC_HEAD_HH
struct Scale
{
public:
- Scale (vector<Rational> const&);
- Scale (Scale const&);
+ Scale (vector<Rational> const &);
+ Scale (Scale const &);
Rational tones_at_step (int step, int octave) const;
Rational step_size (int step) const;
#endif /* SCALE_HH */
-
-/*
+/*
scheme-engraver.hh -- declare Scheme_engraver
-
+
source file of the GNU LilyPond music typesetter
-
+
Copyright (c) 2009--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
LilyPond is free software: you can redistribute it and/or modify
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
-
+ along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SCHEME_ENGRAVER_HH
#include "engraver.hh"
-class Scheme_engraver : public Engraver {
+class Scheme_engraver : public Engraver
+{
public:
void init_from_scheme (SCM definition);
TRANSLATOR_DECLARATIONS_NO_LISTENER (Scheme_engraver);
-
+
static Listener get_listener (void *generic_arg, SCM event);
-
+
protected:
~Scheme_engraver ();
-
+
void stop_translation_timestep ();
void start_translation_timestep ();
void process_music ();
DECLARE_END_ACKNOWLEDGER (grob);
bool must_be_last_;
-
+
SCM acknowledge_grob_function_;
SCM stop_translation_timestep_function_;
SCM start_translation_timestep_function_;
{
System *system_;
- vector<Grob*> elems_;
+ vector<Grob *> elems_;
Paper_score *pscore_;
void typeset_all ();
static void add_side_positioned (Grob *, Grob *);
DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
DECLARE_SCHEME_CALLBACK (row_before_line_breaking, (SCM));
- DECLARE_GROB_INTERFACE();
- static void order_grobs (vector<Grob*> grobs);
+ DECLARE_GROB_INTERFACE ();
+ static void order_grobs (vector<Grob *> grobs);
};
static Stencil get_stencil (Grob *, Direction d);
static Direction get_direction (Grob *);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM));
DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
};
-void make_script_from_event (Grob *p, Context *tg,
- SCM type, int index);
+void make_script_from_event (Grob *p, Context *tg,
+ SCM type, int index);
#endif /* SCRIPT_INTERFACE_HH */
struct Self_alignment_interface
{
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static SCM aligned_on_self (Grob *me, Axis a, bool pure, int start, int end);
static SCM centered_on_object (Grob *me, Axis a);
static SCM aligned_on_parent (Grob *me, Axis a);
static void set_center_parent (Grob *me, Axis a);
static void set_align_self (Grob *me, Axis a);
-
+
DECLARE_SCHEME_CALLBACK (x_aligned_on_self, (SCM element));
DECLARE_SCHEME_CALLBACK (y_aligned_on_self, (SCM element));
struct Semi_tie_column
{
- DECLARE_GROB_INTERFACE();
-
+ DECLARE_GROB_INTERFACE ();
+
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM));
DECLARE_SCHEME_CALLBACK (calc_head_direction, (SCM));
};
-
#endif /* SEMI_TIE_COLUMN_HH */
#ifndef SEMI_TIE_HH
#define SEMI_TIE_HH
-
#include "grob-interface.hh"
#include "lily-proto.hh"
struct Semi_tie
{
- DECLARE_GROB_INTERFACE();
-
+ DECLARE_GROB_INTERFACE ();
+
DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM));
static bool less (Grob *const &s1,
- Grob *const &s2);
+ Grob *const &s2);
static int get_position (Grob *);
};
{
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
- DECLARE_CLASSNAME(Sequential_iterator);
+ DECLARE_CLASSNAME (Sequential_iterator);
Sequential_iterator ();
Sequential_iterator (Sequential_iterator const &);
virtual void derived_substitute (Context *f, Context *t);
protected:
virtual void process (Moment);
virtual bool run_always () const;
-
+
protected:
Music_iterator *iter_;
-
+
virtual SCM get_music_list () const;
virtual void next_element (bool side_effect);
DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM element));
DECLARE_SCHEME_CALLBACK (move_to_extremal_staff, (SCM));
- static SCM aligned_side (Grob*me, Axis a, bool pure, int start, int end, Real *current_off_ptr);
+ static SCM aligned_side (Grob *me, Axis a, bool pure, int start, int end, Real *current_off_ptr);
static SCM general_side_position (Grob *, Axis, bool, bool my_extents,
- bool pure, int start, int end, Real *current_off);
+ bool pure, int start, int end, Real *current_off);
static Axis get_axis (Grob *);
static void set_axis (Grob *, Axis);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static void add_support (Grob *, Grob *);
static void add_staff_support (Grob *);
};
class Simple_music_iterator : public Music_iterator
{
protected:
- DECLARE_CLASSNAME(Simple_music_iterator);
+ DECLARE_CLASSNAME (Simple_music_iterator);
Moment last_processed_mom_;
public:
void solve (Real line_len, bool ragged);
void add_rod (int l, int r, Real dist);
- void add_spring (Spring const&);
+ void add_spring (Spring const &);
Real range_ideal_len (int l, int r) const;
Real range_stiffness (int l, int r, bool stretch) const;
Real configuration_length (Real) const;
};
/* returns a vector of dimensions breaks.size () * breaks.size () */
-vector<Real> get_line_forces (vector<Grob*> const &columns,
- Real line_len,
- Real indent,
- bool ragged);
-
-Column_x_positions get_line_configuration (vector<Grob*> const &columns,
- Real line_len,
- Real indent,
- bool ragged);
+vector<Real> get_line_forces (vector<Grob *> const &columns,
+ Real line_len,
+ Real indent,
+ bool ragged);
+
+Column_x_positions get_line_configuration (vector<Grob *> const &columns,
+ Real line_len,
+ Real indent,
+ bool ragged);
#endif /* SIMPLE_SPACER_HH */
virtual void derived_substitute (Context *f, Context *t);
virtual void derived_mark () const;
DECLARE_SCHEME_CALLBACK (constructor, ());
- DECLARE_CLASSNAME(Simultaneous_music_iterator);
+ DECLARE_CLASSNAME (Simultaneous_music_iterator);
/// make a new context for every child.
bool create_separate_contexts_;
private:
Drul_array<Skyline> skylines_;
- DECLARE_SIMPLE_SMOBS(Skyline_pair);
+ DECLARE_SIMPLE_SMOBS (Skyline_pair);
public:
Skyline_pair ();
Skyline_pair (vector<Box> const &boxes, Real horizon_padding, Axis a);
Direction sky_;
void internal_merge_skyline (list<Building>*, list<Building>*,
- list<Building> *const result);
+ list<Building> *const result);
list<Building> internal_build_skyline (list<Box>*, Real, Axis, Direction);
- DECLARE_SIMPLE_SMOBS(Skyline);
+ DECLARE_SIMPLE_SMOBS (Skyline);
public:
Skyline ();
};
int next_scorer_todo;
-
+
Slur_configuration ();
Real score () const { return score_; }
- string card () const { return score_card_; }
+ string card () const { return score_card_; }
void add_score (Real, string);
-
+
void generate_curve (Slur_score_state const &state, Real r0, Real h_inf,
- vector<Offset> const &);
+ vector<Offset> const &);
void run_next_scorer (Slur_score_state const &);
bool done () const;
static Slur_configuration *new_config (Drul_array<Offset> const &offs, int idx);
class Slur_configuration_less
{
public:
- bool operator () (Slur_configuration* const& l, Slur_configuration* const& r)
+ bool operator () (Slur_configuration *const &l, Slur_configuration *const &r)
{
// Invert
return l->score_ > r->score_;
Real penalty_;
Grob *grob_;
SCM type_;
-
+
Extra_collision_info (Grob *g, Real idx, Interval x, Interval y, Real p);
Extra_collision_info ();
};
bool has_same_beam_;
Real musical_dy_;
- vector<Grob*> columns_;
+ vector<Grob *> columns_;
vector<Encompass_info> encompass_infos_;
vector<Extra_collision_info> extra_encompass_infos_;
Slur_score_parameters parameters_;
Drul_array<Bound_info> extremes_;
Drul_array<Offset> base_attachments_;
- vector<Slur_configuration*> configurations_;
+ vector<Slur_configuration *> configurations_;
Real staff_space_;
Real thickness_;
Slur_configuration *get_best_curve () const;
void fill (Grob *);
Direction slur_direction () const;
-
+
vector<Offset> generate_avoid_offsets () const;
Drul_array<Bound_info> get_bound_info () const;
void generate_curves () const;
- vector<Slur_configuration*> enumerate_attachments (Drul_array<Real> end_ys) const;
+ vector<Slur_configuration *> enumerate_attachments (Drul_array<Real> end_ys) const;
Drul_array<Offset> get_base_attachments () const;
Drul_array<Real> get_y_attachment_range () const;
Encompass_info get_encompass_info (Grob *col) const;
vector<Extra_collision_info> get_extra_encompass_infos () const;
Real move_away_from_staffline (Real y, Grob *on_staff) const;
- Grob *breakable_bound_item (Direction) const;
+ Grob *breakable_bound_item (Direction) const;
};
void set_slur_control_points (Grob *me);
static void add_column (Grob *me, Grob *col);
static void add_extra_encompass (Grob *me, Grob *col);
static void replace_breakable_encompass_objects (Grob *me);
- static void auxiliary_acknowledge_extra_object (Grob_info const &, vector<Grob*>&, vector<Grob*>&);
+ static void auxiliary_acknowledge_extra_object (Grob_info const &, vector<Grob *>&, vector<Grob *>&);
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM));
DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
DECLARE_SCHEME_CALLBACK (pure_outside_slur_callback, (SCM, SCM, SCM, SCM));
DECLARE_SCHEME_CALLBACK (outside_slur_cross_staff, (SCM, SCM));
DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Bezier get_curve (Grob *me);
};
from file "ly-smobs.icc"
*/
-#define DECLARE_SIMPLE_SMOBS(CL) \
- public: \
- SCM smobbed_copy () const; \
+#define DECLARE_SIMPLE_SMOBS(CL) \
+ public: \
+ SCM smobbed_copy () const; \
DECLARE_BASE_SMOBS (CL)
-#define DECLARE_BASE_SMOBS(CL) \
- friend class Non_existent_class; \
- private: \
+#define DECLARE_BASE_SMOBS(CL) \
+ friend class Non_existent_class; \
+ private: \
static const char* smob_name_; \
- static scm_t_bits smob_tag_; \
- static SCM mark_smob (SCM); \
- static size_t free_smob (SCM s); \
- static int print_smob (SCM s, SCM p, scm_print_state*); \
- public: \
- static SCM equal_p (SCM a, SCM b); \
- static CL *unsmob (SCM s) __attribute__((pure)) \
- { \
- if (SCM_NIMP (s) && SCM_CELL_TYPE (s) == smob_tag_) \
- return (CL *) SCM_CELL_WORD_1 (s); \
- else \
- return 0; \
- } \
- static SCM smob_p (SCM); \
- static void init_smobs (); \
+ static scm_t_bits smob_tag_; \
+ static SCM mark_smob (SCM); \
+ static size_t free_smob (SCM s); \
+ static int print_smob (SCM s, SCM p, scm_print_state*); \
+ public: \
+ static SCM equal_p (SCM a, SCM b); \
+ static CL *unsmob (SCM s) __attribute__((pure)) \
+ { \
+ if (SCM_NIMP (s) && SCM_CELL_TYPE (s) == smob_tag_) \
+ return (CL *) SCM_CELL_WORD_1 (s); \
+ else \
+ return 0; \
+ } \
+ static SCM smob_p (SCM); \
+ static void init_smobs (); \
private:
-#define DECLARE_SMOBS(CL) \
- DECLARE_BASE_SMOBS (CL) \
- protected: \
- virtual ~CL (); \
- SCM unprotected_smobify_self (); \
- private: \
- void smobify_self (); \
- SCM self_scm_; \
- SCM protection_cons_; \
- public: \
- SCM unprotect (); \
- void protect (); \
- SCM self_scm () const { return self_scm_; } \
+#define DECLARE_SMOBS(CL) \
+ DECLARE_BASE_SMOBS (CL) \
+ protected: \
+ virtual ~CL (); \
+ SCM unprotected_smobify_self (); \
+ private: \
+ void smobify_self (); \
+ SCM self_scm_; \
+ SCM protection_cons_; \
+ public: \
+ SCM unprotect (); \
+ void protect (); \
+ SCM self_scm () const { return self_scm_; } \
private:
-#define DECLARE_UNSMOB(CL, name) \
- inline CL * \
- unsmob_ ## name (SCM s) \
- { \
- return CL::unsmob (s); \
+#define DECLARE_UNSMOB(CL, name) \
+ inline CL * \
+ unsmob_ ## name (SCM s) \
+ { \
+ return CL::unsmob (s); \
}
#define DECLARE_TYPE_P(CL) extern SCM CL ## _type_p_proc
class Source_file
{
- vector<char const*> newline_locations_;
+ vector<char const *> newline_locations_;
istream *istream_;
vector<char> characters_;
SCM str_port_;
void load_stdin ();
void init_port ();
void init ();
-
+
DECLARE_SMOBS (Source_file);
public:
Source_file (string fn);
Slice line_slice (char const *pos_str0) const;
string line_string (char const *pos_str0) const;
void get_counts (char const *pos_str0, int *, int *, int *, int *) const;
-
+
SCM get_port () const;
string name_;
class Sources
{
Sources (Sources const &);
- vector<Source_file*> sourcefiles_;
+ vector<Source_file *> sourcefiles_;
public:
Sources ();
~Sources ();
- Source_file *get_file (string file_name, string const& currentpath);
+ Source_file *get_file (string file_name, string const ¤tpath);
void add (Source_file *sourcefile);
void set_path (File_path *);
static void add_spring (Grob *me, Grob *to, Spring sp);
static Spring get_spring (Grob *me, Grob *other);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static SCM get_minimum_distances (Grob *);
static SCM get_ideal_distances (Grob *);
};
struct Spacing_interface
{
static Real minimum_distance (Grob *me, Grob *right_col);
- static vector<Item*> right_note_columns (Grob *me);
- static vector<Item*> left_note_columns (Grob *me);
- static Item* right_column (Grob *me);
- static Item* left_column (Grob *me);
+ static vector<Item *> right_note_columns (Grob *me);
+ static vector<Item *> left_note_columns (Grob *me);
+ static Item *right_column (Grob *me);
+ static Item *left_column (Grob *me);
static Drul_array<Skyline> skylines (Grob *me, Grob *right_col);
- static Grob* extremal_break_aligned_grob (Grob *me, Direction, Direction, Interval*);
+ static Grob *extremal_break_aligned_grob (Grob *me, Direction, Direction, Interval *);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif /* SPACING_INTERFACE_HH */
Rational global_shortest_;
Real increment_;
Real shortest_duration_space_;
-
- Spacing_options();
+
+ Spacing_options ();
void init_from_grob (Grob *me);
Real get_duration_space (Rational d) const;
};
private:
static void set_distances_for_loose_col (Grob *me, Grob *c, Drul_array<Item *> next_door, Spacing_options const *);
static void generate_pair_spacing (Grob *me,
- Paper_column *l, Paper_column *r,
- Paper_column *nextr,
- Spacing_options const *options);
+ Paper_column *l, Paper_column *r,
+ Paper_column *nextr,
+ Spacing_options const *options);
static Real default_bar_spacing (Grob *, Grob *, Grob *, Moment);
- static Rational effective_shortest_duration (Grob *me, vector<Grob*> const &all);
+ static Rational effective_shortest_duration (Grob *me, vector<Grob *> const &all);
static void breakable_column_spacing (Grob *, Item *l, Item *r, Spacing_options const *);
- static void prune_loose_columns (Grob *, vector<Grob*> *cols, Spacing_options *);
- static void set_explicit_neighbor_columns (vector<Grob*> const &cols);
- static void set_implicit_neighbor_columns (vector<Grob*> const &cols);
- static void generate_springs (Grob *me, vector<Grob*> const &cols, Spacing_options const *);
+ static void prune_loose_columns (Grob *, vector<Grob *> *cols, Spacing_options *);
+ static void set_explicit_neighbor_columns (vector<Grob *> const &cols);
+ static void set_implicit_neighbor_columns (vector<Grob *> const &cols);
+ static void generate_springs (Grob *me, vector<Grob *> const &cols, Spacing_options const *);
static void musical_column_spacing (Grob *, Item *, Item *, Spacing_options const *);
static bool fills_measure (Grob *, Item *, Item *);
public:
- static vector<Grob*> get_columns (Grob *me);
+ static vector<Grob *> get_columns (Grob *me);
static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *);
static Spring standard_breakable_column_spacing (Grob *me, Item *l, Item *r, Spacing_options const *);
-
+
DECLARE_SCHEME_CALLBACK (set_springs, (SCM));
DECLARE_SCHEME_CALLBACK (calc_common_shortest_duration, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
#endif /* SPACING_SPANNER_HH */
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Interval get_spanned_interval (Grob *);
static void add_bar (Grob *, Grob *);
static void evaluate_glyph (Grob *);
Drul_array<Item *> spanned_drul_;
vsize break_index_;
- DECLARE_CLASSNAME(Spanner);
+ DECLARE_CLASSNAME (Spanner);
public:
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
DECLARE_SCHEME_CALLBACK (bounds_width, (SCM));
DECLARE_SCHEME_CALLBACK (kill_zero_spanned_time, (SCM));
- vector<Spanner*> broken_intos_;
+ vector<Spanner *> broken_intos_;
vsize get_break_index () const;
Spanner *broken_neighbor (Direction d) const;
-
+
// todo: move to somewhere else.
Real get_broken_left_end_align () const;
void substitute_one_mutable_property (SCM sym, SCM val);
static bool less (Spanner *const &, Spanner *const &);
virtual Grob *find_broken_piece (System *) const;
virtual void derived_mark () const;
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
virtual System *get_system () const;
SCM get_cached_pure_property (SCM sym, int start, int end);
Real inverse_stretch_strength () const {return inverse_stretch_strength_;}
Real inverse_compress_strength () const {return inverse_compress_strength_;}
Real blocking_force () const {return blocking_force_;}
-
+
Real length (Real f) const;
void set_distance (Real);
void set_default_compress_strength ();
void set_default_stretch_strength ();
- void operator*= (Real);
- bool operator> (Spring const&) const;
+ void operator *= (Real);
+ bool operator > (Spring const &) const;
};
DECLARE_UNSMOB (Spring, spring);
static Real next_notes_correction (Grob *, Grob *);
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Spring get_spacing (Grob *, Grob *right_col);
static Interval bar_y_positions (Grob *);
};
class Staff_symbol_referencer
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static bool ugly_hack (Grob *);
static void set_position (Grob *, Real);
DECLARE_SCHEME_CALLBACK (callback, (SCM element));
static Real get_position (Grob *);
static Real staff_radius (Grob *);
static int get_rounded_position (Grob *);
- static Interval extent_in_staff (Grob *);
+ static Interval extent_in_staff (Grob *);
};
int compare_position (Grob *const &, Grob *const &);
static Real staff_space (Grob *);
static Real get_line_thickness (Grob *);
static Real get_ledger_line_thickness (Grob *);
-
+
static int get_steps (Grob *);
static int line_count (Grob *);
static bool on_line (Grob *me, int pos);
static Interval line_span (Grob *);
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_SCHEME_CALLBACK (height, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_SCHEME_CALLBACK (height, (SCM));
+ DECLARE_GROB_INTERFACE ();
};
#endif // STAFF_SYMBOL_HH
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (calc_slope, (SCM));
DECLARE_SCHEME_CALLBACK (calc_width, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (calc_style, (SCM));
DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM));
static Stencil raw_stencil (Grob *, Real slope, Direction stemdir);
- static Stencil translated_stencil (Grob*, Real slope);
- static Stencil untranslated_stencil (Grob*, Real slope);
+ static Stencil translated_stencil (Grob *, Real slope);
+ static Stencil untranslated_stencil (Grob *, Real slope);
static Real get_beam_translation (Grob *me);
static Real vertical_length (Grob *me);
};
static Real chord_start_y (Grob *);
static void set_stemend (Grob *, Real);
static Slice beam_multiplicity (Grob *);
- static Direction get_default_dir (Grob*);
+ static Direction get_default_dir (Grob *);
static Real thickness (Grob *);
static int head_count (Grob *);
static bool is_invisible (Grob *);
static Interval head_positions (Grob *);
static Real stem_end_position (Grob *);
static Stencil flag (Grob *);
- static Stencil get_translated_flag (Grob*);
- DECLARE_GROB_INTERFACE();
+ static Stencil get_translated_flag (Grob *);
+ DECLARE_GROB_INTERFACE ();
static void set_spacing_hints (Grob *);
-
+
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (calc_default_direction, (SCM));
DECLARE_SCHEME_CALLBACK (offset_callback, (SCM element));
#ifndef STENCIL_HH
#define STENCIL_HH
-#include <cstdlib> // size_t
+#include <cstdlib> // size_t
using namespace std;
#include "lily-proto.hh"
DECLARE_UNSMOB (Stencil, stencil);
void interpret_stencil_expression (SCM expr,
- void (*func) (void *, SCM),
- void *func_arg,
- Offset o);
+ void (*func) (void *, SCM),
+ void *func_arg,
+ Offset o);
SCM find_expression_fonts (SCM expr);
void register_stencil_head (SCM symbol);
bool is_stencil_head (SCM symbol);
SCM all_stencil_heads ();
-
#endif /* STENCIL_HH */
Stream_event ();
VIRTUAL_COPY_CONSTRUCTOR (Stream_event, Stream_event);
- Stream_event (SCM event_class, SCM mutable_props=SCM_EOL);
+ Stream_event (SCM event_class, SCM mutable_props = SCM_EOL);
Stream_event (SCM class_name, Input *);
Input *origin () const;
#if __GNUC__ > 2
ostream *open_file_stream (string file_name,
- ios_base::openmode mode = ios::out);
+ ios_base::openmode mode = ios::out);
#else
ostream *open_file_stream (string file_name, int mode = ios::out);
#endif
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static void try_collapse (Grob *);
static Stencil staff_bracket (Grob *, Real);
static Stencil old_staff_bracket (Grob *, Real);
static Stencil staff_brace (Grob *, Real);
static Stencil simple_bar (Grob *, Real);
static Stencil line_bracket (Grob *, Real);
-
+
};
#endif /* SYSTEM_START_DELIMITER_HH */
int rank_;
Grob_array *all_elements_;
void init_elements ();
- friend class Paper_score; // ugh.
- Paper_score *pscore_; // ugh.
+ friend class Paper_score; // ugh.
+ Paper_score *pscore_; // ugh.
bool checked_footnotes_;
vector<Grob *> footnote_grobs_; // TODO: make this a grob array
public:
Paper_score *paper_score () const;
Grob *get_vertical_alignment ();
- Grob *get_extremal_staff (Direction dir, Interval const&);
+ Grob *get_extremal_staff (Direction dir, Interval const &);
Grob *get_pure_bound (Direction dir, int start, int end);
Grob *get_maybe_pure_bound (Direction dir, bool pure, int start, int end);
int get_rank () const;
int spanner_count () const;
void break_into_pieces (vector<Column_x_positions> const &);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
- vector<Item*> broken_col_range (Item const *, Item const *) const;
- vector<Grob*> used_columns () const;
+ vector<Item *> broken_col_range (Item const *, Item const *) const;
+ vector<Grob *> used_columns () const;
Paper_column *column (vsize i) const;
void add_column (Paper_column *);
#include "stencil.hh"
#include "grob-interface.hh"
-
class Text_interface
{
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (interpret_markup, (SCM, SCM, SCM));
DECLARE_SCHEME_CALLBACK (interpret_string, (SCM, SCM, SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static bool is_markup (SCM);
static bool is_markup_list (SCM);
};
#include "tie-configuration.hh"
void set_chord_outline (Skyline *skyline,
- vector<Item*> bounds,
- Grob *common,
- Direction d);
+ vector<Item *> bounds,
+ Grob *common,
+ Direction d);
void set_tie_config_directions (Ties_configuration *tie_configs_ptr);
void shift_small_ties (Ties_configuration *tie_configs,
- Grob *staff_referencer,
- Tie_details const &details);
+ Grob *staff_referencer,
+ Tie_details const &details);
void final_shape_adjustment (Tie_configuration &conf,
- Tie_formatting_problem const&,
- Grob *staff_referencer);
+ Tie_formatting_problem const &,
+ Grob *staff_referencer);
void
set_chord_outlines (Drul_array<Skyline> *skyline_drul,
- vector<Grob*> ties,
- Grob *common);
+ vector<Grob *> ties,
+ Grob *common);
void
set_manual_tie_configuration (Ties_configuration *tie_configs,
- bool *manual_override,
- SCM manual_configs
- );
-
+ bool *manual_override,
+ SCM manual_configs
+ );
#endif /* TIE_COLUMN_FORMAT_HH */
class Tie_column
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static void add_tie (Grob *me, Grob *);
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM));
DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
Direction dir_;
Real delta_y_;
Drul_array<int> column_ranks_;
-
+
/* computed. */
Interval attachment_x_;
void center_tie_vertically (Tie_details const &);
Bezier get_transformed_bezier (Tie_details const &) const;
Bezier get_untransformed_bezier (Tie_details const &) const;
- Real height (Tie_details const&) const;
+ Real height (Tie_details const &) const;
int column_span_length () const;
-
+
static int compare (Tie_configuration const &a,
- Tie_configuration const &b);
+ Tie_configuration const &b);
static Real distance (Tie_configuration const &a,
- Tie_configuration const &b);
+ Tie_configuration const &b);
};
INSTANTIATE_COMPARE (Tie_configuration, Tie_configuration::compare);
void add_tie_score (Real amount, int i, string description);
Real score () const;
void reset_score ();
- string card () const;
+ string card () const;
string tie_card (int i) const { return tie_score_cards_[i]; }
string complete_tie_card (vsize i) const;
- string complete_score_card () const;
+ string complete_score_card () const;
};
#endif /* TIE_CONFIGURATION_HH */
-
-
Real ratio_;
Real staff_space_;
Real x_gap_;
- Real stem_gap_;
+ Real stem_gap_;
Real between_length_limit_;
Real wrong_direction_offset_penalty_;
Real same_dir_as_stem_penalty_;
int single_tie_region_size_;
int multi_tie_region_size_;
Direction neutral_direction_;
-
+
Tie_details ();
void from_grob (Grob *);
};
#endif /* TIE_DETAILS_HH */
-
#include <map>
#include <set>
-typedef map< Tuple<int,4>, Tie_configuration *> Tie_configuration_map;
+typedef map< Tuple<int, 4>, Tie_configuration *> Tie_configuration_map;
struct Tie_configuration_variation
{
vector<pair<int, Tie_configuration *> > index_suggestion_pairs_;
- void add_suggestion(int index, Tie_configuration* suggestion)
+ void add_suggestion (int index, Tie_configuration *suggestion)
{
index_suggestion_pairs_.push_back (make_pair (index, suggestion));
}
Column_extent_map stem_extents_;
Column_extent_map head_extents_;
Position_extent_map head_positions_;
-
+
set<int> dot_positions_;
Interval dot_x_;
vector<Tie_specification> specifications_;
bool use_horizontal_spacing_;
-
+
Tie_configuration_map possibilities_;
Grob *x_refpoint_;
Grob *y_refpoint_;
-
Tie_configuration *get_configuration (int position, Direction dir, Drul_array<int> cols, bool tune_y) const;
Tie_configuration *generate_configuration (int position, Direction dir, Drul_array<int> cols, bool tune_y) const;
vector<Tie_configuration_variation> generate_collision_variations (Ties_configuration const &ties) const;
vector<Tie_configuration_variation> generate_extremal_tie_variations (Ties_configuration const &ties) const;
vector<Tie_configuration_variation> generate_single_tie_variations (Ties_configuration const &ties) const;
-
+
void score_configuration (Tie_configuration *) const;
Real score_aptitude (Tie_configuration *, Tie_specification const &,
- Ties_configuration *, int) const;
+ Ties_configuration *, int) const;
void score_ties_aptitude (Ties_configuration *ties) const;
void score_ties_configuration (Ties_configuration *ties) const;
void set_ties_config_standard_directions (Ties_configuration *tie_configs_ptr);
void score_ties (Ties_configuration *) const;
-
+
Slice head_positions_slice (int) const;
Ties_configuration generate_base_chord_configuration ();
Ties_configuration find_best_variation (Ties_configuration const &base,
- vector<Tie_configuration_variation> const &vars);
+ vector<Tie_configuration_variation> const &vars);
public:
Tie_details details_;
void print_ties_configuration (Ties_configuration const *);
- Interval get_stem_extent (int, Direction, Axis) const;
- Interval get_head_extent (int, Direction, Axis) const;
-
+ Interval get_stem_extent (int, Direction, Axis) const;
+ Interval get_head_extent (int, Direction, Axis) const;
+
public:
Tie_formatting_problem ();
~Tie_formatting_problem ();
Ties_configuration generate_optimal_configuration ();
Ties_configuration generate_ties_configuration (Ties_configuration const &);
- void from_ties (vector<Grob*> const &ties);
+ void from_ties (vector<Grob *> const &ties);
void from_tie (Grob *tie);
- void from_semi_ties (vector<Grob*> const &, Direction head_dir);
- void set_chord_outline (vector<Item*>, Direction);
- void set_column_chord_outline (vector<Item*>, Direction, int rank);
+ void from_semi_ties (vector<Grob *> const &, Direction head_dir);
+ void set_chord_outline (vector<Item *>, Direction);
+ void set_column_chord_outline (vector<Item *>, Direction, int rank);
void set_manual_tie_configuration (SCM);
Interval get_attachment (Real, Drul_array<int>) const;
Grob *common_x_refpoint () const;
struct Tie_specification
{
int position_;
- Drul_array<Grob*> note_head_drul_;
+ Drul_array<Grob *> note_head_drul_;
Drul_array<int> column_ranks_;
Grob *tie_grob_;
-
+
bool has_manual_position_;
bool has_manual_dir_;
bool has_manual_delta_y_;
bool has_accidental_;
-
+
Real manual_position_;
Direction manual_dir_;
-
+
Tie_specification ();
int column_span () const;
void from_grob (Grob *);
#include "skyline.hh"
#include "grob-interface.hh"
-
-
-
class Tie
{
public:
static void set_head (Grob *, Direction, Grob *head);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Grob *head (Grob *, Direction);
static int get_column_rank (Grob *, Direction);
static int get_position (Grob *);
- static Direction get_default_dir (Grob *);
+ static Direction get_default_dir (Grob *);
static SCM get_control_points (Grob *, Grob *,
- Tie_configuration const&,
- Tie_details const&);
+ Tie_configuration const &,
+ Tie_details const &);
static SCM get_default_control_points (Grob *);
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM));
static bool less (Grob *const &s1,
- Grob *const &s2);
+ Grob *const &s2);
};
-
#endif // TIE_HH
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
/* construction */
- DECLARE_CLASSNAME(Time_scaled_music_iterator);
+ DECLARE_CLASSNAME (Time_scaled_music_iterator);
Time_scaled_music_iterator ();
protected:
virtual SCM get_music_list () const;
*/
struct Time_signature
{
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
static Stencil special_time_signature (Grob *, SCM, int, int);
static Stencil numbered_time_signature (Grob *, int, int);
DECLARE_SCHEME_CALLBACK (print, (SCM));
public:
void apply (Grob_info);
SCM static create (SCM trans_list,
- SCM iface_list, Direction);
+ SCM iface_list, Direction);
DECLARE_SIMPLE_SMOBS (Engraver_dispatch_list);
};
SCM names_to_translators (SCM namelist, Context *tg);
void recurse_over_translators (Context *c, Translator_method ptr,
- Translator_group_method ptr2, Direction);
+ Translator_group_method ptr2, Direction);
void precomputed_recurse_over_translators (Context *c, Translator_precompute_index idx, Direction dir);
Translator_group *get_translator_group (SCM sym);
#include "global-ctor.hh"
#include "lily-proto.hh"
#include "virtual-methods.hh"
-#include "input.hh" // for error reporting
+#include "input.hh" // for error reporting
#include "smobs.hh"
#include "std-vector.hh"
#include "protected-scm.hh"
SCM symbol_;
Engraver_void_function_engraver_grob_info function_;
- Acknowledge_information () {
+ Acknowledge_information ()
+ {
symbol_ = SCM_EOL;
function_ = 0;
}
};
-
/*
Each translator class has a static list of listener records. Each
record makes one explains how to register one of the class's stream event
listeners to a context.
*/
-typedef struct translator_listener_record {
+typedef struct translator_listener_record
+{
Listener (*get_listener_) (void *, SCM event_class);
SCM event_class_;
struct translator_listener_record *next_;
- translator_listener_record () {
+ translator_listener_record ()
+ {
next_ = 0;
event_class_ = SCM_EOL;
get_listener_ = 0;
}
-
-} translator_listener_record;
+} translator_listener_record;
#define TRANSLATOR_DECLARATIONS_NO_LISTENER(NAME) \
-private: \
- public: \
- NAME (); \
- VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \
- static SCM static_description_; \
+private: \
+ public: \
+ NAME (); \
+ VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \
+ static SCM static_description_; \
static Drul_array<vector<Acknowledge_information> > acknowledge_static_array_drul_; \
virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]); \
- virtual SCM static_translator_description () const; \
- virtual SCM translator_description () const; \
+ virtual SCM static_translator_description () const; \
+ virtual SCM translator_description () const; \
static Engraver_void_function_engraver_grob_info static_get_acknowledger (SCM sym); \
static Engraver_void_function_engraver_grob_info static_get_end_acknowledger(SCM); \
virtual Engraver_void_function_engraver_grob_info get_acknowledger (SCM sym) \
- { \
- return static_get_acknowledger (sym); \
- } \
+ { \
+ return static_get_acknowledger (sym); \
+ } \
virtual Engraver_void_function_engraver_grob_info get_end_acknowledger (SCM sym) \
- { \
- return static_get_end_acknowledger (sym); \
+ { \
+ return static_get_end_acknowledger (sym); \
} \
/* end #define */
-#define TRANSLATOR_DECLARATIONS(NAME) \
- TRANSLATOR_DECLARATIONS_NO_LISTENER(NAME) \
-private: \
- static translator_listener_record *listener_list_; \
-public: \
- virtual translator_listener_record *get_listener_list () const \
- { \
- return listener_list_; \
- } \
+#define TRANSLATOR_DECLARATIONS(NAME) \
+ TRANSLATOR_DECLARATIONS_NO_LISTENER(NAME) \
+private: \
+ static translator_listener_record *listener_list_; \
+public: \
+ virtual translator_listener_record *get_listener_list () const \
+ { \
+ return listener_list_; \
+ } \
/* end #define */
-#define DECLARE_TRANSLATOR_LISTENER(m) \
-public: \
-inline void listen_ ## m (Stream_event *); \
-/* Should be private */ \
-static void _internal_declare_ ## m (); \
-private: \
- static Listener _get_ ## m ## _listener (void *, SCM); \
+#define DECLARE_TRANSLATOR_LISTENER(m) \
+public: \
+inline void listen_ ## m (Stream_event *); \
+/* Should be private */ \
+static void _internal_declare_ ## m (); \
+private: \
+ static Listener _get_ ## m ## _listener (void *, SCM); \
DECLARE_LISTENER (_listen_scm_ ## m);
#define DECLARE_ACKNOWLEDGER(x) public : void acknowledge_ ## x (Grob_info); protected:
#define DECLARE_END_ACKNOWLEDGER(x) public : void acknowledge_end_ ## x (Grob_info); protected:
enum Translator_precompute_index
- {
- START_TRANSLATION_TIMESTEP,
- STOP_TRANSLATION_TIMESTEP,
- PROCESS_MUSIC,
- PROCESS_ACKNOWLEDGED,
- TRANSLATOR_METHOD_PRECOMPUTE_COUNT,
- };
+{
+ START_TRANSLATION_TIMESTEP,
+ STOP_TRANSLATION_TIMESTEP,
+ PROCESS_MUSIC,
+ PROCESS_ACKNOWLEDGED,
+ TRANSLATOR_METHOD_PRECOMPUTE_COUNT,
+};
/*
Translate music into grobs.
TRANSLATOR_DECLARATIONS (Translator);
DECLARE_SMOBS (Translator);
-protected: // should be private.
+protected: // should be private.
Context *daddy_context_;
void protect_event (SCM ev);
virtual void derived_mark () const;
static void add_translator_listener (translator_listener_record **listener_list,
- translator_listener_record *r,
- Listener (*get_listener) (void *, SCM),
- const char *ev_class);
- SCM static_translator_description (const char *grobs,
- const char *desc,
- translator_listener_record *listener_list,
- const char *read,
- const char *write) const;
+ translator_listener_record *r,
+ Listener (*get_listener) (void *, SCM),
+ const char *ev_class);
+ SCM static_translator_description (const char *grobs,
+ const char *desc,
+ translator_listener_record *listener_list,
+ const char *read,
+ const char *write) const;
friend class Translator_group;
};
Moment get_event_length (Stream_event *s);
DECLARE_UNSMOB (Translator, translator);
-
/*
This helper is only meaningful inside listen_* methods.
*/
extern bool internal_event_assignment (Stream_event **old_ev, Stream_event *new_ev, const char *function);
#define ASSIGN_EVENT_ONCE(o,n) internal_event_assignment (&o, n, __FUNCTION__)
-
-
#endif // TRANSLATOR_HH
/**
A macro to automate administration of translators.
*/
-#define ADD_THIS_TRANSLATOR(T) \
- SCM T::static_description_ = SCM_EOL; \
- static void _ ## T ## _adder () \
- { \
- T *t = new T; \
- T::static_description_ = t->static_translator_description (); \
- scm_permanent_object (T::static_description_); \
- add_translator (t); \
- } \
- SCM T::translator_description () const \
- { \
- return static_description_; \
- } \
+#define ADD_THIS_TRANSLATOR(T) \
+ SCM T::static_description_ = SCM_EOL; \
+ static void _ ## T ## _adder () \
+ { \
+ T *t = new T; \
+ T::static_description_ = t->static_translator_description (); \
+ scm_permanent_object (T::static_description_); \
+ add_translator (t); \
+ } \
+ SCM T::translator_description () const \
+ { \
+ return static_description_; \
+ } \
ADD_GLOBAL_CTOR (_ ## T ## _adder); \
/* end define */
#define DEFINE_TRANSLATOR_LISTENER_LIST(T) \
- translator_listener_record *T::listener_list_; \
+ translator_listener_record *T::listener_list_; \
/* end define */
#define DEFINE_ACKNOWLEDGERS(classname) \
- Drul_array< vector<Acknowledge_information> > classname::acknowledge_static_array_drul_; \
- Engraver_void_function_engraver_grob_info \
- classname::static_get_acknowledger (SCM sym) \
- { \
- return generic_get_acknowledger (sym, &acknowledge_static_array_drul_[START]); \
- } \
- Engraver_void_function_engraver_grob_info \
- classname::static_get_end_acknowledger (SCM sym) \
- { \
- return generic_get_acknowledger (sym, &acknowledge_static_array_drul_[STOP]); \
- } \
+ Drul_array< vector<Acknowledge_information> > classname::acknowledge_static_array_drul_; \
+ Engraver_void_function_engraver_grob_info \
+ classname::static_get_acknowledger (SCM sym) \
+ { \
+ return generic_get_acknowledger (sym, &acknowledge_static_array_drul_[START]); \
+ } \
+ Engraver_void_function_engraver_grob_info \
+ classname::static_get_end_acknowledger (SCM sym) \
+ { \
+ return generic_get_acknowledger (sym, &acknowledge_static_array_drul_[STOP]); \
+ } \
/* end define */
-#define DEFINE_TRANSLATOR_DOC(classname, desc, grobs, read, write) \
- SCM \
- classname::static_translator_description () const \
- { \
+#define DEFINE_TRANSLATOR_DOC(classname, desc, grobs, read, write) \
+ SCM \
+ classname::static_translator_description () const \
+ { \
return Translator::static_translator_description (grobs, desc, listener_list_, read, write); \
}
-#define ADD_TRANSLATOR(classname, desc, grobs, read, write) \
- IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS (classname); \
- ADD_THIS_TRANSLATOR (classname); \
- DEFINE_TRANSLATOR_DOC(classname, desc, grobs, read, write) \
+#define ADD_TRANSLATOR(classname, desc, grobs, read, write) \
+ IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS (classname); \
+ ADD_THIS_TRANSLATOR (classname); \
+ DEFINE_TRANSLATOR_DOC(classname, desc, grobs, read, write) \
DEFINE_ACKNOWLEDGERS(classname) \
DEFINE_TRANSLATOR_LISTENER_LIST(classname) \
-
-#define IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(T) \
- void \
- T::fetch_precomputable_methods (Translator_void_method_ptr ptrs[]) \
- { \
- ptrs[START_TRANSLATION_TIMESTEP] = \
- ((Translator_void_method_ptr) & T::start_translation_timestep == \
+
+#define IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(T) \
+ void \
+ T::fetch_precomputable_methods (Translator_void_method_ptr ptrs[]) \
+ { \
+ ptrs[START_TRANSLATION_TIMESTEP] = \
+ ((Translator_void_method_ptr) & T::start_translation_timestep == \
(Translator_void_method_ptr) & Translator::start_translation_timestep) \
- ? 0 \
- : (Translator_void_method_ptr) & T::start_translation_timestep; \
- \
- ptrs[STOP_TRANSLATION_TIMESTEP] = \
+ ? 0 \
+ : (Translator_void_method_ptr) & T::start_translation_timestep; \
+ \
+ ptrs[STOP_TRANSLATION_TIMESTEP] = \
((Translator_void_method_ptr) & T::stop_translation_timestep == (Translator_void_method_ptr) & Translator::stop_translation_timestep) \
- ? 0 \
- : (Translator_void_method_ptr) & T::stop_translation_timestep; \
- \
- ptrs[PROCESS_MUSIC] = \
+ ? 0 \
+ : (Translator_void_method_ptr) & T::stop_translation_timestep; \
+ \
+ ptrs[PROCESS_MUSIC] = \
((Translator_void_method_ptr) & T::process_music == (Translator_void_method_ptr) & Translator::process_music) \
- ? 0 \
- : (Translator_void_method_ptr) & T::process_music; \
- \
- ptrs[PROCESS_ACKNOWLEDGED] = \
+ ? 0 \
+ : (Translator_void_method_ptr) & T::process_music; \
+ \
+ ptrs[PROCESS_ACKNOWLEDGED] = \
((Translator_void_method_ptr) & T::process_acknowledged == (Translator_void_method_ptr) & Translator::process_acknowledged) \
- ? 0 \
- : (Translator_void_method_ptr) & T::process_acknowledged; \
+ ? 0 \
+ : (Translator_void_method_ptr) & T::process_acknowledged; \
}
void add_acknowledger (Engraver_void_function_engraver_grob_info ptr,
- char const *func_name,
- vector<Acknowledge_information> *ack_array);
+ char const *func_name,
+ vector<Acknowledge_information> *ack_array);
Engraver_void_function_engraver_grob_info
generic_get_acknowledger (SCM sym,
- vector<Acknowledge_information> const *ack_array);
+ vector<Acknowledge_information> const *ack_array);
-#define ADD_ACKNOWLEDGER(CLASS, NAME) \
- void CLASS ## NAME ## _ack_adder () \
- { \
+#define ADD_ACKNOWLEDGER(CLASS, NAME) \
+ void CLASS ## NAME ## _ack_adder () \
+ { \
add_acknowledger ((Engraver_void_function_engraver_grob_info) & CLASS::acknowledge_ ## NAME, #NAME, &CLASS::acknowledge_static_array_drul_[START]); \
- } \
+ } \
ADD_SCM_INIT_FUNC (CLASS ## NAME ## _ack_adder_initclass, CLASS ## NAME ## _ack_adder);
-#define ADD_END_ACKNOWLEDGER(CLASS, NAME) \
- void CLASS ## NAME ## _end_ack_adder () \
- { \
+#define ADD_END_ACKNOWLEDGER(CLASS, NAME) \
+ void CLASS ## NAME ## _end_ack_adder () \
+ { \
add_acknowledger ((Engraver_void_function_engraver_grob_info) & CLASS::acknowledge_end_ ## NAME, #NAME, &CLASS::acknowledge_static_array_drul_[STOP]); \
- } \
+ } \
ADD_SCM_INIT_FUNC (CLASS ## NAME ## _end_ack_adder_initclass, CLASS ## NAME ## _end_ack_adder);
/*
- Implement the method cl::listen_##m, and make it listen to stream
+ Implement the method cl::listen_##m, and make it listen to stream
events of class m.
*/
-#define IMPLEMENT_TRANSLATOR_LISTENER(cl, m) \
-void \
-cl :: _internal_declare_ ## m () \
-{ \
- static translator_listener_record r; \
+#define IMPLEMENT_TRANSLATOR_LISTENER(cl, m) \
+void \
+cl :: _internal_declare_ ## m () \
+{ \
+ static translator_listener_record r; \
add_translator_listener (&listener_list_, &r, _get_ ## m ## _listener, #m); \
-} \
- \
-ADD_SCM_INIT_FUNC (cl ## _declare_event_ ## m, cl::_internal_declare_ ## m); \
- \
-Listener \
+} \
+ \
+ADD_SCM_INIT_FUNC (cl ## _declare_event_ ## m, cl::_internal_declare_ ## m); \
+ \
+Listener \
cl :: _get_ ## m ## _listener (void *me, SCM unused) \
-{ \
- cl *obj = (cl *) me; \
+{ \
+ cl *obj = (cl *) me; \
(void) unused; \
- return obj->GET_LISTENER (_listen_scm_ ## m); \
-} \
- \
-IMPLEMENT_LISTENER (cl, _listen_scm_ ## m) \
-void \
-cl::_listen_scm_ ## m (SCM sev) \
-{ \
- Stream_event *ev = unsmob_stream_event (sev); \
- protect_event (sev); \
- listen_ ## m (ev); \
+ return obj->GET_LISTENER (_listen_scm_ ## m); \
+} \
+ \
+IMPLEMENT_LISTENER (cl, _listen_scm_ ## m) \
+void \
+cl::_listen_scm_ ## m (SCM sev) \
+{ \
+ Stream_event *ev = unsmob_stream_event (sev); \
+ protect_event (sev); \
+ listen_ ## m (ev); \
}
#endif /* TRANSLATOR_ICC */
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (calc_connect_to_neighbors, (SCM smob));
DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
-
- DECLARE_GROB_INTERFACE();
- static Grob* get_common_x (Spanner *);
+
+ DECLARE_GROB_INTERFACE ();
+ static Grob *get_common_x (Spanner *);
static void add_tuplet_bracket (Grob *me, Grob *smaller_bracket);
static void get_bounds (Grob *, Grob **, Grob **);
static void add_column (Grob *me, Item *);
static void add_beam (Grob *me, Grob *);
- static Grob *parallel_beam (Grob *me, vector<Grob*> const &cols,
- bool *equally_long);
+ static Grob *parallel_beam (Grob *me, vector<Grob *> const &cols,
+ bool *equally_long);
static void calc_position_and_height (Grob *, Real *, Real *dy);
static Stencil make_bracket (Grob *me, Axis protrusion_axis,
- Offset dz, Drul_array<Real> height,
- Interval gap, Drul_array<Real> widen,
- Drul_array<Real> shorten);
+ Offset dz, Drul_array<Real> height,
+ Interval gap, Drul_array<Real> widen,
+ Drul_array<Real> shorten);
static Direction get_default_dir (Grob *);
};
{
DECLARE_SCHEME_CALLBACK (brew_ligature_primitive, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
/*
class Volta_bracket_interface
{
public:
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (print, (SCM));
static void modify_edge_height (Spanner *);
static void add_bar (Grob *me, Item *bar);
/* We don't use IMPLEMENT_TYPE_P, since the smobification part is
implemented separately from the class. */
LY_DEFINE (ly_input_location_p, "ly:input-location?", 1, 0, 0,
- (SCM x),
- "Is @var{x} an @code{input-location}?")
+ (SCM x),
+ "Is @var{x} an @code{input-location}?")
{
return unsmob_input (x) ? SCM_BOOL_T : SCM_BOOL_F;
}
LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 1, (SCM sip, SCM msg, SCM rest),
- "Print @var{msg} as a GNU compliant error message, pointing"
- " to the location in @var{sip}. @var{msg} is interpreted"
- " similar to @code{format}'s argument, using @var{rest}.")
+ "Print @var{msg} as a GNU compliant error message, pointing"
+ " to the location in @var{sip}. @var{msg} is interpreted"
+ " similar to @code{format}'s argument, using @var{rest}.")
{
Input *ip = unsmob_input (sip);
LY_ASSERT_TYPE (unsmob_input, sip, 1);
- LY_ASSERT_TYPE (scm_is_string, msg,2);
+ LY_ASSERT_TYPE (scm_is_string, msg, 2);
msg = scm_simple_format (SCM_BOOL_F, msg, rest);
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_input_file_line_char_column,
- "ly:input-file-line-char-column",
- 1, 0, 0, (SCM sip),
- "Return input location in @var{sip} as"
- " @code{(file-name line char column)}.")
+ "ly:input-file-line-char-column",
+ 1, 0, 0, (SCM sip),
+ "Return input location in @var{sip} as"
+ " @code{(file-name line char column)}.")
{
LY_ASSERT_TYPE (unsmob_input, sip, 1);
Input *ip = unsmob_input (sip);
int l, ch, col, offset = 0;
ip->get_counts (&l, &ch, &col, &offset);
return scm_list_4 (ly_string2scm (ip->file_string ()),
- scm_from_int (l),
- scm_from_int (ch),
- scm_from_int (col));
+ scm_from_int (l),
+ scm_from_int (ch),
+ scm_from_int (col));
}
LY_DEFINE (ly_input_both_locations,
- "ly:input-both-locations",
- 1, 0, 0, (SCM sip),
- "Return input location in @var{sip} as"
- " @code{(file-name first-line first-column last-line last-column)}.")
+ "ly:input-both-locations",
+ 1, 0, 0, (SCM sip),
+ "Return input location in @var{sip} as"
+ " @code{(file-name first-line first-column last-line last-column)}.")
{
-
+
LY_ASSERT_TYPE (unsmob_input, sip, 1);
Input *ip = unsmob_input (sip);
-
+
return scm_list_5 (ly_string2scm (ip->file_string ()),
- scm_from_int (ip->line_number ()),
- scm_from_int (ip->column_number ()),
- scm_from_int (ip->end_line_number ()),
- scm_from_int (ip->end_column_number ()));
+ scm_from_int (ip->line_number ()),
+ scm_from_int (ip->column_number ()),
+ scm_from_int (ip->end_line_number ()),
+ scm_from_int (ip->end_column_number ()));
}
{
Input *a = (Input *) SCM_CELL_WORD_1 (sa);
Input *b = (Input *) SCM_CELL_WORD_1 (sb);
- if (a->get_source_file () == b->get_source_file () &&
- a->start () == b->start () &&
- a->end () == b->end ())
+ if (a->get_source_file () == b->get_source_file ()
+ && a->start () == b->start ()
+ && a->end () == b->end ())
return SCM_BOOL_T;
else
return SCM_BOOL_F;
{
if (source_file_)
s = location_string () + ": " + s + "\n"
- + source_file_->quote_input (start_) + "\n";
+ + source_file_->quote_input (start_) + "\n";
::message (s);
}
-
void
Input::programming_error (string s) const
{
if (get_program_option ("warning-as-error"))
::error (s);
- else {
- message (_f ("programming error: %s", s.c_str ()));
- message (_ ("continuing, cross fingers") + "\n");
- }
+ else
+ {
+ message (_f ("programming error: %s", s.c_str ()));
+ message (_ ("continuing, cross fingers") + "\n");
+ }
}
-
void
Input::warning (string s) const
{
SCM short_text_;
vector<Grob *> axis_groups_;
-
+
virtual void finalize ();
DECLARE_ACKNOWLEDGER (axis_group);
void process_music ();
SCM short_text = get_property ("shortInstrumentName");
if (!(Text_interface::is_markup (long_text)
- || Text_interface::is_markup (short_text)))
+ || Text_interface::is_markup (short_text)))
{
long_text = get_property ("vocalName");
short_text = get_property ("shortVocalName");
if ((Text_interface::is_markup (long_text)
|| Text_interface::is_markup (short_text))
&& (!text_spanner_
- || short_text_ != short_text
- || long_text_ != long_text))
+ || short_text_ != short_text
+ || long_text_ != long_text))
{
if (text_spanner_)
- stop_spanner ();
+ stop_spanner ();
short_text_ = short_text;
long_text_ = long_text;
{
for (vsize i = 0; i < axis_groups_.size (); i++)
Pointer_group_interface::add_grob (text_spanner_,
- ly_symbol2scm ("elements"),
- axis_groups_[i]);
-
+ ly_symbol2scm ("elements"),
+ axis_groups_[i]);
+
text_spanner_->set_bound (RIGHT,
- unsmob_grob (get_property ("currentCommandColumn")));
+ unsmob_grob (get_property ("currentCommandColumn")));
Pointer_group_interface::set_ordered (text_spanner_,
- ly_symbol2scm ("elements"),
- false);
+ ly_symbol2scm ("elements"),
+ false);
text_spanner_ = 0;
}
-
ADD_ACKNOWLEDGER (Instrument_name_engraver, axis_group);
ADD_TRANSLATOR (Instrument_name_engraver,
- /* doc */
- "Create a system start text for instrument or vocal names.",
-
- /* create */
- "InstrumentName ",
-
- /* read */
- "currentCommandColumn "
- "instrumentName "
- "shortInstrumentName "
- "shortVocalName "
- "vocalName ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create a system start text for instrument or vocal names.",
+
+ /* create */
+ "InstrumentName ",
+
+ /* read */
+ "currentCommandColumn "
+ "instrumentName "
+ "shortInstrumentName "
+ "shortVocalName "
+ "vocalName ",
+
+ /* write */
+ ""
+ );
#include "translator.icc"
-
class Instrument_switch_engraver : public Engraver
{
}
ADD_TRANSLATOR (Instrument_switch_engraver,
- /* doc */
- "Create a cue text for taking instrument.",
-
- /* create */
- "InstrumentSwitch ",
-
- /* read */
- "instrumentCueName ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create a cue text for taking instrument.",
+
+ /* create */
+ "InstrumentSwitch ",
+
+ /* read */
+ "instrumentCueName ",
+
+ /* write */
+ ""
+ );
#include "item.hh"
-
LY_DEFINE (ly_item_p, "ly:item?",
- 1, 0, 0, (SCM g),
- "Is @var{g} an @code{Item} object?")
+ 1, 0, 0, (SCM g),
+ "Is @var{g} an @code{Item} object?")
{
Grob *me = unsmob_grob (g);
bool b = dynamic_cast<Item *> (me);
}
LY_DEFINE (ly_item_break_dir, "ly:item-break-dir",
- 1, 0, 0, (SCM it),
- "The break status direction of item @var{it}. @code{-1} means"
- " end of line, @code{0}@tie{}unbroken, and"
- " @code{1}@tie{}beginning of line.")
+ 1, 0, 0, (SCM it),
+ "The break status direction of item @var{it}. @code{-1} means"
+ " end of line, @code{0}@tie{}unbroken, and"
+ " @code{1}@tie{}beginning of line.")
{
LY_ASSERT_TYPE (unsmob_item, it, 1);
Item *me = unsmob_item (it);
#include "moment.hh"
-
Grob *
Item::clone () const
{
{
Grob *s = broken_to_drul_[d];
if (s && s->get_system () == l)
- return s;
+ return s;
}
while (flip (&d) != LEFT);
bool
Item::break_visible (Grob *g)
{
- Item *it = dynamic_cast<Item*> (g);
+ Item *it = dynamic_cast<Item *> (g);
SCM vis = g->get_property ("break-visibility");
if (scm_is_vector (vis))
return to_boolean (scm_c_vector_ref (vis, it->break_status_dir () + 1));
int pos = 1;
int pc_rank = Paper_column::get_rank (get_column ());
if (pc_rank == start)
- pos = 2;
+ pos = 2;
else if (pc_rank == end)
- pos = 0;
+ pos = 0;
return to_boolean (scm_vector_ref (vis, scm_from_int (pos)));
}
return true;
}
Interval_t<Moment>
-spanned_time_interval (Item *l, Item *r)
+spanned_time_interval (Item *l, Item *r)
{
- Drul_array<Item*> bounds (l, r);
+ Drul_array<Item *> bounds (l, r);
Interval_t<Moment> iv;
Direction d = LEFT;
do
{
if (bounds[d] && bounds[d]->get_column ())
- iv[d] = robust_scm2moment (bounds[d]->get_column ()->get_property ("when"),
- iv[d]);
+ iv[d] = robust_scm2moment (bounds[d]->get_column ()->get_property ("when"),
+ iv[d]);
}
while (flip (&d) != LEFT);
do
{
if (!bounds[d] || !bounds[d]->get_column ())
- iv[d] = iv[-d];
+ iv[d] = iv[-d];
}
while (flip (&d) != LEFT);
-
-
+
return iv;
}
-
void
Item::derived_mark () const
{
}
ADD_INTERFACE (Item,
- "Grobs can be distinguished in their role in the horizontal"
- " spacing. Many grobs define constraints on the spacing by"
- " their sizes, for example, note heads, clefs, stems, and all"
- " other symbols with a fixed shape. These grobs form a"
- " subtype called @code{Item}.\n"
- "\n"
- "Some items need special treatment for line breaking. For"
- " example, a clef is normally only printed at the start of a"
- " line (i.e., after a line break). To model this,"
- " @q{breakable} items (clef, key signature, bar lines, etc.)"
- " are copied twice. Then we have three versions of each"
- " breakable item: one version if there is no line break, one"
- " version that is printed before the line break (at the end of"
- " a system), and one version that is printed after the line"
- " break.\n"
- "\n"
- "Whether these versions are visible and take up space is"
- " determined by the outcome of the @code{break-visibility}"
- " grob property, which is a function taking a direction"
- " (@code{-1}, @code{0} or@tie{}@code{1}) as an argument. It"
- " returns a cons of booleans, signifying whether this grob"
- " should be transparent and have no extent.\n"
- "\n"
- "The following variables for @code{break-visibility} are"
- " predefined:\n"
- "@example\n"
- " grob will show: before no after\n"
- " break break break\n"
- " all-invisible no no no\n"
- " begin-of-line-visible no no yes\n"
- " end-of-line-visible yes no no\n"
- " all-visible yes yes yes\n"
- " begin-of-line-invisible yes yes no\n"
- " end-of-line-invisible no yes yes\n"
- " center-invisible yes no yes\n"
- "@end example",
-
- /* properties */
- "break-visibility "
- "extra-spacing-height "
- "extra-spacing-width "
- "non-musical "
- );
+ "Grobs can be distinguished in their role in the horizontal"
+ " spacing. Many grobs define constraints on the spacing by"
+ " their sizes, for example, note heads, clefs, stems, and all"
+ " other symbols with a fixed shape. These grobs form a"
+ " subtype called @code{Item}.\n"
+ "\n"
+ "Some items need special treatment for line breaking. For"
+ " example, a clef is normally only printed at the start of a"
+ " line (i.e., after a line break). To model this,"
+ " @q{breakable} items (clef, key signature, bar lines, etc.)"
+ " are copied twice. Then we have three versions of each"
+ " breakable item: one version if there is no line break, one"
+ " version that is printed before the line break (at the end of"
+ " a system), and one version that is printed after the line"
+ " break.\n"
+ "\n"
+ "Whether these versions are visible and take up space is"
+ " determined by the outcome of the @code{break-visibility}"
+ " grob property, which is a function taking a direction"
+ " (@code{-1}, @code{0} or@tie{}@code{1}) as an argument. It"
+ " returns a cons of booleans, signifying whether this grob"
+ " should be transparent and have no extent.\n"
+ "\n"
+ "The following variables for @code{break-visibility} are"
+ " predefined:\n"
+ "@example\n"
+ " grob will show: before no after\n"
+ " break break break\n"
+ " all-invisible no no no\n"
+ " begin-of-line-visible no no yes\n"
+ " end-of-line-visible yes no no\n"
+ " all-visible yes yes yes\n"
+ " begin-of-line-invisible yes yes no\n"
+ " end-of-line-invisible no yes yes\n"
+ " center-invisible yes no yes\n"
+ "@end example",
+
+ /* properties */
+ "break-visibility "
+ "extra-spacing-height "
+ "extra-spacing-width "
+ "non-musical "
+ );
class Keep_alive_together_engraver: public Engraver
{
- vector<Grob*> group_spanners_;
+ vector<Grob *> group_spanners_;
public:
TRANSLATOR_DECLARATIONS (Keep_alive_together_engraver);
ADD_ACKNOWLEDGER (Keep_alive_together_engraver, hara_kiri_group_spanner);
ADD_TRANSLATOR (Keep_alive_together_engraver,
- /* doc */
- "This engraver collects all @code{Hara_kiri_group_spanner}s "
- "that are created in contexts at or below its own. "
- "These spanners are then tied together so that one will "
- "be removed only if all are removed. For example, "
- "if a @code{StaffGroup} uses this engraver, then the staves "
- "in the group will all be visible as long as there is a note "
- "in at least one of them.",
-
- /* create */
- "",
-
- /* read */
- "",
-
- /* write */
- ""
- );
+ /* doc */
+ "This engraver collects all @code{Hara_kiri_group_spanner}s "
+ "that are created in contexts at or below its own. "
+ "These spanners are then tied together so that one will "
+ "be removed only if all are removed. For example, "
+ "if a @code{StaffGroup} uses this engraver, then the staves "
+ "in the group will all be visible as long as there is a note "
+ "in at least one of them.",
+
+ /* create */
+ "",
+
+ /* read */
+ "",
+
+ /* write */
+ ""
+ );
cancellation_ = 0;
}
-
void
Key_engraver::create_key (bool is_default)
{
if (!item_)
{
item_ = make_item ("KeySignature",
- key_event_ ? key_event_->self_scm () : SCM_EOL);
+ key_event_ ? key_event_->self_scm () : SCM_EOL);
/* Use middleCClefPosition rather than middleCPosition, because cue
- * notes with a different clef will modify middleCPosition. The
+ * notes with a different clef will modify middleCPosition. The
* Key signature, however, should still be printed at the original
* position. */
item_->set_property ("c0-position",
- get_property ("middleCClefPosition"));
+ get_property ("middleCClefPosition"));
SCM last = get_property ("lastKeySignature");
SCM key = get_property ("keySignature");
if ((to_boolean (get_property ("printKeyCancellation"))
- || key == SCM_EOL)
- && !scm_is_eq (last, key))
- {
- SCM restore = SCM_EOL;
- SCM *tail = &restore;
- for (SCM s = last; scm_is_pair (s); s = scm_cdr (s))
- {
- SCM new_alter_pair = scm_assoc (scm_caar (s), key);
- Rational old_alter = robust_scm2rational (scm_cdar (s), 0);
- if (new_alter_pair == SCM_BOOL_F
- || ((ly_scm2rational (scm_cdr (new_alter_pair)) - old_alter) * old_alter
- < Rational (0)))
- {
- *tail = scm_cons (scm_car (s), *tail);
- tail = SCM_CDRLOC (*tail);
- }
- }
-
- if (scm_is_pair (restore))
- {
- cancellation_ = make_item ("KeyCancellation",
- key_event_
- ? key_event_->self_scm () : SCM_EOL);
-
- cancellation_->set_property ("alteration-alist", scm_reverse (restore));
- cancellation_->set_property ("c0-position",
- get_property ("middleCPosition"));
- }
- }
+ || key == SCM_EOL)
+ && !scm_is_eq (last, key))
+ {
+ SCM restore = SCM_EOL;
+ SCM *tail = &restore;
+ for (SCM s = last; scm_is_pair (s); s = scm_cdr (s))
+ {
+ SCM new_alter_pair = scm_assoc (scm_caar (s), key);
+ Rational old_alter = robust_scm2rational (scm_cdar (s), 0);
+ if (new_alter_pair == SCM_BOOL_F
+ || ((ly_scm2rational (scm_cdr (new_alter_pair)) - old_alter) * old_alter
+ < Rational (0)))
+ {
+ *tail = scm_cons (scm_car (s), *tail);
+ tail = SCM_CDRLOC (*tail);
+ }
+ }
+
+ if (scm_is_pair (restore))
+ {
+ cancellation_ = make_item ("KeyCancellation",
+ key_event_
+ ? key_event_->self_scm () : SCM_EOL);
+
+ cancellation_->set_property ("alteration-alist", scm_reverse (restore));
+ cancellation_->set_property ("c0-position",
+ get_property ("middleCPosition"));
+ }
+ }
item_->set_property ("alteration-alist", scm_reverse (key));
}
scm_is_pair (s) && scm_is_pair (alist); s = scm_cdr (s))
{
SCM head = scm_member (scm_car (s), alist);
-
+
if (scm_is_pair (head))
- {
- accs = scm_cons (scm_car (head), accs);
- alist = scm_delete_x (scm_car (head), alist);
- }
+ {
+ accs = scm_cons (scm_car (head), accs);
+ alist = scm_delete_x (scm_car (head), alist);
+ }
}
if (scm_is_pair (alist))
{
bool warn = false;
for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s))
- if (ly_scm2rational (scm_cdar (s)))
- {
- warn = true;
- accs = scm_cons (scm_car (s), accs);
- }
+ if (ly_scm2rational (scm_cdar (s)))
+ {
+ warn = true;
+ accs = scm_cons (scm_car (s), accs);
+ }
if (warn)
- r->origin ()->warning ("Incomplete keyAlterationOrder for key signature");
+ r->origin ()->warning ("Incomplete keyAlterationOrder for key signature");
}
-
+
context ()->set_property ("keySignature", scm_reverse (accs));
context ()->set_property ("tonic",
- r->get_property ("tonic"));
+ r->get_property ("tonic"));
}
void
ADD_ACKNOWLEDGER (Key_engraver, bar_line);
ADD_TRANSLATOR (Key_engraver,
- /* doc */
- "Engrave a key signature.",
-
- /* create */
- "KeyCancellation "
- "KeySignature ",
-
- /* read */
- "createKeyOnClefChange "
- "explicitKeySignatureVisibility "
- "extraNatural "
- "keyAlterationOrder "
- "keySignature "
- "lastKeySignature "
- "printKeyCancellation "
- "middleCClefPosition ",
-
- /* write */
- "keySignature "
- "lastKeySignature "
- "tonic "
- );
+ /* doc */
+ "Engrave a key signature.",
+
+ /* create */
+ "KeyCancellation "
+ "KeySignature ",
+
+ /* read */
+ "createKeyOnClefChange "
+ "explicitKeySignatureVisibility "
+ "extraNatural "
+ "keyAlterationOrder "
+ "keySignature "
+ "lastKeySignature "
+ "printKeyCancellation "
+ "middleCClefPosition ",
+
+ /* write */
+ "keySignature "
+ "lastKeySignature "
+ "tonic "
+ );
SCM acc = scm_call_1 (proc, pitchlist);
Pitch key_do (0,
- scm_to_int (scm_caar (pitchlist)),
- ly_scm2rational (scm_cdar (pitchlist)));
+ scm_to_int (scm_caar (pitchlist)),
+ ly_scm2rational (scm_cdar (pitchlist)));
Pitch c_do (0, 0, 0);
SCM c_pitchlist
- = ly_transpose_key_alist (pitchlist,
- pitch_interval (key_do, c_do).smobbed_copy ());
+ = ly_transpose_key_alist (pitchlist,
+ pitch_interval (key_do, c_do).smobbed_copy ());
/* MIDI keys are too limited for lilypond scales.
- We check for minor scale and assume major otherwise. */
+ We check for minor scale and assume major otherwise. */
SCM third = scm_assoc (scm_from_int (2),
- c_pitchlist);
+ c_pitchlist);
bool minor = (scm_is_pair (third)
- && scm_is_number (scm_cdr (third))
- && ly_scm2rational (scm_cdr (third)) == FLAT_ALTERATION);
+ && scm_is_number (scm_cdr (third))
+ && ly_scm2rational (scm_cdr (third)) == FLAT_ALTERATION);
audio_ = new Audio_key (scm_to_int (acc),
- !minor);
+ !minor);
Audio_element_info info (audio_, key_ev_);
announce_element (info);
}
ADD_TRANSLATOR (Key_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
DECLARE_GROB_INTERFACE ();
};
-
/*
TODO
- space the `natural' signs wider
SCM c0s = me->get_property ("c0-position");
bool is_cancellation = me->internal_has_interface
- (ly_symbol2scm ("key-cancellation-interface"));
+ (ly_symbol2scm ("key-cancellation-interface"));
/*
SCM lists are stacks, so we work from right to left, ending with
int last_pos = -1000;
SCM last_glyph_name = SCM_BOOL_F;
SCM padding_pairs = me->get_property ("padding-pairs");
-
+
Font_metric *fm = Font_interface::get_default_font (me);
SCM alist = me->get_property ("glyph-name-alist");
for (SCM s = me->get_property ("alteration-alist"); scm_is_pair (s); s = scm_cdr (s))
{
SCM alt = is_cancellation
- ? scm_from_int (0)
- : scm_cdar (s);
+ ? scm_from_int (0)
+ : scm_cdar (s);
SCM glyph_name_scm = ly_assoc_get (alt, alist, SCM_BOOL_F);
if (!scm_is_string (glyph_name_scm))
- {
- me->warning (_f ("No glyph found for alteration: %s",
- ly_scm2rational (alt).to_string ().c_str ()));
- continue;
- }
+ {
+ me->warning (_f ("No glyph found for alteration: %s",
+ ly_scm2rational (alt).to_string ().c_str ()));
+ continue;
+ }
string glyph_name = ly_scm2string (glyph_name_scm);
Stencil acc (fm->find_by_name (glyph_name));
if (acc.is_empty ())
- me->warning (_ ("alteration not found"));
+ me->warning (_ ("alteration not found"));
else
- {
- SCM what = scm_caar (s);
-
- SCM proc = ly_lily_module_constant ("key-signature-interface::alteration-position");
-
- int pos = scm_to_int (scm_call_3 (proc, what, scm_cdar (s), c0s));
- acc.translate_axis (pos * inter, Y_AXIS);
-
- /*
- The natural sign (unlike flat & sharp)
- has vertical edges on both sides. A little padding is
- needed to prevent collisions.
- */
- Real padding = robust_scm2double (me->get_property ("padding"),
- 0.0);
- SCM handle = scm_assoc (scm_cons (glyph_name_scm, last_glyph_name),
- padding_pairs);
- if (scm_is_pair (handle))
- padding = robust_scm2double (scm_cdr (handle), 0.0);
- else if (glyph_name == "accidentals.natural"
- && last_pos < pos + 2
- && last_pos > pos - 6)
- padding += 0.3;
-
- mol.add_at_edge (X_AXIS, LEFT, acc, padding);
-
- last_pos = pos;
- last_glyph_name = glyph_name_scm;
- }
+ {
+ SCM what = scm_caar (s);
+
+ SCM proc = ly_lily_module_constant ("key-signature-interface::alteration-position");
+
+ int pos = scm_to_int (scm_call_3 (proc, what, scm_cdar (s), c0s));
+ acc.translate_axis (pos * inter, Y_AXIS);
+
+ /*
+ The natural sign (unlike flat & sharp)
+ has vertical edges on both sides. A little padding is
+ needed to prevent collisions.
+ */
+ Real padding = robust_scm2double (me->get_property ("padding"),
+ 0.0);
+ SCM handle = scm_assoc (scm_cons (glyph_name_scm, last_glyph_name),
+ padding_pairs);
+ if (scm_is_pair (handle))
+ padding = robust_scm2double (scm_cdr (handle), 0.0);
+ else if (glyph_name == "accidentals.natural"
+ && last_pos < pos + 2
+ && last_pos > pos - 6)
+ padding += 0.3;
+
+ mol.add_at_edge (X_AXIS, LEFT, acc, padding);
+
+ last_pos = pos;
+ last_glyph_name = glyph_name_scm;
+ }
}
mol.align_to (X_AXIS, LEFT);
}
ADD_INTERFACE (Key_signature_interface,
- "A group of accidentals, to be printed as signature sign.",
-
- /* properties */
- "alteration-alist "
- "c0-position "
- "glyph-name-alist "
- "padding "
- "padding-pairs "
- );
+ "A group of accidentals, to be printed as signature sign.",
+
+ /* properties */
+ "alteration-alist "
+ "c0-position "
+ "glyph-name-alist "
+ "padding "
+ "padding-pairs "
+ );
{
Stream_event *event_;
Grob *lv_column_;
- vector<Grob*> lv_ties_;
+ vector<Grob *> lv_ties_;
void stop_translation_timestep ();
DECLARE_ACKNOWLEDGER (note_head);
lv_tie->set_object ("note-head", inf.grob ()->self_scm ());
Pointer_group_interface::add_grob (lv_column_, ly_symbol2scm ("ties"),
- lv_tie);
+ lv_tie);
if (is_direction (unsmob_stream_event (cause)->get_property ("direction")))
{
ADD_ACKNOWLEDGER (Laissez_vibrer_engraver, note_head);
ADD_TRANSLATOR (Laissez_vibrer_engraver,
- /* doc */
- "Create laissez vibrer items.",
+ /* doc */
+ "Create laissez vibrer items.",
- /* create */
- "LaissezVibrerTie "
- "LaissezVibrerTieColumn ",
+ /* create */
+ "LaissezVibrerTie "
+ "LaissezVibrerTieColumn ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
void
minimise_least_squares (Real *coef, Real *offset,
- vector<Offset> const &input)
+ vector<Offset> const &input)
{
Real sx = 0.0;
Real sy = 0.0;
Real sqx = 0.0;
Real sxy = 0.0;
- for (vsize i = 0; i < input.size ();i++)
+ for (vsize i = 0; i < input.size (); i++)
{
Real x = input[i][X_AXIS];
Real y = input[i][Y_AXIS];
sx += x;
sy += y;
sqx += sqr (x);
- sxy += x*y;
+ sxy += x * y;
}
int count = input.size ();
if (!count || !den)
{
programming_error ("minimise_least_squares (): Nothing to minimise\n"
- "This means that vertical spacing is triggered\n"
- "before line breaking\n");
+ "This means that vertical spacing is triggered\n"
+ "before line breaking\n");
*coef = 0.0;
*offset = count ? sy / count : 0.0;
}
class Ledger_line_engraver : public Engraver
{
Spanner *span_;
- vector<Grob*> ledgered_grobs_;
-
+ vector<Grob *> ledgered_grobs_;
+
public:
TRANSLATOR_DECLARATIONS (Ledger_line_engraver);
if (span_)
{
for (vsize i = 0; i < ledgered_grobs_.size (); i++)
- {
- if (!to_boolean (ledgered_grobs_[i]->get_property ("no-ledgers")))
- Pointer_group_interface::add_grob (span_,
- ly_symbol2scm ("note-heads"),
- ledgered_grobs_[i]);
- }
+ {
+ if (!to_boolean (ledgered_grobs_[i]->get_property ("no-ledgers")))
+ Pointer_group_interface::add_grob (span_,
+ ly_symbol2scm ("note-heads"),
+ ledgered_grobs_[i]);
+ }
}
ledgered_grobs_.clear ();
Ledger_line_engraver::process_music ()
{
/*
- Need to do this, otherwise the first note might miss ledgers.
+ Need to do this, otherwise the first note might miss ledgers.
*/
if (!span_)
start_spanner ();
ADD_ACKNOWLEDGER (Ledger_line_engraver, ledgered);
ADD_ACKNOWLEDGER (Ledger_line_engraver, staff_symbol);
ADD_TRANSLATOR (Ledger_line_engraver,
- /* doc */
- "Create the spanner to draw ledger lines, and notices"
- " objects that need ledger lines.",
+ /* doc */
+ "Create the spanner to draw ledger lines, and notices"
+ " objects that need ledger lines.",
- /* create */
- "LedgerLineSpanner ",
+ /* create */
+ "LedgerLineSpanner ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
static Stencil brew_ledger_lines (Grob *me,
- int pos,
- Interval,
- Real, Real,
- Interval x_extent,
- Real left_shorten);
+ int pos,
+ Interval,
+ Real, Real,
+ Interval x_extent,
+ Real left_shorten);
DECLARE_GROB_INTERFACE ();
};
Stencil
Ledger_line_spanner::brew_ledger_lines (Grob *staff,
- int pos,
- Interval staff_extent,
- Real halfspace,
- Real ledgerlinethickness,
- Interval x_extent,
- Real left_shorten)
+ int pos,
+ Interval staff_extent,
+ Real halfspace,
+ Real ledgerlinethickness,
+ Interval x_extent,
+ Real left_shorten)
{
int line_count = (staff_extent.contains (pos)
- ? 0
- : sign (pos) * int (rint (pos - staff_extent[Direction (sign (pos))])) / 2);
+ ? 0
+ : sign (pos) * int (rint (pos - staff_extent[Direction (sign (pos))])) / 2);
Stencil stencil;
if (line_count)
{
Real blotdiameter = ledgerlinethickness;
Interval y_extent
- = Interval (-0.5 * (ledgerlinethickness),
- +0.5 * (ledgerlinethickness));
+ = Interval (-0.5 * (ledgerlinethickness),
+ +0.5 * (ledgerlinethickness));
Stencil proto_ledger_line
- = Lookup::round_filled_box (Box (x_extent, y_extent), blotdiameter);
+ = Lookup::round_filled_box (Box (x_extent, y_extent), blotdiameter);
x_extent[LEFT] += left_shorten;
Stencil proto_first_line
- = Lookup::round_filled_box (Box (x_extent, y_extent), blotdiameter);
+ = Lookup::round_filled_box (Box (x_extent, y_extent), blotdiameter);
Direction dir = (Direction)sign (pos);
Real offs = (Staff_symbol_referencer::on_line (staff, pos))
- ? 0.0
- : -dir * halfspace;
+ ? 0.0
+ : -dir * halfspace;
offs += pos * halfspace;
for (int i = 0; i < line_count; i++)
- {
- Stencil ledger_line ((i == 0)
- ? proto_first_line
- : proto_ledger_line);
- ledger_line.translate_axis (-dir * halfspace * i * 2 + offs, Y_AXIS);
- stencil.add_stencil (ledger_line);
- }
+ {
+ Stencil ledger_line ((i == 0)
+ ? proto_first_line
+ : proto_ledger_line);
+ ledger_line.translate_axis (-dir * halfspace * i * 2 + offs, Y_AXIS);
+ stencil.add_stencil (ledger_line);
+ }
}
return stencil;
static void
set_rods (Drul_array<Interval> const ¤t_extents,
- Drul_array<Interval> const &previous_extents,
- Item *current_column,
- Item *previous_column,
- Real min_length_fraction)
+ Drul_array<Interval> const &previous_extents,
+ Item *current_column,
+ Item *previous_column,
+ Real min_length_fraction)
{
Direction d = UP;
do
{
if (!current_extents[d].is_empty ()
- && !previous_extents[d].is_empty ())
- {
- Real total_head_length = previous_extents[d].length ()
- + current_extents[d].length ();
-
- Rod rod;
- rod.distance_ = total_head_length
- * (3 / 2 * min_length_fraction)
- /*
- we go from right to left.
- */
- - previous_extents[d][LEFT]
- + current_extents[d][RIGHT];
-
- rod.item_drul_[LEFT] = current_column;
- rod.item_drul_[RIGHT] = previous_column;
- rod.add_to_cols ();
- }
+ && !previous_extents[d].is_empty ())
+ {
+ Real total_head_length = previous_extents[d].length ()
+ + current_extents[d].length ();
+
+ Rod rod;
+ rod.distance_ = total_head_length
+ * (3 / 2 * min_length_fraction)
+ /*
+ we go from right to left.
+ */
+ - previous_extents[d][LEFT]
+ + current_extents[d][RIGHT];
+
+ rod.item_drul_[LEFT] = current_column;
+ rod.item_drul_[RIGHT] = previous_column;
+ rod.add_to_cols ();
+ }
}
while (flip (&d) != DOWN);
}
Interval staff_extent = staff->extent (staff, Y_AXIS);
staff_extent *= 1 / halfspace;
-
+
/*
Run through heads using a loop. Since Ledger_line_spanner can
contain a lot of noteheads, superlinear performance is too slow.
int pos = Staff_symbol_referencer::get_rounded_position (h);
if (staff_extent.contains (pos))
- continue;
+ continue;
Item *column = h->get_column ();
if (current_column != column)
- {
- set_rods (current_extents, previous_extents,
- current_column, previous_column,
- min_length_fraction);
+ {
+ set_rods (current_extents, previous_extents,
+ current_column, previous_column,
+ min_length_fraction);
- previous_column = current_column;
- current_column = column;
- previous_extents = current_extents;
+ previous_column = current_column;
+ current_column = column;
+ previous_extents = current_extents;
- current_extents[DOWN].set_empty ();
- current_extents[UP].set_empty ();
- }
+ current_extents[DOWN].set_empty ();
+ current_extents[UP].set_empty ();
+ }
Interval head_extent = h->extent (column, X_AXIS);
Direction vdir = Direction (sign (pos));
if (!vdir)
- continue;
+ continue;
current_extents[vdir].unite (head_extent);
}
if (previous_column && current_column)
set_rods (current_extents, previous_extents,
- current_column, previous_column,
- min_length_fraction);
+ current_column, previous_column,
+ min_length_fraction);
return SCM_UNSPECIFIED;
}
Interval staff_extent = staff->extent (staff, Y_AXIS);
staff_extent *= 1 / halfspace;
-
+
Real length_fraction
= robust_scm2double (me->get_property ("length-fraction"), 0.25);
Axis a = Axis (i);
common[a] = common_refpoint_of_array (heads, me, a);
for (vsize i = heads.size (); i--;)
- if (Grob *g = unsmob_grob (me->get_object ("accidental-grob")))
- common[a] = common[a]->common_refpoint (g, a);
+ if (Grob *g = unsmob_grob (me->get_object ("accidental-grob")))
+ common[a] = common[a]->common_refpoint (g, a);
}
Ledger_requests reqs;
int pos = Staff_symbol_referencer::get_rounded_position (h);
if (pos && !staff_extent.contains (pos))
- {
- Interval head_extent = h->extent (common[X_AXIS], X_AXIS);
- Interval ledger_extent = head_extent;
- ledger_extent.widen (length_fraction * head_extent.length ());
-
- Direction vdir = Direction (sign (pos));
- int rank = h->get_column ()->get_rank ();
-
- reqs[rank][vdir].ledger_extent_.unite (ledger_extent);
- reqs[rank][vdir].head_extent_.unite (head_extent);
- reqs[rank][vdir].position_
- = vdir * max (vdir * reqs[rank][vdir].position_, vdir * pos);
- }
+ {
+ Interval head_extent = h->extent (common[X_AXIS], X_AXIS);
+ Interval ledger_extent = head_extent;
+ ledger_extent.widen (length_fraction * head_extent.length ());
+
+ Direction vdir = Direction (sign (pos));
+ int rank = h->get_column ()->get_rank ();
+
+ reqs[rank][vdir].ledger_extent_.unite (ledger_extent);
+ reqs[rank][vdir].head_extent_.unite (head_extent);
+ reqs[rank][vdir].position_
+ = vdir * max (vdir * reqs[rank][vdir].position_, vdir * pos);
+ }
}
// determine maximum size for non-colliding ledger.
i != reqs.end (); last = i++)
{
if (last == reqs.end ())
- continue;
+ continue;
Direction d = DOWN;
do
- {
- if (!staff_extent.contains (last->second[d].position_)
- && !staff_extent.contains (i->second[d].position_))
- {
- Real center
- = (last->second[d].head_extent_[RIGHT]
- + i->second[d].head_extent_[LEFT]) / 2;
-
- Direction which = LEFT;
- do
- {
- Ledger_request &lr = ((which == LEFT) ? * last : *i).second[d];
-
- // due tilt of quarter note-heads
- /* FIXME */
- bool both
- = (!staff_extent.contains (last->second[d].position_
- - sign (last->second[d].position_))
- && !staff_extent.contains (i->second[d].position_
- - sign (i->second[d].position_)));
- Real limit = (center + (both ? which * gap / 2 : 0));
- lr.ledger_extent_.at (-which)
- = which * max (which * lr.ledger_extent_[-which], which * limit);
- }
- while (flip (&which) != LEFT);
- }
- }
+ {
+ if (!staff_extent.contains (last->second[d].position_)
+ && !staff_extent.contains (i->second[d].position_))
+ {
+ Real center
+ = (last->second[d].head_extent_[RIGHT]
+ + i->second[d].head_extent_[LEFT]) / 2;
+
+ Direction which = LEFT;
+ do
+ {
+ Ledger_request &lr = ((which == LEFT) ? * last : *i).second[d];
+
+ // due tilt of quarter note-heads
+ /* FIXME */
+ bool both
+ = (!staff_extent.contains (last->second[d].position_
+ - sign (last->second[d].position_))
+ && !staff_extent.contains (i->second[d].position_
+ - sign (i->second[d].position_)));
+ Real limit = (center + (both ? which * gap / 2 : 0));
+ lr.ledger_extent_.at (-which)
+ = which * max (which * lr.ledger_extent_[-which], which * limit);
+ }
+ while (flip (&which) != LEFT);
+ }
+ }
while (flip (&d) != DOWN);
}
int pos = Staff_symbol_referencer::get_rounded_position (h);
if (!staff_extent.contains (pos - sign (pos)) && !staff_extent.is_empty ())
- {
- Interval head_size = h->extent (common[X_AXIS], X_AXIS);
- Interval ledger_size = head_size;
- ledger_size.widen (ledger_size.length () * length_fraction);
-
- Interval max_size = reqs[h->get_column ()->get_rank ()]
- [Direction (sign (pos))].ledger_extent_;
-
- ledger_size.intersect (max_size);
- Real left_shorten = 0.0;
- if (Grob *g = unsmob_grob (h->get_object ("accidental-grob")))
- {
- Interval accidental_size = g->extent (common[X_AXIS], X_AXIS);
- Real d
- = linear_combination (Drul_array<Real> (accidental_size[RIGHT],
- head_size[LEFT]),
- 0.0);
-
- left_shorten = max (-ledger_size[LEFT] + d, 0.0);
-
- /*
- TODO: shorten 2 ledger lines for the case natural +
- downstem.
- */
- }
-
- ledgers.add_stencil (brew_ledger_lines (staff, pos, staff_extent,
- halfspace,
- ledgerlinethickness,
- ledger_size,
- left_shorten));
- }
+ {
+ Interval head_size = h->extent (common[X_AXIS], X_AXIS);
+ Interval ledger_size = head_size;
+ ledger_size.widen (ledger_size.length () * length_fraction);
+
+ Interval max_size = reqs[h->get_column ()->get_rank ()]
+ [Direction (sign (pos))].ledger_extent_;
+
+ ledger_size.intersect (max_size);
+ Real left_shorten = 0.0;
+ if (Grob *g = unsmob_grob (h->get_object ("accidental-grob")))
+ {
+ Interval accidental_size = g->extent (common[X_AXIS], X_AXIS);
+ Real d
+ = linear_combination (Drul_array<Real> (accidental_size[RIGHT],
+ head_size[LEFT]),
+ 0.0);
+
+ left_shorten = max (-ledger_size[LEFT] + d, 0.0);
+
+ /*
+ TODO: shorten 2 ledger lines for the case natural +
+ downstem.
+ */
+ }
+
+ ledgers.add_stencil (brew_ledger_lines (staff, pos, staff_extent,
+ halfspace,
+ ledgerlinethickness,
+ ledger_size,
+ left_shorten));
+ }
}
ledgers.translate_axis (-me->relative_coordinate (common[X_AXIS], X_AXIS),
- X_AXIS);
+ X_AXIS);
return ledgers.smobbed_copy ();
}
ADD_INTERFACE (Ledger_line_spanner,
- "This spanner draws the ledger lines of a staff. This is a"
- " separate grob because it has to process all potential"
- " collisions between all note heads.",
-
- /* properties */
- "gap "
- "length-fraction "
- "minimum-length-fraction "
- "note-heads "
- "thickness "
- );
+ "This spanner draws the ledger lines of a staff. This is a"
+ " separate grob because it has to process all potential"
+ " collisions between all note heads.",
+
+ /* properties */
+ "gap "
+ "length-fraction "
+ "minimum-length-fraction "
+ "note-heads "
+ "thickness "
+ );
struct Ledgered_interface
{
};
ADD_INTERFACE (Ledgered_interface,
- "Objects that need ledger lines, typically note heads. See"
- " also @ref{ledger-line-spanner-interface}.",
+ "Objects that need ledger lines, typically note heads. See"
+ " also @ref{ledger-line-spanner-interface}.",
- /* properties */
- "no-ledgers "
- );
+ /* properties */
+ "no-ledgers "
+ );
}
void
-Ligature_bracket_engraver::process_music()
+Ligature_bracket_engraver::process_music ()
{
if (events_drul_[STOP])
{
if (!ligature_)
- {
- events_drul_[STOP]->origin ()->warning (_ ("cannot find start of ligature"));
- return;
- }
+ {
+ events_drul_[STOP]->origin ()->warning (_ ("cannot find start of ligature"));
+ return;
+ }
finished_ligature_ = ligature_;
ligature_ = 0;
if (events_drul_[START])
{
if (ligature_)
- {
- events_drul_[START]->origin ()->warning (_ ("already have a ligature"));
- return;
- }
+ {
+ events_drul_[START]->origin ()->warning (_ ("already have a ligature"));
+ return;
+ }
previous_start_event_ = events_drul_[START];
ligature_ = make_spanner ("LigatureBracket", events_drul_[START]->self_scm ());
if (ligature_)
{
Tuplet_bracket::add_column (ligature_,
- info.item ());
- add_bound_item (ligature_, info.item());
+ info.item ());
+ add_bound_item (ligature_, info.item ());
}
}
void
Ligature_bracket_engraver::acknowledge_rest (Grob_info info)
{
- acknowledge_note_column(info);
+ acknowledge_note_column (info);
}
-
void
Ligature_bracket_engraver::stop_translation_timestep ()
{
- events_drul_[LEFT] =
- events_drul_[RIGHT] = 0;
+ events_drul_[LEFT]
+ = events_drul_[RIGHT] = 0;
finished_ligature_ = 0;
}
ADD_ACKNOWLEDGER (Ligature_bracket_engraver, note_column);
ADD_TRANSLATOR (Ligature_bracket_engraver,
- /* doc */
- "Handle @code{Ligature_events} by engraving @code{Ligature}"
- " brackets.",
+ /* doc */
+ "Handle @code{Ligature_events} by engraving @code{Ligature}"
+ " brackets.",
- /* create */
- "LigatureBracket ",
+ /* create */
+ "LigatureBracket ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
if (events_drul_[STOP])
{
if (!ligature_)
- {
- events_drul_[STOP]->origin ()->warning (_ ("cannot find start of ligature"));
- return;
- }
+ {
+ events_drul_[STOP]->origin ()->warning (_ ("cannot find start of ligature"));
+ return;
+ }
if (!last_bound_)
- events_drul_[STOP]->origin ()->warning (_ ("no right bound"));
+ events_drul_[STOP]->origin ()->warning (_ ("no right bound"));
else
- ligature_->set_bound (RIGHT, last_bound_);
+ ligature_->set_bound (RIGHT, last_bound_);
prev_start_event_ = 0;
finished_primitives_ = primitives_;
if (events_drul_[START])
{
if (ligature_)
- {
- events_drul_[START]->origin ()->warning (_ ("already have a ligature"));
- return;
- }
+ {
+ events_drul_[START]->origin ()->warning (_ ("already have a ligature"));
+ return;
+ }
prev_start_event_ = events_drul_[START];
ligature_ = create_ligature_spanner ();
Grob *bound = unsmob_grob (get_property ("currentMusicalColumn"));
if (!bound)
- events_drul_[START]->origin ()->warning (_ ("no left bound"));
+ events_drul_[START]->origin ()->warning (_ ("no left bound"));
else
- ligature_->set_bound (LEFT, bound);
+ ligature_->set_bound (LEFT, bound);
ligature_start_mom_ = now_mom ();
if (finished_ligature_)
{
if (!finished_primitives_.size ())
- {
- finished_ligature_->programming_error (
- "Ligature_engraver::stop_translation_timestep ():"
- " junking empty ligature");
- }
+ {
+ finished_ligature_->programming_error ("Ligature_engraver::stop_translation_timestep ():"
+ " junking empty ligature");
+ }
else
- {
- typeset_ligature (finished_ligature_, finished_primitives_);
- finished_primitives_.clear ();
- }
+ {
+ typeset_ligature (finished_ligature_, finished_primitives_);
+ finished_primitives_.clear ();
+ }
finished_ligature_ = 0;
}
#include "version.hh"
#include "warn.hh"
-
/*
symbols/strings.
*/
ly_scm_write_string (SCM s)
{
SCM port = scm_mkstrport (SCM_INUM0,
- scm_make_string (SCM_INUM0, SCM_UNDEFINED),
- SCM_OPN | SCM_WRTNG,
- "ly_write2string");
+ scm_make_string (SCM_INUM0, SCM_UNDEFINED),
+ SCM_OPN | SCM_WRTNG,
+ "ly_write2string");
// SCM write = scm_eval_3 (ly_symbol2scm ("write"), s, SCM_EOL);
SCM write = scm_primitive_eval (ly_symbol2scm ("write"));
if (s == "")
{
if (must_exist)
- {
- string e = _f ("cannot find file: `%s'", fn);
- e += " ";
- e += _f ("(load path: `%s')", global_path.to_string ());
- error (e);
- /* unreachable */
- }
+ {
+ string e = _f ("cannot find file: `%s'", fn);
+ e += " ";
+ e += _f ("(load path: `%s')", global_path.to_string ());
+ error (e);
+ /* unreachable */
+ }
return s;
}
assert (scm_is_string (str));
string result;
size_t len = scm_c_string_length (str);
- if (len) {
- result.resize(len);
- scm_to_locale_stringbuf(str, &result.at(0), len);
- }
+ if (len)
+ {
+ result.resize (len);
+ scm_to_locale_stringbuf (str, &result.at (0), len);
+ }
return result;
}
ly_string2scm (string const &str)
{
return scm_from_locale_stringn (str.c_str (),
- str.length ());
+ str.length ());
}
char *
/*
PAIRS
*/
-SCM
+SCM
index_get_cell (SCM s, Direction d)
{
assert (d);
is_number_pair (SCM p)
{
return scm_is_pair (p)
- && scm_is_number (scm_car (p)) && scm_is_number (scm_cdr (p));
+ && scm_is_number (scm_car (p)) && scm_is_number (scm_cdr (p));
}
-
unsigned int
ly_scm_hash (SCM s)
{
ly_scm2realdrul (SCM p)
{
return Drul_array<Real> (scm_to_double (scm_car (p)),
- scm_to_double (scm_cdr (p)));
+ scm_to_double (scm_cdr (p)));
}
SCM
return scm_cons (scm_from_double (i[LEFT]), scm_from_double (i[RIGHT]));
}
-
Interval
robust_scm2interval (SCM k, Drul_array<Real> v)
{
ly_scm2offset (SCM s)
{
return Offset (scm_to_double (scm_car (s)),
- scm_to_double (scm_cdr (s)));
+ scm_to_double (scm_cdr (s)));
}
Offset
return os;
}
-
-
-
/*
ALIST
*/
SCM l = scm_assoc (key, b);
if (l == SCM_BOOL_F
- || !ly_is_equal (scm_cdr (l), val))
+ || !ly_is_equal (scm_cdr (l), val))
- return false;
+ return false;
}
return true;
}
return scm_car (l);
}
-
SCM
ly_deep_copy (SCM src)
{
{
int len = scm_c_vector_length (src);
SCM nv = scm_c_make_vector (len, SCM_UNDEFINED);
- for (int i = 0;i < len; i++)
- {
- SCM si = scm_from_int (i);
- scm_vector_set_x (nv, si, ly_deep_copy (scm_vector_ref (src, si)));
- }
+ for (int i = 0; i < len; i++)
+ {
+ SCM si = scm_from_int (i);
+ scm_vector_set_x (nv, si, ly_deep_copy (scm_vector_ref (src, si)));
+ }
}
return src;
}
string realval = ly_scm_write_string (val);
if (realval.length () > 200)
realval = realval.substr (0, 100)
- + "\n :\n :\n"
- + realval.substr (realval.length () - 100);
+ + "\n :\n :\n"
+ + realval.substr (realval.length () - 100);
return realval;
}
#if 0
return false;
#else
- /*
- This is used for autoBeamSettings.
+ /*
+ This is used for autoBeamSettings.
- TODO: deprecate the use of \override and \revert for
- autoBeamSettings?
+ TODO: deprecate the use of \override and \revert for
+ autoBeamSettings?
- or use a symbol autoBeamSettingS?
- */
- return true;
+ or use a symbol autoBeamSettingS?
+ */
+ return true;
#endif
SCM type = scm_object_property (sym, type_symbol);
if (type != SCM_EOL && !ly_is_procedure (type))
{
warning (_f ("cannot find property type-check for `%s' (%s).",
- ly_symbol2string (sym).c_str (),
- ly_symbol2string (type_symbol).c_str ())
- + " " + _ ("perhaps a typing error?"));
+ ly_symbol2string (sym).c_str (),
+ ly_symbol2string (type_symbol).c_str ())
+ + " " + _ ("perhaps a typing error?"));
/* Be strict when being anal :) */
if (do_internal_type_checking_global)
- scm_throw (ly_symbol2scm ("ly-file-failed"), scm_list_3 (ly_symbol2scm ("typecheck"),
- sym, val));
+ scm_throw (ly_symbol2scm ("ly-file-failed"), scm_list_3 (ly_symbol2scm ("typecheck"),
+ sym, val));
warning (_ ("doing assignment anyway"));
}
else
{
if (val != SCM_EOL
- && ly_is_procedure (type)
- && scm_call_1 (type, val) == SCM_BOOL_F)
- {
- ok = false;
- SCM typefunc = ly_lily_module_constant ("type-name");
- SCM type_name = scm_call_1 (typefunc, type);
-
- warning (_f ("type check for `%s' failed; value `%s' must be of type `%s'",
- ly_symbol2string (sym).c_str (),
- print_scm_val (val),
- ly_scm2string (type_name).c_str ()));
- progress_indication ("\n");
- }
+ && ly_is_procedure (type)
+ && scm_call_1 (type, val) == SCM_BOOL_F)
+ {
+ ok = false;
+ SCM typefunc = ly_lily_module_constant ("type-name");
+ SCM type_name = scm_call_1 (typefunc, type);
+
+ warning (_f ("type check for `%s' failed; value `%s' must be of type `%s'",
+ ly_symbol2string (sym).c_str (),
+ print_scm_val (val),
+ ly_scm2string (type_name).c_str ()));
+ progress_indication ("\n");
+ }
}
return ok;
}
for (SCM i = list; scm_is_pair (i); i = scm_cdr (i))
{
if (!scm_is_pair (scm_cdr (i))
- || !ly_is_equal (scm_car (i), scm_cadr (i)))
- unique = scm_cons (scm_car (i), unique);
+ || !ly_is_equal (scm_car (i), scm_cadr (i)))
+ unique = scm_cons (scm_car (i), unique);
}
return scm_reverse_x (unique, SCM_EOL);
}
-
/* Split list at member s, removing s.
Return (BEFORE . AFTER) */
SCM
SCM i = scm_car (after);
after = scm_cdr (after);
if (ly_is_equal (i, s))
- break;
+ break;
before = scm_cons (i, before);
}
return scm_cons (scm_reverse_x (before, SCM_EOL), after);
return x;
}
-
string
robust_scm2string (SCM k, string s)
{
return o;
}
-
SCM
ly_rational2scm (Rational r)
{
return scm_divide (scm_from_int64 (r.numerator ()),
- scm_from_int64 (r.denominator ()));
+ scm_from_int64 (r.denominator ()));
}
-
Rational
ly_scm2rational (SCM r)
{
return Rational (scm_to_int64 (scm_numerator (r)),
- scm_to_int64 (scm_denominator (r)));
+ scm_to_int64 (scm_denominator (r)));
}
Rational
return scm_call_1 (func, tab);
}
-
/*
C++ interfacing.
*/
replace_all (&cxx_id, "__", "::");
replace_all (&cxx_id, '_', '-');
-
return cxx_id;
}
-
-
SCM
ly_string_array_to_scm (vector<string> a)
{
SCM s = SCM_EOL;
- for (vsize i = a.size (); i ; i--)
+ for (vsize i = a.size (); i; i--)
s = scm_cons (ly_symbol2scm (a[i - 1].c_str ()), s);
return s;
}
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2006--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "lily-lexer.hh"
LY_DEFINE (ly_lexer_keywords, "ly:lexer-keywords",
- 1, 0, 0, (SCM lexer),
- "Return a list of @code{(KEY . CODE)} pairs, signifying the"
- " LilyPond reserved words list.")
+ 1, 0, 0, (SCM lexer),
+ "Return a list of @code{(KEY . CODE)} pairs, signifying the"
+ " LilyPond reserved words list.")
{
LY_ASSERT_SMOB (Lily_lexer, lexer, 1);
- Lily_lexer * lex = Lily_lexer::unsmob (lexer);
+ Lily_lexer *lex = Lily_lexer::unsmob (lexer);
return lex->keyword_list ();
}
#include "lily-parser.hh"
static Keyword_ent the_key_tab[]
-= {
+=
+{
{"accepts", ACCEPTS},
{"addlyrics", ADDLYRICS},
{"alias", ALIAS},
for (vsize i = 0; i < keytable_->table_.size (); i++)
{
*tail = scm_acons (scm_from_locale_string (keytable_->table_[i].name_),
- scm_from_int (keytable_->table_[i].tokcode_),
- SCM_EOL);
+ scm_from_int (keytable_->table_[i].tokcode_),
+ SCM_EOL);
tail = SCM_CDRLOC (*tail);
}
{
SCM var = ly_module_lookup (scm_car (s), sym);
if (var != SCM_BOOL_F)
- return scm_variable_ref (var);
+ return scm_variable_ref (var);
}
return SCM_UNDEFINED;
new_input (main_input_name_, sources_);
scm_module_define (scm_car (scopes_),
- ly_symbol2scm ("input-file-name"),
- ly_string2scm (main_input_name_));
+ ly_symbol2scm ("input-file-name"),
+ ly_string2scm (main_input_name_));
}
void
if (scm_is_symbol (sym))
{
if (lookup_keyword (ly_symbol2string (sym)) >= 0)
- {
- string symstr = ly_symbol2string (sym);
- warning (_f ("identifier name is a keyword: `%s'", symstr.c_str ()));
- }
+ {
+ string symstr = ly_symbol2string (sym);
+ warning (_f ("identifier name is a keyword: `%s'", symstr.c_str ()));
+ }
SCM mod = scm_car (scopes_);
if (scm_is_pair (path))
- {
- SCM prev = ly_module_lookup (mod, sym);
- if (prev != SCM_BOOL_F)
- val = nested_property_alist (scm_variable_ref (prev), path, val);
- }
+ {
+ SCM prev = ly_module_lookup (mod, sym);
+ if (prev != SCM_BOOL_F)
+ val = nested_property_alist (scm_variable_ref (prev), path, val);
+ }
scm_module_define (mod, sym, val);
}
else
{
char const *start = here_str0 ();
lexloc_->set (get_source_file (),
- start, start + count);
+ start, start + count);
char_count_stack_.back () += count;
}
}
int
-Lily_lexer::print_smob (SCM s, SCM port, scm_print_state*)
+Lily_lexer::print_smob (SCM s, SCM port, scm_print_state *)
{
Lily_lexer *lexer = Lily_lexer::unsmob (s);
#include "warn.hh"
LY_DEFINE (ly_parse_file, "ly:parse-file",
- 1, 0, 0, (SCM name),
- "Parse a single @code{.ly} file."
- " Upon failure, throw @code{ly-file-failed} key.")
+ 1, 0, 0, (SCM name),
+ "Parse a single @code{.ly} file."
+ " Upon failure, throw @code{ly-file-failed} key.")
{
LY_ASSERT_TYPE (scm_is_string, name, 1);
string file = ly_scm2string (name);
out_file_name.ext_ = "";
out_file_name.root_ = "";
if (ly_get_option (ly_symbol2scm ("gui")) != SCM_BOOL_T
- && ly_get_option (ly_symbol2scm ("strip-output-dir")) == SCM_BOOL_T) {
- out_file_name.dir_ = "";
- }
+ && ly_get_option (ly_symbol2scm ("strip-output-dir")) == SCM_BOOL_T)
+ {
+ out_file_name.dir_ = "";
+ }
/* When running from gui, generate output in .ly source directory. */
string output_name = output_name_global;
/* Interpret --output=DIR to mean --output=DIR/BASE. */
string dir;
if (is_dir (output_name))
- {
- dir = output_name;
- output_name = "";
- }
+ {
+ dir = output_name;
+ output_name = "";
+ }
else
- {
- File_name out (output_name);
- if (is_dir (out.dir_part ()))
- {
- dir = out.dir_part ();
- out_file_name = out.file_part ();
- }
- }
+ {
+ File_name out (output_name);
+ if (is_dir (out.dir_part ()))
+ {
+ dir = out.dir_part ();
+ out_file_name = out.file_part ();
+ }
+ }
if (dir != "" && dir != "." && dir != get_working_directory ())
- {
- global_path.prepend (get_working_directory ());
- message (_f ("Changing working directory to: `%s'",
- dir.c_str ()));
- chdir (dir.c_str ());
- }
+ {
+ global_path.prepend (get_working_directory ());
+ message (_f ("Changing working directory to: `%s'",
+ dir.c_str ()));
+ chdir (dir.c_str ());
+ }
else
- out_file_name = File_name (output_name);
+ out_file_name = File_name (output_name);
}
string init;
{
warning (_f ("cannot find init file: `%s'", init));
warning (_f ("(search path: `%s')",
- global_path.to_string ().c_str ()));
+ global_path.to_string ().c_str ()));
exit (2);
}
-
bool error = false;
if ((file_name != "-") && file_name.empty ())
{
if (error)
/* TODO: pass renamed input file too. */
scm_throw (ly_symbol2scm ("ly-file-failed"),
- scm_list_1 (ly_string2scm (file_name)));
+ scm_list_1 (ly_string2scm (file_name)));
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_parser_lexer, "ly:parser-lexer",
- 1, 0, 0, (SCM parser_smob),
- "Return the lexer for @var{parser-smob}.")
+ 1, 0, 0, (SCM parser_smob),
+ "Return the lexer for @var{parser-smob}.")
{
Lily_parser *parser = unsmob_lily_parser (parser_smob);
return parser->lexer_->self_scm ();
}
LY_DEFINE (ly_parser_clone, "ly:parser-clone",
- 1, 0, 0, (SCM parser_smob),
- "Return a clone of @var{parser-smob}.")
+ 1, 0, 0, (SCM parser_smob),
+ "Return a clone of @var{parser-smob}.")
{
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
}
LY_DEFINE (ly_parser_define_x, "ly:parser-define!",
- 3, 0, 0, (SCM parser_smob, SCM symbol, SCM val),
- "Bind @var{symbol} to @var{val} in @var{parser-smob}'s module.")
+ 3, 0, 0, (SCM parser_smob, SCM symbol, SCM val),
+ "Bind @var{symbol} to @var{val} in @var{parser-smob}'s module.")
{
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
}
LY_DEFINE (ly_parser_lookup, "ly:parser-lookup",
- 2, 0, 0, (SCM parser_smob, SCM symbol),
- "Look up @var{symbol} in @var{parser-smob}'s module."
- " Return @code{'()} if not defined.")
+ 2, 0, 0, (SCM parser_smob, SCM symbol),
+ "Look up @var{symbol} in @var{parser-smob}'s module."
+ " Return @code{'()} if not defined.")
{
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
}
LY_DEFINE (ly_parser_parse_string, "ly:parser-parse-string",
- 2, 0, 0, (SCM parser_smob, SCM ly_code),
- "Parse the string @var{ly-code} with @var{parser-smob}."
- " Upon failure, throw @code{ly-file-failed} key.")
+ 2, 0, 0, (SCM parser_smob, SCM ly_code),
+ "Parse the string @var{ly-code} with @var{parser-smob}."
+ " Upon failure, throw @code{ly-file-failed} key.")
{
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
if (!parser->lexer_->is_clean ())
parser->parser_error (_ ("ly:parser-parse-string is only valid with a new parser."
- " Use ly:parser-include-string instead."));
+ " Use ly:parser-include-string instead."));
else
parser->parse_string (ly_scm2string (ly_code));
}
LY_DEFINE (ly_parser_include_string, "ly:parser-include-string",
- 2, 0, 0, (SCM parser_smob, SCM ly_code),
- "Include the string @var{ly-code} into the input stream"
- " for @var{parser-smob}.")
+ 2, 0, 0, (SCM parser_smob, SCM ly_code),
+ "Include the string @var{ly-code} into the input stream"
+ " for @var{parser-smob}.")
{
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
}
LY_DEFINE (ly_parser_set_note_names, "ly:parser-set-note-names",
- 2, 0, 0, (SCM parser, SCM names),
- "Replace current note names in @var{parser}."
- " @var{names} is an alist of symbols. This only has effect"
- " if the current mode is notes.")
+ 2, 0, 0, (SCM parser, SCM names),
+ "Replace current note names in @var{parser}."
+ " @var{names} is an alist of symbols. This only has effect"
+ " if the current mode is notes.")
{
LY_ASSERT_SMOB (Lily_parser, parser, 1);
Lily_parser *p = unsmob_lily_parser (parser);
}
LY_DEFINE (ly_parser_output_name, "ly:parser-output-name",
- 1, 0, 0, (SCM parser),
- "Return the base name of the output file.")
+ 1, 0, 0, (SCM parser),
+ "Return the base name of the output file.")
{
LY_ASSERT_SMOB (Lily_parser, parser, 1);
Lily_parser *p = unsmob_lily_parser (parser);
}
LY_DEFINE (ly_parser_error, "ly:parser-error",
- 2, 1, 0, (SCM parser, SCM msg, SCM input),
- "Display an error message and make the parser fail.")
+ 2, 1, 0, (SCM parser, SCM msg, SCM input),
+ "Display an error message and make the parser fail.")
{
LY_ASSERT_SMOB (Lily_parser, parser, 1);
Lily_parser *p = unsmob_lily_parser (parser);
}
LY_DEFINE (ly_parser_clear_error, "ly:parser-clear-error",
- 1, 0, 0, (SCM parser),
- "Clear the error flag for the parser.")
+ 1, 0, 0, (SCM parser),
+ "Clear the error flag for the parser.")
{
LY_ASSERT_SMOB (Lily_parser, parser, 1);
Lily_parser *p = unsmob_lily_parser (parser);
-
p->error_level_ = 0;
p->lexer_->error_level_ = 0;
}
LY_DEFINE (ly_parser_has_error_p, "ly:parser-has-error?",
- 1, 0, 0, (SCM parser),
- "Does @var{parser} have an error flag?")
+ 1, 0, 0, (SCM parser),
+ "Does @var{parser} have an error flag?")
{
LY_ASSERT_SMOB (Lily_parser, parser, 1);
Lily_parser *p = unsmob_lily_parser (parser);
{
}
-
SCM
Lily_parser::mark_smob (SCM s)
{
}
int
-Lily_parser::print_smob (SCM s, SCM port, scm_print_state*)
+Lily_parser::print_smob (SCM s, SCM port, scm_print_state *)
{
scm_puts ("#<Lily_parser ", port);
Lily_parser *parser = (Lily_parser *) SCM_CELL_WORD_1 (s);
Don't mix cyclic pointers with weak tables.
*/
lexer_->set_identifier (ly_symbol2scm ("parser"),
- SCM_EOL);
+ SCM_EOL);
ly_reexport_module (scm_current_module ());
scm_set_current_module (mod);
{
// TODO: use $parser
lexer_->set_identifier (ly_symbol2scm ("parser"),
- self_scm ());
+ self_scm ());
lexer_->main_input_name_ = "<string>";
lexer_->is_main_input_ = true;
if (!define_spots_.empty ())
{
if (define_spots_.empty ()
- && !error_level_)
- programming_error ("define_spots_ don't match, but error_level_ not set.");
+ && !error_level_)
+ programming_error ("define_spots_ don't match, but error_level_ not set.");
}
error_level_ = error_level_ | lexer_->error_level_;
if (lexer_)
{
while (lexer_->has_scope ())
- lexer_->remove_scope ();
+ lexer_->remove_scope ();
}
lexer_ = 0;
error_level_ = 1;
}
-
-
IMPLEMENT_SMOBS (Lily_parser);
IMPLEMENT_TYPE_P (Lily_parser, "ly:lily-parser?");
IMPLEMENT_DEFAULT_EQUAL_P (Lily_parser);
-
/****************************************************************
OUTPUT-DEF
****************************************************************/
get_paper (Lily_parser *parser)
{
SCM papers = parser->lexer_->lookup_identifier ("$papers");
- Output_def *layout = ((papers == SCM_UNDEFINED) || scm_is_null (papers)) ?
- 0 : unsmob_output_def (scm_car (papers));
+ Output_def *layout = ((papers == SCM_UNDEFINED) || scm_is_null (papers))
+ ? 0 : unsmob_output_def (scm_car (papers));
SCM default_paper = parser->lexer_->lookup_identifier ("$defaultpaper");
layout = layout ? layout : unsmob_output_def (default_paper);
Lilypond_version::Lilypond_version (string str)
{
- major_ = 0;
+ major_ = 0;
minor_ = 0;
patch_ = 0;
-
+
vector<string> version;
version = string_split (str, '.');
major_ = String_convert::dec2int (version[0]);
if (version.size () > 1 && isdigit (version[1][0]))
minor_ = String_convert::dec2int (version[1]);
-
+
patch_ = 0;
if (version.size () >= 3
&& isdigit (version[2][0]))
Lilypond_version::to_string () const
{
return ::to_string (major_)
- + "." + ::to_string (minor_)
- + "." + ::to_string (patch_);
+ + "." + ::to_string (minor_)
+ + "." + ::to_string (patch_);
}
Lilypond_version::operator int () const
Stencil
Line_interface::make_arrow (Offset begin, Offset end,
- Real thick,
- Real length, Real width)
+ Real thick,
+ Real length, Real width)
{
Real angle = (end - begin).arg ();
vector<Offset> points;
Stencil
Line_interface::make_trill_line (Grob *me,
- Offset from,
- Offset to)
+ Offset from,
+ Offset to)
{
Offset dz = (to - from);
programming_error ("can't find scripts.trill_element");
return Stencil ();
}
-
+
Stencil line;
Real len = 0.0;
do
line.rotate (dz.arg (), Offset (LEFT, CENTER));
line.translate (from);
- return line;
+ return line;
}
-
Stencil
Line_interface::make_zigzag_line (Grob *me,
- Offset from,
- Offset to)
+ Offset from,
+ Offset to)
{
Offset dz = to - from;
Real thick = Staff_symbol_referencer::line_thickness (me);
- thick *= robust_scm2double (me->get_property ("thickness"), 1.0); // todo: staff sym referencer?
+ thick *= robust_scm2double (me->get_property ("thickness"), 1.0); // todo: staff sym referencer?
Real staff_space = Staff_symbol_referencer::staff_space (me);
return total;
}
-
Stencil
Line_interface::make_dashed_line (Real thick, Offset from, Offset to,
- Real dash_period, Real dash_fraction)
+ Real dash_period, Real dash_fraction)
{
dash_fraction = min (max (dash_fraction, 0.0), 1.0);
Real on = dash_fraction * dash_period + thick;
Real off = max (0.0, dash_period - on);
SCM at = scm_list_n (ly_symbol2scm ("dashed-line"),
- scm_from_double (thick),
- scm_from_double (on),
- scm_from_double (off),
- scm_from_double (to[X_AXIS] - from[X_AXIS]),
- scm_from_double (to[Y_AXIS] - from[Y_AXIS]),
- scm_from_double (0.0),
- SCM_UNDEFINED);
+ scm_from_double (thick),
+ scm_from_double (on),
+ scm_from_double (off),
+ scm_from_double (to[X_AXIS] - from[X_AXIS]),
+ scm_from_double (to[Y_AXIS] - from[Y_AXIS]),
+ scm_from_double (0.0),
+ SCM_UNDEFINED);
Box box;
box.add_point (Offset (0, 0));
Line_interface::make_line (Real th, Offset from, Offset to)
{
SCM at = scm_list_n (ly_symbol2scm ("draw-line"),
- scm_from_double (th),
- scm_from_double (from[X_AXIS]),
- scm_from_double (from[Y_AXIS]),
- scm_from_double (to[X_AXIS]),
- scm_from_double (to[Y_AXIS]),
- SCM_UNDEFINED);
+ scm_from_double (th),
+ scm_from_double (from[X_AXIS]),
+ scm_from_double (from[Y_AXIS]),
+ scm_from_double (to[X_AXIS]),
+ scm_from_double (to[Y_AXIS]),
+ SCM_UNDEFINED);
Box box;
box.add_point (from);
Stencil
Line_interface::arrows (Grob *me, Offset from, Offset to,
- bool from_arrow,
- bool to_arrow)
+ bool from_arrow,
+ bool to_arrow)
{
Stencil a;
if (from_arrow || to_arrow)
{
Real thick = Staff_symbol_referencer::line_thickness (me)
- * robust_scm2double (me->get_property ("thickness"), 1);
+ * robust_scm2double (me->get_property ("thickness"), 1);
Real ss = Staff_symbol_referencer::staff_space (me);
Real len = robust_scm2double (me->get_property ("arrow-length"), 1.3 * ss);
Real wid = robust_scm2double (me->get_property ("arrow-width"), 0.5 * ss);
if (to_arrow)
- a.add_stencil (make_arrow (from, to, thick, len, wid));
+ a.add_stencil (make_arrow (from, to, thick, len, wid));
if (from_arrow)
- a.add_stencil (make_arrow (to, from, thick, len, wid));
+ a.add_stencil (make_arrow (to, from, thick, len, wid));
}
return a;
Line_interface::line (Grob *me, Offset from, Offset to)
{
Real thick = Staff_symbol_referencer::line_thickness (me)
- * robust_scm2double (me->get_property ("thickness"), 1);
+ * robust_scm2double (me->get_property ("thickness"), 1);
SCM type = me->get_property ("style");
if (type == ly_symbol2scm ("zigzag"))
return make_trill_line (me, from, to);
else if (type == ly_symbol2scm ("none"))
return Stencil ();
-
+
Stencil stencil;
if (type == ly_symbol2scm ("dashed-line") || type == ly_symbol2scm ("dotted-line"))
{
Real fraction
- = type == ly_symbol2scm ("dotted-line")
- ? 0.0
- : robust_scm2double (me->get_property ("dash-fraction"), 0.4);
+ = type == ly_symbol2scm ("dotted-line")
+ ? 0.0
+ : robust_scm2double (me->get_property ("dash-fraction"), 0.4);
fraction = min (max (fraction, 0.0), 1.0);
Real period = Staff_symbol_referencer::staff_space (me)
- * robust_scm2double (me->get_property ("dash-period"), 1.0);
+ * robust_scm2double (me->get_property ("dash-period"), 1.0);
if (period <= 0)
- return Stencil ();
+ return Stencil ();
Real len = (to - from).length ();
-
+
int n = (int) rint ((len - period * fraction) / period);
n = max (0, n);
if (n > 0)
- {
- /*
- TODO: figure out something intelligent for really short
- sections.
- */
- period = ((to - from).length () - period * fraction) / n;
- }
+ {
+ /*
+ TODO: figure out something intelligent for really short
+ sections.
+ */
+ period = ((to - from).length () - period * fraction) / n;
+ }
stencil = make_dashed_line (thick, from, to, period, fraction);
}
else
}
ADD_INTERFACE (Line_interface,
- "Generic line objects. Any object using lines supports this."
- " The property @code{style} can be @code{line},"
- " @code{dashed-line}, @code{trill}, @code{dotted-line},"
- " @code{zigzag} or @code{none} (a transparent line).\n"
- "\n"
- "For @code{dashed-line}, the length of the dashes is tuned"
- " with @code{dash-fraction}. If the latter is set to@tie{}0, a"
- " dotted line is produced.",
-
- /* properties */
- "arrow-length "
- "arrow-width "
- "dash-fraction "
- "dash-period "
- "style "
- "thickness "
- "zigzag-length "
- "zigzag-width "
- );
+ "Generic line objects. Any object using lines supports this."
+ " The property @code{style} can be @code{line},"
+ " @code{dashed-line}, @code{trill}, @code{dotted-line},"
+ " @code{zigzag} or @code{none} (a transparent line).\n"
+ "\n"
+ "For @code{dashed-line}, the length of the dashes is tuned"
+ " with @code{dash-fraction}. If the latter is set to@tie{}0, a"
+ " dotted line is produced.",
+
+ /* properties */
+ "arrow-length "
+ "arrow-width "
+ "dash-fraction "
+ "dash-period "
+ "style "
+ "thickness "
+ "zigzag-length "
+ "zigzag-width "
+ );
SCM details = SCM_BOOL_F;
if (details == SCM_BOOL_F)
details = ly_assoc_get ((dir == LEFT)
- ? ly_symbol2scm ("left")
- : ly_symbol2scm ("right"), bound_details, SCM_BOOL_F);
+ ? ly_symbol2scm ("left")
+ : ly_symbol2scm ("right"), bound_details, SCM_BOOL_F);
if (me->get_bound (dir)->break_status_dir ())
{
SCM extra = ly_assoc_get ((dir == LEFT)
- ? ly_symbol2scm ("left-broken")
- : ly_symbol2scm ("right-broken"), bound_details, SCM_EOL);
+ ? ly_symbol2scm ("left-broken")
+ : ly_symbol2scm ("right-broken"), bound_details, SCM_EOL);
for (SCM s = scm_reverse (extra); scm_is_pair (s); s = scm_cdr (s))
- details = scm_cons (scm_car (s), details);
+ details = scm_cons (scm_car (s), details);
}
if (details == SCM_BOOL_F)
Output_def *layout = me->layout ();
SCM properties = Font_interface::text_font_alist_chain (me);
details = scm_acons (ly_symbol2scm ("stencil"),
- Text_interface::interpret_markup (layout->self_scm (),
- properties, text),
- details);
+ Text_interface::interpret_markup (layout->self_scm (),
+ properties, text),
+ details);
}
if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("X"), details, SCM_BOOL_F)))
{
Direction attach = (Direction)
- robust_scm2int (ly_assoc_get (ly_symbol2scm ("attach-dir"),
- details, SCM_BOOL_F),
- CENTER);
+ robust_scm2int (ly_assoc_get (ly_symbol2scm ("attach-dir"),
+ details, SCM_BOOL_F),
+ CENTER);
Item *bound_item = me->get_bound (dir);
Grob *bound_grob = bound_item;
if (to_boolean (ly_assoc_get (ly_symbol2scm ("end-on-note"), details, SCM_BOOL_F))
- && bound_item->break_status_dir ())
- {
- extract_grob_set (me, "note-columns", columns);
- if (columns.size ())
- bound_grob = (dir == LEFT)
- ? columns[0] : columns.back();
- }
+ && bound_item->break_status_dir ())
+ {
+ extract_grob_set (me, "note-columns", columns);
+ if (columns.size ())
+ bound_grob = (dir == LEFT)
+ ? columns[0] : columns.back ();
+ }
details = scm_acons (ly_symbol2scm ("X"),
- scm_from_double (robust_relative_extent (bound_grob, commonx, X_AXIS)
- .linear_combination (attach)),
- details);
+ scm_from_double (robust_relative_extent (bound_grob, commonx, X_AXIS)
+ .linear_combination (attach)),
+ details);
}
-
if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("Y"), details, SCM_BOOL_F)))
{
Real y = 0.0;
Real extra_dy = robust_scm2double (me->get_property ("extra-dy"),
- 0.0);
+ 0.0);
Grob *common_y = me->common_refpoint (me->get_bound (dir), Y_AXIS);
if (me->get_bound (dir)->break_status_dir ())
- {
- if (to_boolean (me->get_property ("simple-Y")))
- {
- Spanner *orig = dynamic_cast<Spanner *>(me->original ());
- Spanner *extreme = dir == LEFT ? orig->broken_intos_.front () : orig->broken_intos_.back ();
- Grob *e_bound = extreme->get_bound (dir);
+ {
+ if (to_boolean (me->get_property ("simple-Y")))
+ {
+ Spanner *orig = dynamic_cast<Spanner *>(me->original ());
+ Spanner *extreme = dir == LEFT ? orig->broken_intos_.front () : orig->broken_intos_.back ();
+ Grob *e_bound = extreme->get_bound (dir);
Grob *e_common_y = extreme->common_refpoint (e_bound, Y_AXIS);
y = e_bound->extent (e_common_y, Y_AXIS).center ();
- }
+ }
else
{
- Spanner *next_sp = me->broken_neighbor (dir);
- Item *next_bound = next_sp->get_bound (dir);
-
- if (next_bound->break_status_dir ())
- {
- programming_error ("no note heads for the line spanner on neighbor line?"
- " Confused.");
- me->suicide ();
- return SCM_EOL;
- }
-
- Spanner *next_bound_parent = parent_spanner (next_bound);
- Interval next_ext = next_bound->extent (next_bound_parent, Y_AXIS);
-
- /*
- We want to know what would be the y-position of the next
- bound (relative to my y-parent) if it belonged to the
- same system as this bound. We rely on the fact that the
- y-parent of the next bound is a spanner (probably the
- VerticalAxisGroup of a staff) that extends over the break.
- */
- Spanner *next_bound_parent_on_this_line =
- next_bound_parent->broken_neighbor (other_dir (dir));
-
- if (next_bound_parent_on_this_line)
- {
- Grob *common = me->common_refpoint (next_bound_parent_on_this_line, Y_AXIS);
- Real bound_offset = next_bound_parent_on_this_line->relative_coordinate (common, Y_AXIS);
- y = next_ext.center () + bound_offset - me->relative_coordinate (common, Y_AXIS);
- }
- else
- {
- /*
- We fall back to assuming that the distance between
- staves doesn't change over line breaks.
- */
- programming_error ("next-bound's parent doesn't extend to this line");
- Grob *next_system = next_bound->get_system ();
- Grob *this_system = me->get_system ();
- y = next_ext.center () + next_bound_parent->relative_coordinate (next_system, Y_AXIS)
- - me->relative_coordinate (this_system, Y_AXIS);
- }
+ Spanner *next_sp = me->broken_neighbor (dir);
+ Item *next_bound = next_sp->get_bound (dir);
+
+ if (next_bound->break_status_dir ())
+ {
+ programming_error ("no note heads for the line spanner on neighbor line?"
+ " Confused.");
+ me->suicide ();
+ return SCM_EOL;
+ }
+
+ Spanner *next_bound_parent = parent_spanner (next_bound);
+ Interval next_ext = next_bound->extent (next_bound_parent, Y_AXIS);
+
+ /*
+ We want to know what would be the y-position of the next
+ bound (relative to my y-parent) if it belonged to the
+ same system as this bound. We rely on the fact that the
+ y-parent of the next bound is a spanner (probably the
+ VerticalAxisGroup of a staff) that extends over the break.
+ */
+ Spanner *next_bound_parent_on_this_line
+ = next_bound_parent->broken_neighbor (other_dir (dir));
+
+ if (next_bound_parent_on_this_line)
+ {
+ Grob *common = me->common_refpoint (next_bound_parent_on_this_line, Y_AXIS);
+ Real bound_offset = next_bound_parent_on_this_line->relative_coordinate (common, Y_AXIS);
+ y = next_ext.center () + bound_offset - me->relative_coordinate (common, Y_AXIS);
+ }
+ else
+ {
+ /*
+ We fall back to assuming that the distance between
+ staves doesn't change over line breaks.
+ */
+ programming_error ("next-bound's parent doesn't extend to this line");
+ Grob *next_system = next_bound->get_system ();
+ Grob *this_system = me->get_system ();
+ y = next_ext.center () + next_bound_parent->relative_coordinate (next_system, Y_AXIS)
+ - me->relative_coordinate (this_system, Y_AXIS);
+ }
}
- }
+ }
else
- {
- y = me->get_bound (dir)->extent (common_y, Y_AXIS).center ();
- details = scm_acons (ly_symbol2scm ("common-Y"), common_y->self_scm (), details);
- }
+ {
+ y = me->get_bound (dir)->extent (common_y, Y_AXIS).center ();
+ details = scm_acons (ly_symbol2scm ("common-Y"), common_y->self_scm (), details);
+ }
- y += dir * extra_dy / 2;
+ y += dir * extra_dy / 2;
details = scm_acons (ly_symbol2scm ("Y"), scm_from_double (y), details);
}
Output_def *layout = me->layout ();
SCM properties = Font_interface::text_font_alist_chain (me);
alist = scm_acons (ly_symbol2scm ("stencil"),
- Text_interface::interpret_markup (layout->self_scm (),
- properties, text),
- alist);
+ Text_interface::interpret_markup (layout->self_scm (),
+ properties, text),
+ alist);
}
return alist;
bool simple_y = to_boolean (me->get_property ("simple-Y")) && !to_boolean (me->get_property ("cross-staff"));
Drul_array<SCM> bounds (me->get_property ("left-bound-info"),
- me->get_property ("right-bound-info"));
+ me->get_property ("right-bound-info"));
Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
commonx = me->common_refpoint (commonx, X_AXIS);
Drul_array<Offset> span_points;
- Direction d = LEFT;
+ Direction d = LEFT;
do
{
Offset z (robust_scm2double (ly_assoc_get (ly_symbol2scm ("X"),
- bounds[d], SCM_BOOL_F), 0.0),
- robust_scm2double (ly_assoc_get (ly_symbol2scm ("Y"),
- bounds[d], SCM_BOOL_F), 0.0));
+ bounds[d], SCM_BOOL_F), 0.0),
+ robust_scm2double (ly_assoc_get (ly_symbol2scm ("Y"),
+ bounds[d], SCM_BOOL_F), 0.0));
span_points[d] = z;
}
Drul_array<Real> gaps (0, 0);
Drul_array<bool> arrows (0, 0);
- Drul_array<Stencil *> stencils (0,0);
+ Drul_array<Stencil *> stencils (0, 0);
Drul_array<Grob *> common_y (0, 0);
// For scaling of 'padding and 'stencil-offset
do
{
gaps[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("padding"),
- bounds[d], SCM_BOOL_F), 0.0);
+ bounds[d], SCM_BOOL_F), 0.0);
arrows[d] = to_boolean (ly_assoc_get (ly_symbol2scm ("arrow"),
- bounds[d], SCM_BOOL_F));
+ bounds[d], SCM_BOOL_F));
stencils[d] = unsmob_stencil (ly_assoc_get (ly_symbol2scm ("stencil"),
- bounds[d], SCM_BOOL_F));
+ bounds[d], SCM_BOOL_F));
common_y[d] = unsmob_grob (ly_assoc_get (ly_symbol2scm ("common-Y"),
- bounds[d], SCM_BOOL_F));
+ bounds[d], SCM_BOOL_F));
if (!common_y[d])
- common_y[d] = me;
+ common_y[d] = me;
}
while (flip (&d) != LEFT);
span_points[d] += -d * gaps[d] * magstep * dz.direction ();
if (stencils[d])
- {
- Stencil s = stencils[d]->translated (span_points[d]);
- SCM align = ly_assoc_get (ly_symbol2scm ("stencil-align-dir-y"),
- bounds[d], SCM_BOOL_F);
- SCM off = ly_assoc_get (ly_symbol2scm ("stencil-offset"),
- bounds[d], SCM_BOOL_F);
+ {
+ Stencil s = stencils[d]->translated (span_points[d]);
+ SCM align = ly_assoc_get (ly_symbol2scm ("stencil-align-dir-y"),
+ bounds[d], SCM_BOOL_F);
+ SCM off = ly_assoc_get (ly_symbol2scm ("stencil-offset"),
+ bounds[d], SCM_BOOL_F);
- if (scm_is_number (align))
- s.align_to (Y_AXIS, scm_to_double (align));
+ if (scm_is_number (align))
+ s.align_to (Y_AXIS, scm_to_double (align));
- if (is_number_pair (off))
- s.translate (ly_scm2offset (off) * magstep);
+ if (is_number_pair (off))
+ s.translate (ly_scm2offset (off) * magstep);
- line.add_stencil (s);
- }
+ line.add_stencil (s);
+ }
}
while (flip (&d) != LEFT);
do
{
if (stencils[d])
- span_points[d] += dz_dir *
- (stencils[d]->extent (X_AXIS)[-d] / dz_dir[X_AXIS]);
+ span_points[d] += dz_dir *
+ (stencils[d]->extent (X_AXIS)[-d] / dz_dir[X_AXIS]);
}
while (flip (&d) != LEFT);
- Offset adjust = dz.direction() * Staff_symbol_referencer::staff_space (me);
+ Offset adjust = dz.direction () * Staff_symbol_referencer::staff_space (me);
- Offset line_left = span_points[LEFT] + (arrows[LEFT] ? adjust*1.4 : Offset (0, 0));
- Offset line_right = span_points[RIGHT] - (arrows[RIGHT] ? adjust*0.55 : Offset (0, 0));
+ Offset line_left = span_points[LEFT] + (arrows[LEFT] ? adjust * 1.4 : Offset (0, 0));
+ Offset line_right = span_points[RIGHT] - (arrows[RIGHT] ? adjust * 0.55 : Offset (0, 0));
if (line_right[X_AXIS] > line_left[X_AXIS])
{
line.add_stencil (Line_interface::line (me, line_left, line_right));
line.add_stencil (Line_interface::arrows (me,
- span_points[LEFT],
- span_points[RIGHT],
- arrows[LEFT],
- arrows[RIGHT]));
+ span_points[LEFT],
+ span_points[RIGHT],
+ arrows[LEFT],
+ arrows[RIGHT]));
}
line.translate (Offset (-me->relative_coordinate (commonx, X_AXIS),
- simple_y ? 0.0 : -me->relative_coordinate (my_common_y, Y_AXIS)));
-
+ simple_y ? 0.0 : -me->relative_coordinate (my_common_y, Y_AXIS)));
return line.smobbed_copy ();
}
ADD_INTERFACE (Line_spanner,
- "Generic line drawn between two objects, e.g., for use with"
- " glissandi.",
-
- /* properties */
- "bound-details "
- "extra-dy "
- "gap "
- "left-bound-info "
- "note-columns "
- "right-bound-info "
- "simple-Y "
- "thickness "
- "to-barline "
- );
+ "Generic line drawn between two objects, e.g., for use with"
+ " glissandi.",
+
+ /* properties */
+ "bound-details "
+ "extra-dy "
+ "gap "
+ "left-bound-info "
+ "note-columns "
+ "right-bound-info "
+ "simple-Y "
+ "thickness "
+ "to-barline "
+ );
Listener::Listener (Listener const &other)
{
target_ = other.target_;
- type_ = other.type_;
+ type_ = other.type_;
}
-void Listener::listen (SCM ev) const {
+void Listener::listen (SCM ev) const
+{
(type_->listen_callback) (target_, ev);
}
}
int
-Listener::print_smob (SCM, SCM p, scm_print_state*)
+Listener::print_smob (SCM, SCM p, scm_print_state *)
{
scm_puts ("#<Listener>", p);
return 1;
Lookup::dot (Offset p, Real radius)
{
SCM at = (scm_list_n (ly_symbol2scm ("dot"),
- scm_from_double (p[X_AXIS]),
- scm_from_double (p[Y_AXIS]),
- scm_from_double (radius),
- SCM_UNDEFINED));
+ scm_from_double (p[X_AXIS]),
+ scm_from_double (p[Y_AXIS]),
+ scm_from_double (radius),
+ SCM_UNDEFINED));
Box box;
box.add_point (p - Offset (radius, radius));
box.add_point (p + Offset (radius, radius));
SCM points = SCM_EOL;
points = scm_cons (scm_from_double (p[X_AXIS]),
- scm_cons (scm_from_double (p[Y_AXIS]),
- points));
+ scm_cons (scm_from_double (p[Y_AXIS]),
+ points));
p = Offset (0, -thick / 2);
b.add_point (p);
p += Offset (1, 1) * (blot / 2);
points = scm_cons (scm_from_double (p[X_AXIS]),
- scm_cons (scm_from_double (p[Y_AXIS]),
- points));
+ scm_cons (scm_from_double (p[Y_AXIS]),
+ points));
p = Offset (width, width * slope - thick / 2);
b.add_point (p);
p += Offset (-1, 1) * (blot / 2);
points = scm_cons (scm_from_double (p[X_AXIS]),
- scm_cons (scm_from_double (p[Y_AXIS]),
- points));
+ scm_cons (scm_from_double (p[Y_AXIS]),
+ points));
p = Offset (width, width * slope + thick / 2);
b.add_point (p);
p += Offset (-1, -1) * (blot / 2);
points = scm_cons (scm_from_double (p[X_AXIS]),
- scm_cons (scm_from_double (p[Y_AXIS]),
- points));
+ scm_cons (scm_from_double (p[Y_AXIS]),
+ points));
SCM expr = scm_list_n (ly_symbol2scm ("polygon"),
- ly_quote_scm (points),
- scm_from_double (blot),
- SCM_BOOL_T,
- SCM_UNDEFINED);
+ ly_quote_scm (points),
+ scm_from_double (blot),
+ SCM_BOOL_T,
+ SCM_UNDEFINED);
return Stencil (b, expr);
}
vector<Offset> pts;
Offset rot (1, slope);
- thick -= 2*blot;
- width -= 2*blot;
- rot /= sqrt (1 + slope*slope);
+ thick -= 2 * blot;
+ width -= 2 * blot;
+ rot /= sqrt (1 + slope * slope);
pts.push_back (Offset (0, -thick / 2) * rot);
pts.push_back (Offset (width, -thick / 2) * rot);
pts.push_back (Offset (width, thick / 2) * rot);
Lookup::horizontal_line (Interval w, Real th)
{
SCM at = scm_list_n (ly_symbol2scm ("draw-line"),
- scm_from_double (th),
- scm_from_double (w[LEFT]),
- scm_from_double (0),
- scm_from_double (w[RIGHT]),
- scm_from_double (0),
- SCM_UNDEFINED);
+ scm_from_double (th),
+ scm_from_double (w[LEFT]),
+ scm_from_double (0),
+ scm_from_double (w[RIGHT]),
+ scm_from_double (0),
+ SCM_UNDEFINED);
Box box;
box[X_AXIS] = w;
blotdiameter = b.y ().length ();
SCM at = (scm_list_n (ly_symbol2scm ("round-filled-box"),
- scm_from_double (-b[X_AXIS][LEFT]),
- scm_from_double (b[X_AXIS][RIGHT]),
- scm_from_double (-b[Y_AXIS][DOWN]),
- scm_from_double (b[Y_AXIS][UP]),
- scm_from_double (blotdiameter),
- SCM_UNDEFINED));
+ scm_from_double (-b[X_AXIS][LEFT]),
+ scm_from_double (b[X_AXIS][RIGHT]),
+ scm_from_double (-b[Y_AXIS][DOWN]),
+ scm_from_double (b[Y_AXIS][UP]),
+ scm_from_double (blotdiameter),
+ SCM_UNDEFINED));
return Stencil (b, at);
}
*/
Stencil
Lookup::round_filled_polygon (vector<Offset> const &points,
- Real blotdiameter)
+ Real blotdiameter)
{
/* TODO: Maybe print a warning if one of the above limitations
applies to the given polygon. However, this is quite complicated
int next = (i + 1) % points.size ();
Real d = (points[i] - points[next]).length ();
if (d < epsilon)
- programming_error ("Polygon should not have duplicate points");
+ programming_error ("Polygon should not have duplicate points");
}
#endif
Offset p10 = p0 - p1;
Offset p12 = p2 - p1;
if (p10.length () != 0.0)
- { // recompute ccw
- Real phi = p10.arg ();
- // rotate (p2 - p0) by (-phi)
- Offset q = complex_multiply (p2 - p0, complex_exp (Offset (1.0, -phi)));
-
- if (q[Y_AXIS] > 0)
- ccw = 1;
- else if (q[Y_AXIS] < 0)
- ccw = 0;
- else {} // keep ccw unchanged
- }
+ {
+ // recompute ccw
+ Real phi = p10.arg ();
+ // rotate (p2 - p0) by (-phi)
+ Offset q = complex_multiply (p2 - p0, complex_exp (Offset (1.0, -phi)));
+
+ if (q[Y_AXIS] > 0)
+ ccw = 1;
+ else if (q[Y_AXIS] < 0)
+ ccw = 0;
+ else {} // keep ccw unchanged
+ }
else {} // keep ccw unchanged
Offset p10n = (1.0 / p10.length ()) * p10; // normalize length to 1.0
Offset p12n = (1.0 / p12.length ()) * p12;
Offset p13;
Real d = p13n.length () * p14n.length (); // distance p3n to line (p1..p0)
if (d < epsilon)
- // special case: p0, p1, p2 are on a single line => build
- // vector orthogonal to (p2-p0) of length 0.5 blotdiameter
- {
- p13[X_AXIS] = p10[Y_AXIS];
- p13[Y_AXIS] = -p10[X_AXIS];
- p13 = (0.5 * blotdiameter / p13.length ()) * p13;
- }
+ // special case: p0, p1, p2 are on a single line => build
+ // vector orthogonal to (p2-p0) of length 0.5 blotdiameter
+ {
+ p13[X_AXIS] = p10[Y_AXIS];
+ p13[Y_AXIS] = -p10[X_AXIS];
+ p13 = (0.5 * blotdiameter / p13.length ()) * p13;
+ }
else
- p13 = (0.5 * blotdiameter / d) * p13n;
+ p13 = (0.5 * blotdiameter / d) * p13n;
shrunk_points[i1] = p1 + ((ccw) ? p13 : -p13);
}
box.add_point (points[i]);
}
SCM polygon_scm = scm_list_n (ly_symbol2scm ("polygon"),
- ly_quote_scm (shrunk_points_scm),
- scm_from_double (blotdiameter),
- SCM_BOOL_T,
- SCM_UNDEFINED);
+ ly_quote_scm (shrunk_points_scm),
+ scm_from_double (blotdiameter),
+ SCM_BOOL_T,
+ SCM_UNDEFINED);
Stencil polygon = Stencil (box, polygon_scm);
shrunk_points.clear ();
Direction d = LEFT;
for (Axis a = X_AXIS; a < NO_AXES; a = Axis (a + 1))
{
- Axis o = Axis ((a + 1)%NO_AXES);
+ Axis o = Axis ((a + 1) % NO_AXES);
do
- {
- Box edges;
- edges[a] = b[a][d] + 0.5 * thick * Interval (-1, 1);
- edges[o][DOWN] = b[o][DOWN] - thick / 2;
- edges[o][UP] = b[o][UP] + thick / 2;
-
- m.add_stencil (round_filled_box (edges, blot));
- }
+ {
+ Box edges;
+ edges[a] = b[a][d] + 0.5 * thick * Interval (-1, 1);
+ edges[o][DOWN] = b[o][DOWN] - thick / 2;
+ edges[o][UP] = b[o][UP] + thick / 2;
+
+ m.add_stencil (round_filled_box (edges, blot));
+ }
while (flip (&d) != LEFT);
}
return m;
{
Stencil return_value;
- /*
+ /*
calculate the offset for the two beziers that make the sandwich
for the slur
*/
curve.control_[1] -= perp;
curve.control_[2] -= perp;
-
+
if (!scm_is_pair (dash_details))
- {
+ {
/* solid slur */
return_value = bezier_sandwich (back, curve, linethick);
}
else
- {
+ {
/* dashed or combination slur */
int num_segments = scm_to_int (scm_length (dash_details));
- for (int i=0; i<num_segments; i++)
+ for (int i = 0; i < num_segments; i++)
{
SCM dash_pattern = scm_list_ref (dash_details, scm_from_int (i));
Real t_min = robust_scm2double (scm_car (dash_pattern), 0);
Real t_max = robust_scm2double (scm_cadr (dash_pattern), 1.0);
- Real dash_fraction =
- robust_scm2double (scm_caddr (dash_pattern), 1.0);
- Real dash_period =
- robust_scm2double (scm_cadddr (dash_pattern), 0.75);
+ Real dash_fraction
+ = robust_scm2double (scm_caddr (dash_pattern), 1.0);
+ Real dash_period
+ = robust_scm2double (scm_cadddr (dash_pattern), 0.75);
Bezier back_segment = back.extract (t_min, t_max);
Bezier curve_segment = curve.extract (t_min, t_max);
- if (dash_fraction == 1.0)
- return_value.add_stencil (bezier_sandwich (back_segment,
- curve_segment,
- linethick));
+ if (dash_fraction == 1.0)
+ return_value.add_stencil (bezier_sandwich (back_segment,
+ curve_segment,
+ linethick));
else
{
Bezier back_dash, curve_dash;
- Real seg_length = (back_segment.control_[3] -
- back_segment.control_[0]).length ();
+ Real seg_length = (back_segment.control_[3]
+ - back_segment.control_[0]).length ();
int pattern_count = (int) (seg_length / dash_period);
Real pattern_length = 1.0 / (pattern_count + dash_fraction);
Real start_t, end_t;
{
start_t = p * pattern_length;
end_t = (p + dash_fraction) * pattern_length;
- back_dash =
- back_segment.extract (start_t, end_t);
- curve_dash =
- curve_segment.extract (start_t, end_t);
+ back_dash
+ = back_segment.extract (start_t, end_t);
+ curve_dash
+ = curve_segment.extract (start_t, end_t);
return_value.add_stencil (bezier_sandwich (back_dash,
curve_dash,
linethick));
return return_value;
}
-
/*
* Bezier Sandwich:
*
list = scm_cons (ly_offset2scm (top_curve.control_[1]), list);
SCM horizontal_bend = scm_list_n (ly_symbol2scm ("bezier-sandwich"),
- ly_quote_scm (list),
- scm_from_double (thickness),
- SCM_UNDEFINED);
+ ly_quote_scm (list),
+ scm_from_double (thickness),
+ SCM_UNDEFINED);
Interval x_extent = top_curve.extent (X_AXIS);
x_extent.unite (bottom_curve.extent (X_AXIS));
SCM sl = scm_from_double (s);
SCM thick = scm_from_double (t);
SCM slashnodot = scm_list_n (ly_symbol2scm ("repeat-slash"),
- wid, sl, thick, SCM_UNDEFINED);
+ wid, sl, thick, SCM_UNDEFINED);
Box b (Interval (0, w + sqrt (sqr (t / s) + sqr (t))),
- Interval (0, w * s));
+ Interval (0, w * s));
return Stencil (b, slashnodot); // http://slashnodot.org
}
Lookup::bracket (Axis a, Interval iv, Real thick, Real protrude, Real blot)
{
Box b;
- Axis other = Axis ((a + 1)%2);
+ Axis other = Axis ((a + 1) % 2);
b[a] = iv;
b[other] = Interval (-1, 1) * thick * 0.5;
}
-
-
Stencil
Lookup::points_to_line_stencil (Real thick, vector<Offset> const &points)
{
Stencil ret;
for (vsize i = 1; i < points.size (); i++)
{
- if (points[i-1].is_sane () && points[i].is_sane ())
- {
- Stencil line
- = Line_interface::make_line (thick, points[i-1], points[i]);
- ret.add_stencil (line);
- }
+ if (points[i - 1].is_sane () && points[i].is_sane ())
+ {
+ Stencil line
+ = Line_interface::make_line (thick, points[i - 1], points[i]);
+ ret.add_stencil (line);
+ }
}
return ret;
}
#include "std-string.hh"
#include "protected-scm.hh"
-
-
SCM
ly_make_module (bool safe)
{
SCM maker = ly_lily_module_constant ("make-module");
mod = scm_call_0 (maker);
/*
- Look up and call Guile module-export-all! or, when using
- Guile V1.8, the compatible shim defined in lily.scm.
+ Look up and call Guile module-export-all! or, when using
+ Guile V1.8, the compatible shim defined in lily.scm.
*/
SCM module_export_all_x = ly_lily_module_constant ("module-export-all!");
scm_call_1 (module_export_all_x, mod);
/*
- Evaluate Guile module "the-root-module",
- and ensure we inherit definitions from it and the "lily" module
- N.B. this used to be "the-scm-module" and is deprecated in
- Guile V1.9/2.0
+ Evaluate Guile module "the-root-module",
+ and ensure we inherit definitions from it and the "lily" module
+ N.B. this used to be "the-scm-module" and is deprecated in
+ Guile V1.9/2.0
*/
SCM scm_module = ly_lily_module_constant ("the-root-module");
ly_use_module (mod, scm_module);
#define FUNC_NAME __FUNCTION__
-
SCM
ly_module_symbols (SCM mod)
{
static SCM
entry_to_alist (void * /* closure */,
- SCM key,
- SCM val,
- SCM result)
+ SCM key,
+ SCM val,
+ SCM result)
{
if (scm_variable_bound_p (val) == SCM_BOOL_T)
return scm_cons (scm_cons (key, scm_variable_ref (val)), result);
}
LY_DEFINE (ly_module_2_alist, "ly:module->alist",
- 1, 0, 0, (SCM mod),
- "Dump the contents of module @var{mod} as an alist.")
+ 1, 0, 0, (SCM mod),
+ "Dump the contents of module @var{mod} as an alist.")
{
SCM_VALIDATE_MODULE (1, mod);
SCM obarr = SCM_MODULE_OBARRAY (mod);
return scm_internal_hash_fold ((scm_t_hash_fold_fn) &entry_to_alist,
- NULL, SCM_EOL, obarr);
+ NULL, SCM_EOL, obarr);
}
void
Moment busy_moment_;
Moment pending_grace_moment_;
-
+
Music_iterator *lyric_iter_;
};
busy_moment_.set_infinite (-1);
}
-
/*
It's dubious whether we can ever make this fully work. Due to
- associatedVoice switching, this routine may be triggered for
- the wrong music_context_
+ associatedVoice switching, this routine may be triggered for
+ the wrong music_context_
*/
IMPLEMENT_LISTENER (Lyric_combine_music_iterator, set_busy)
void
if ((e->in_event_class ("note-event") || e->in_event_class ("cluster-note-event"))
&& music_context_)
-
+
busy_moment_ = max (music_context_->now_mom (),
- busy_moment_);
-
+ busy_moment_);
+
}
void
if (music_context_)
{
music_context_->event_source ()->
- remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
+ remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
}
music_context_ = to;
if (to)
{
to->event_source ()->add_listener (GET_LISTENER (set_busy),
- ly_symbol2scm ("music-event"));
+ ly_symbol2scm ("music-event"));
}
}
{
bool m = melisma_busy (music_context_);
if (m)
- return false;
+ return false;
}
return true;
if (!lyric_iter_)
return;
lyrics_context_ = find_context_below (lyric_iter_->get_outlet (),
- ly_symbol2scm ("Lyrics"), "");
+ ly_symbol2scm ("Lyrics"), "");
if (!lyrics_context_)
{
m->origin ()->warning ("argument of \\lyricsto should contain Lyrics context");
}
-
+
lyricsto_voice_name_ = get_music ()->get_property ("associated-context");
Context *voice = find_voice ();
set_music_context (voice);
/*
- Wait for a Create_context event. If this isn't done, lyrics can be
+ Wait for a Create_context event. If this isn't done, lyrics can be
delayed when voices are created implicitly.
*/
Global_context *g = get_outlet ()->get_global_context ();
Lyric_combine_music_iterator::check_new_context (SCM sev)
{
if (!ok ())
- return ;
-
+ return;
+
// Search for a possible candidate voice to attach the lyrics to. If none
// is found, we'll try next time again.
Context *voice = find_voice ();
{
SCM voice_name = lyricsto_voice_name_;
SCM running = lyrics_context_
- ? lyrics_context_->get_property ("associatedVoice")
- : SCM_EOL;
+ ? lyrics_context_->get_property ("associatedVoice")
+ : SCM_EOL;
if (scm_is_string (running))
voice_name = running;
{
Context *t = get_outlet ();
while (t && t->get_parent_context ())
- t = t->get_parent_context ();
+ t = t->get_parent_context ();
string name = ly_scm2string (voice_name);
return find_context_below (t, ly_symbol2scm ("Voice"), name);
if (!music_context_->get_parent_context ())
{
/*
- The melody has died.
- We die too.
+ The melody has died.
+ We die too.
*/
if (lyrics_context_)
- lyrics_context_->unset_property (ly_symbol2scm ("associatedVoiceContext"));
+ lyrics_context_->unset_property (ly_symbol2scm ("associatedVoiceContext"));
lyric_iter_ = 0;
set_music_context (0);
}
if (music_context_
- && (start_new_syllable () ||
- (busy_moment_ >= pending_grace_moment_))
+ && (start_new_syllable ()
+ || (busy_moment_ >= pending_grace_moment_))
&& lyric_iter_->ok ())
{
Moment now = music_context_->now_mom ();
if (now.grace_part_ && !to_boolean (lyrics_context_->get_property ("includeGraceNotes")))
- {
- pending_grace_moment_ = now;
- pending_grace_moment_.grace_part_ = Rational (0);
- return;
- }
+ {
+ pending_grace_moment_ = now;
+ pending_grace_moment_.grace_part_ = Rational (0);
+ return;
+ }
else
- {
- pending_grace_moment_.set_infinite (1);
- }
+ {
+ pending_grace_moment_.set_infinite (1);
+ }
Moment m = lyric_iter_->pending_moment ();
lyrics_context_->set_property (ly_symbol2scm ("associatedVoiceContext"),
- music_context_->self_scm ());
+ music_context_->self_scm ());
lyric_iter_->process (m);
music_found_ = true;
SCM text = event_->get_property ("text");
if (ly_is_equal (text, scm_from_locale_string (" ")))
- {
- if (last_text_)
- last_text_->set_property ("self-alignment-X",
- get_property ("lyricMelismaAlignment"));
- }
+ {
+ if (last_text_)
+ last_text_->set_property ("self-alignment-X",
+ get_property ("lyricMelismaAlignment"));
+ }
else
- text_ = make_item ("LyricText", event_->self_scm ());
+ text_ = make_item ("LyricText", event_->self_scm ());
}
- Context *voice = get_voice_to_lyrics (context ());
- if (last_text_
- && voice
- && to_boolean (voice->get_property ("melismaBusy"))
- && !to_boolean (context ()->get_property ("ignoreMelismata")))
- last_text_->set_property ("self-alignment-X",
- get_property ("lyricMelismaAlignment"));
+ Context *voice = get_voice_to_lyrics (context ());
+ if (last_text_
+ && voice
+ && to_boolean (voice->get_property ("melismaBusy"))
+ && !to_boolean (context ()->get_property ("ignoreMelismata")))
+ last_text_->set_property ("self-alignment-X",
+ get_property ("lyricMelismaAlignment"));
}
Context *
{
ssize idx = nm.rfind ('-');
if (idx != NPOS)
- nm = nm.substr (0, idx);
+ nm = nm.substr (0, idx);
}
Context *parent = lyrics;
Grob *g = unsmob_grob (scm_cdar (s));;
Moment *end_mom = unsmob_moment (scm_caar (s));
if (!end_mom || !g)
- {
- programming_error ("busyGrobs invalid");
- continue;
- }
+ {
+ programming_error ("busyGrobs invalid");
+ continue;
+ }
- if (((end_mom->main_part_ > now.main_part_) ||
- (include_grace_notes && end_mom->grace_part_ > now.grace_part_))
+ if (((end_mom->main_part_ > now.main_part_)
+ || (include_grace_notes && end_mom->grace_part_ > now.grace_part_))
&& dynamic_cast<Item *> (g)
&& Note_head::has_interface (g))
{
- return g;
+ return g;
}
}
Context *voice = get_voice_to_lyrics (context ());
if (voice)
- {
- bool include_grace_notes = to_boolean (get_property ("includeGraceNotes"));
- Grob *head = get_current_note_head (voice, include_grace_notes);
-
- if (head)
- {
- text_->set_parent (head, X_AXIS);
- if (melisma_busy (voice)
- && !to_boolean (get_property ("ignoreMelismata")))
- text_->set_property ("self-alignment-X",
- get_property ("lyricMelismaAlignment"));
- }
- else
- {
- text_->warning (_ ("Lyric syllable does not have note. Use \\lyricsto or associatedVoice."));
- text_->set_property ("X-offset", scm_from_int (0));
- }
- }
+ {
+ bool include_grace_notes = to_boolean (get_property ("includeGraceNotes"));
+ Grob *head = get_current_note_head (voice, include_grace_notes);
+
+ if (head)
+ {
+ text_->set_parent (head, X_AXIS);
+ if (melisma_busy (voice)
+ && !to_boolean (get_property ("ignoreMelismata")))
+ text_->set_property ("self-alignment-X",
+ get_property ("lyricMelismaAlignment"));
+ }
+ else
+ {
+ text_->warning (_ ("Lyric syllable does not have note. Use \\lyricsto or associatedVoice."));
+ text_->set_property ("X-offset", scm_from_int (0));
+ }
+ }
last_text_ = text_;
text_ = 0;
}
ADD_TRANSLATOR (Lyric_engraver,
- /* doc */
- "Engrave text for lyrics.",
+ /* doc */
+ "Engrave text for lyrics.",
- /* create */
- "LyricText ",
+ /* create */
+ "LyricText ",
- /* read */
- "ignoreMelismata "
- "includeGraceNotes "
- "lyricMelismaAlignment "
- "searchForVoice",
+ /* read */
+ "ignoreMelismata "
+ "includeGraceNotes "
+ "lyricMelismaAlignment "
+ "searchForVoice",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
common = common->common_refpoint (me->get_bound (RIGHT), X_AXIS);
common = common->common_refpoint (me->get_system (), X_AXIS);
-
+
Real sl = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
extract_grob_set (me, "heads", heads);
= left_point + (robust_scm2double (minlen, 0));
right_point = min (right_point, me->get_system ()->get_bound (RIGHT)->relative_coordinate (common, X_AXIS));
-
+
if (heads.size ())
right_point = max (right_point, heads.back ()->extent (common, X_AXIS)[RIGHT]);
Real h = sl * robust_scm2double (me->get_property ("thickness"), 0);
Drul_array<Real> paddings (robust_scm2double (me->get_property ("left-padding"), h),
- robust_scm2double (me->get_property ("right-padding"), h));
+ robust_scm2double (me->get_property ("right-padding"), h));
if (right_text)
right_point = min (right_point, (robust_relative_extent (right_text, common, X_AXIS)[LEFT] - paddings[RIGHT]));
return SCM_EOL;
Stencil mol (Lookup::round_filled_box (Box (Interval (0, w),
- Interval (0, h)),
- 0.8 * h));
+ Interval (0, h)),
+ 0.8 * h));
mol.translate_axis (left_point - me->relative_coordinate (common, X_AXIS),
- X_AXIS);
+ X_AXIS);
return mol.smobbed_copy ();
}
ADD_INTERFACE (Lyric_extender,
- "The extender is a simple line at the baseline of the lyric"
- " that helps show the length of a melisma (a tied or slurred"
- " note).",
-
- /* properties */
- "heads "
- "left-padding "
- "next "
- "right-padding "
- "thickness "
- );
+ "The extender is a simple line at the baseline of the lyric"
+ " that helps show the length of a melisma (a tied or slurred"
+ " note).",
+
+ /* properties */
+ "heads "
+ "left-padding "
+ "next "
+ "right-padding "
+ "thickness "
+ );
#include "lyric-hyphen.hh"
-
#include "lookup.hh"
#include "output-def.hh"
#include "paper-column.hh"
{
Spanner *me = unsmob_spanner (smob);
Drul_array<Item *> bounds (me->get_bound (LEFT),
- me->get_bound (RIGHT));
+ me->get_bound (RIGHT));
if (bounds[LEFT]->break_status_dir ()
&& (Paper_column::when_mom (bounds[LEFT])
- == Paper_column::when_mom (bounds[RIGHT]->get_column ())))
+ == Paper_column::when_mom (bounds[RIGHT]->get_column ())))
return SCM_EOL;
Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS);
Interval iv = bounds[d]->extent (common, X_AXIS);
span_points[d] = iv.is_empty ()
- ? bounds[d]->relative_coordinate (common, X_AXIS)
- : iv[-d];
+ ? bounds[d]->relative_coordinate (common, X_AXIS)
+ : iv[-d];
}
while (flip (&d) != LEFT);
Real th = robust_scm2double (me->get_property ("thickness"), 1) * lt;
Real font_size_step = robust_scm2double (me->get_property ("font-size"), 0.0);
Real h = robust_scm2double (me->get_property ("height"), 0.5)
- * pow (2.0, font_size_step / 6.0);
+ * pow (2.0, font_size_step / 6.0);
// interval?
{
r.item_drul_[d] = sp->get_bound (d);
if (r.item_drul_[d])
- r.distance_ += -d * r.item_drul_[d]->extent (r.item_drul_[d], X_AXIS)[-d];
+ r.distance_ += -d * r.item_drul_[d]->extent (r.item_drul_[d], X_AXIS)[-d];
}
while (flip (&d) != LEFT);
}
ADD_INTERFACE (Lyric_hyphen,
- "A centered hyphen is simply a line between lyrics used to"
- " divide syllables.",
-
- /* properties */
- "dash-period "
- "height "
- "length "
- "minimum-distance "
- "minimum-length "
- "padding "
- "thickness "
- );
+ "A centered hyphen is simply a line between lyrics used to"
+ " divide syllables.",
+
+ /* properties */
+ "dash-period "
+ "height "
+ "length "
+ "minimum-distance "
+ "minimum-length "
+ "padding "
+ "thickness "
+ );
&& ly_scm2string (events_[0]->get_property ("text")).length ())
{
audio_ = new Audio_text (Audio_text::LYRIC,
- ly_scm2string (events_[0]->get_property ("text")));
+ ly_scm2string (events_[0]->get_property ("text")));
Audio_element_info info (audio_, events_[0]);
announce_element (info);
}
}
ADD_TRANSLATOR (Lyric_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
/* Name of initialisation file. */
string init_name_global;
-
/* Output formats to generate. */
string output_format_global = "";
bool relocate_binary = true;
-
/*
* Miscellaneous global stuff.
*/
*/
static char const *AUTHORS
-= " Han-Wen Nienhuys <hanwen@xs4all.nl>\n"
- " Jan Nieuwenhuizen <janneke@gnu.org>\n";
+ = " Han-Wen Nienhuys <hanwen@xs4all.nl>\n"
+ " Jan Nieuwenhuizen <janneke@gnu.org>\n";
static char const *PROGRAM_NAME = "lilypond";
static char const *PROGRAM_URL = "http://lilypond.org";
static char const *NOTICE
-= _i ("This program is free software. It is covered by the GNU General Public\n"
- "License and you are welcome to change it and/or distribute copies of it\n"
- "under certain conditions. Invoke as `%s --warranty' for more\n"
- "information.\n");
+ = _i ("This program is free software. It is covered by the GNU General Public\n"
+ "License and you are welcome to change it and/or distribute copies of it\n"
+ "under certain conditions. Invoke as `%s --warranty' for more\n"
+ "information.\n");
static char const *WARRANTY
-= _i (" This program is free software; you can redistribute it and/or\n"
- "modify it under the terms of the GNU General Public License as \n"
- "published by the Free Software Foundation, either version 3 of\n"
- "the License, or (at your option) any later version.\n"
- "\n"
- " This program is distributed in the hope that it will be useful,\n"
- "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
- "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
- "General Public License for more details.\n"
- "\n"
- " You should have received a copy of the\n"
- "GNU General Public License along with this program; if not, write to\n"
- "the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n"
- "Boston, MA 02111-1307, USA.\n");
+ = _i (" This program is free software; you can redistribute it and/or\n"
+ "modify it under the terms of the GNU General Public License as \n"
+ "published by the Free Software Foundation, either version 3 of\n"
+ "the License, or (at your option) any later version.\n"
+ "\n"
+ " This program is distributed in the hope that it will be useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
+ "General Public License for more details.\n"
+ "\n"
+ " You should have received a copy of the\n"
+ "GNU General Public License along with this program; if not, write to\n"
+ "the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n"
+ "Boston, MA 02111-1307, USA.\n");
/* Where the init files live. Typically:
LILYPOND_DATADIR = /usr/share/lilypond
* call gettext () explicitly for actual "translation" */
static Long_option_init options_static[]
-= {
- {_i ("SYM[=VAL]"), "define-default", 'd',
- _i ("set Scheme option SYM to VAL (default: #t).\n"
- "Use -dhelp for help.")},
+=
+{
+ {
+ _i ("SYM[=VAL]"), "define-default", 'd',
+ _i ("set Scheme option SYM to VAL (default: #t).\n"
+ "Use -dhelp for help.")
+ },
{_i ("EXPR"), "evaluate", 'e', _i ("evaluate scheme code")},
/* Bug in option parser: --output =foe is taken as an abbreviation
{0, "pdf", 0, _i ("generate PDF (default)")},
{0, "png", 0, _i ("generate PNG")},
{0, "ps", 0, _i ("generate PostScript")},
- {0, "help", 'h', _i ("show this help and exit")},
- {_i ("FIELD"), "header", 'H', _i ("dump header field FIELD to file\n"
- "named BASENAME.FIELD")},
- {_i ("DIR"), "include", 'I', _i ("add DIR to search path")},
- {_i ("FILE"), "init", 'i', _i ("use FILE as init file")},
+ {0, "help", 'h', _i ("show this help and exit")},
+ {
+ _i ("FIELD"), "header", 'H', _i ("dump header field FIELD to file\n"
+ "named BASENAME.FIELD")
+ },
+ {_i ("DIR"), "include", 'I', _i ("add DIR to search path")},
+ {_i ("FILE"), "init", 'i', _i ("use FILE as init file")},
#if HAVE_CHROOT
- {_i ("USER, GROUP, JAIL, DIR"), "jail", 'j', _i ("chroot to JAIL, become USER:GROUP\n"
- "and cd into DIR")},
+ {
+ _i ("USER, GROUP, JAIL, DIR"), "jail", 'j', _i ("chroot to JAIL, become USER:GROUP\n"
+ "and cd into DIR")
+ },
#endif
- {_i ("FILE"), "output", 'o', _i ("write output to FILE (suffix will be added)")},
+ {_i ("FILE"), "output", 'o', _i ("write output to FILE (suffix will be added)")},
{0, "relocate", 0, _i ("relocate using directory of lilypond program")},
- {0, "version", 'v', _i ("show version number and exit")},
+ {0, "version", 'v', _i ("show version number and exit")},
{0, "verbose", 'V', _i ("be verbose")},
- {0, "warranty", 'w', _i ("show warranty and copyright")},
+ {0, "warranty", 'w', _i ("show warranty and copyright")},
{0, 0, 0, 0}
};
char const *LILYPOND_DATADIR = PACKAGE_DATADIR "/" TOPLEVEL_VERSION;
-
/* x86 defaults to using 80-bit extended precision arithmetic. This can cause
problems because the truncation from 80 bits to 64 bits can occur in
unpredictable places. To get around this, we tell the x87 FPU to use only
double precision. Note that this is not needed for x86_64 because that uses
the SSE unit by default instead of the x87 FPU. */
-#if ((defined(__x86__) || defined(__i386__)) \
- && defined(HAVE_FPU_CONTROL_H) && (HAVE_FPU_CONTROL_H == 1))
+#if ((defined (__x86__) || defined (__i386__)) \
+ && defined (HAVE_FPU_CONTROL_H) && (HAVE_FPU_CONTROL_H == 1))
#include <fpu_control.h>
static void
#endif /* defined(__x86__) || defined(__i386__) */
-
static void
env_var_info (FILE *out, char const *key)
{
}
LY_DEFINE (ly_usage, "ly:usage",
- 0, 0, 0, (),
- "Print usage message.")
+ 0, 0, 0, (),
+ "Print usage message.")
{
/* No version number or newline here. It confuses help2man. */
printf ("%s", (_f ("Usage: %s [OPTION]... FILE...", PROGRAM_NAME).c_str ()));
or if there is a LilyPond users list or forum in your language
"Report bugs in English via %s or in YOUR_LANG via URI" */
printf ("%s", (_f ("Report bugs via %s",
- "http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs"
- ).c_str ()));
+ "http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs"
+ ).c_str ()));
printf ("\n");
printf ("\n");
return SCM_UNSPECIFIED;
actual actions. */
enum Jail
- {
- USER_NAME, GROUP_NAME, JAIL, DIR, JAIL_MAX
- };
+ {
+ USER_NAME, GROUP_NAME, JAIL, DIR, JAIL_MAX
+ };
vector<string> components = string_split (jail_spec, ',');
if (components.size () != JAIL_MAX)
{
error (_f ("expected %d arguments with jail, found: %u", JAIL_MAX,
- (unsigned) components.size ()));
+ (unsigned) components.size ()));
exit (2);
}
errno = 0;
int uid;
- if (passwd * passwd = getpwnam (components[USER_NAME].c_str ()))
+ if (passwd *passwd = getpwnam (components[USER_NAME].c_str ()))
uid = passwd->pw_uid;
else
{
if (errno == 0)
- error (_f ("no such user: %s", components[USER_NAME]));
+ error (_f ("no such user: %s", components[USER_NAME]));
else
- error (_f ("cannot get user id from user name: %s: %s",
- components[USER_NAME],
- strerror (errno)));
+ error (_f ("cannot get user id from user name: %s: %s",
+ components[USER_NAME],
+ strerror (errno)));
exit (3);
}
errno = 0;
int gid;
- if (group * group = getgrnam (components[GROUP_NAME].c_str ()))
+ if (group *group = getgrnam (components[GROUP_NAME].c_str ()))
gid = group->gr_gid;
else
{
if (errno == 0)
- error (_f ("no such group: %s", components[GROUP_NAME]));
+ error (_f ("no such group: %s", components[GROUP_NAME]));
else
- error (_f ("cannot get group id from group name: %s: %s",
- components[GROUP_NAME],
- strerror (errno)));
+ error (_f ("cannot get group id from group name: %s: %s",
+ components[GROUP_NAME],
+ strerror (errno)));
exit (3);
}
if (chroot (components[JAIL].c_str ()))
{
error (_f ("cannot chroot to: %s: %s", components[JAIL],
- strerror (errno)));
+ strerror (errno)));
exit (3);
}
if (chdir (components[DIR].c_str ()))
{
error (_f ("cannot change working directory to: %s: %s", components[DIR],
- strerror (errno)));
+ strerror (errno)));
exit (3);
}
}
while (Long_option_init const *opt = (*option_parser) ())
{
switch (opt->shortname_char_)
- {
- case 0:
- if (string (opt->longname_str0_) == "pdf"
- || string (opt->longname_str0_) == "png"
- || string (opt->longname_str0_) == "ps")
- add_output_format (opt->longname_str0_);
- else if (string (opt->longname_str0_) == "relocate")
- relocate_binary = true;
- break;
-
- case 'd':
- {
- string arg (option_parser->optional_argument_str0_);
- ssize eq = arg.find ('=');
-
- string key = arg;
- string val = "#t";
-
- if (eq != NPOS)
- {
- key = arg.substr (0, eq);
- val = arg.substr (eq + 1, arg.length () - 1);
- }
-
- init_scheme_variables_global
- += "(cons \'" + key + " '" + val + ")\n";
- }
- break;
-
- case 'v':
- notice ();
- exit (0);
- break;
- case 'o':
- {
- string s = option_parser->optional_argument_str0_;
- File_name file_name (s);
- output_name_global = file_name.to_string ();
- }
- break;
- case 'j':
- jail_spec = option_parser->optional_argument_str0_;
- break;
-
- case 'e':
- init_scheme_code_global
- += option_parser->optional_argument_str0_ + string (" ");
- break;
- case 'w':
- warranty ();
- exit (0);
- break;
-
- case 'f':
- {
- vector<string> components
- = string_split (option_parser->optional_argument_str0_, ',');
- for (vsize i = 0; i < components.size (); i++)
- add_output_format (components[i]);
- }
- break;
-
- case 'H':
- dump_header_fieldnames_global
- .push_back (option_parser->optional_argument_str0_);
- break;
- case 'I':
- global_path.append (option_parser->optional_argument_str0_);
- break;
- case 'i':
- init_name_global = option_parser->optional_argument_str0_;
- break;
- case 'h':
- show_help = true;
- break;
- case 'V':
- be_verbose_global = true;
- break;
- default:
- programming_error (to_string ("unhandled short option: %c",
- opt->shortname_char_));
- assert (false);
- break;
- }
+ {
+ case 0:
+ if (string (opt->longname_str0_) == "pdf"
+ || string (opt->longname_str0_) == "png"
+ || string (opt->longname_str0_) == "ps")
+ add_output_format (opt->longname_str0_);
+ else if (string (opt->longname_str0_) == "relocate")
+ relocate_binary = true;
+ break;
+
+ case 'd':
+ {
+ string arg (option_parser->optional_argument_str0_);
+ ssize eq = arg.find ('=');
+
+ string key = arg;
+ string val = "#t";
+
+ if (eq != NPOS)
+ {
+ key = arg.substr (0, eq);
+ val = arg.substr (eq + 1, arg.length () - 1);
+ }
+
+ init_scheme_variables_global
+ += "(cons \'" + key + " '" + val + ")\n";
+ }
+ break;
+
+ case 'v':
+ notice ();
+ exit (0);
+ break;
+ case 'o':
+ {
+ string s = option_parser->optional_argument_str0_;
+ File_name file_name (s);
+ output_name_global = file_name.to_string ();
+ }
+ break;
+ case 'j':
+ jail_spec = option_parser->optional_argument_str0_;
+ break;
+
+ case 'e':
+ init_scheme_code_global
+ += option_parser->optional_argument_str0_ + string (" ");
+ break;
+ case 'w':
+ warranty ();
+ exit (0);
+ break;
+
+ case 'f':
+ {
+ vector<string> components
+ = string_split (option_parser->optional_argument_str0_, ',');
+ for (vsize i = 0; i < components.size (); i++)
+ add_output_format (components[i]);
+ }
+ break;
+
+ case 'H':
+ dump_header_fieldnames_global
+ .push_back (option_parser->optional_argument_str0_);
+ break;
+ case 'I':
+ global_path.append (option_parser->optional_argument_str0_);
+ break;
+ case 'i':
+ init_name_global = option_parser->optional_argument_str0_;
+ break;
+ case 'h':
+ show_help = true;
+ break;
+ case 'V':
+ be_verbose_global = true;
+ break;
+ default:
+ programming_error (to_string ("unhandled short option: %c",
+ opt->shortname_char_));
+ assert (false);
+ break;
+ }
}
if (output_format_global == "")
{
ly_usage ();
if (be_verbose_global)
- dir_info (stdout);
+ dir_info (stdout);
exit (0);
}
}
sane_putenv ("GUILE_MIN_YIELD_2", yield, overwrite);
sane_putenv ("GUILE_MIN_YIELD_MALLOC", yield, overwrite);
-
sane_putenv ("GUILE_INIT_SEGMENT_SIZE_1",
- "10485760", overwrite);
+ "10485760", overwrite);
sane_putenv ("GUILE_MAX_SEGMENT_SIZE",
- "104857600", overwrite);
+ "104857600", overwrite);
}
vector<string> start_environment_global;
int
main (int argc, char **argv, char **envp)
{
- configure_fpu();
+ configure_fpu ();
for (char **p = envp; *p; p++)
- start_environment_global.push_back(*p);
+ start_environment_global.push_back (*p);
if (getenv ("LILYPOND_VERBOSE"))
be_verbose_global = true;
Mark_engraver::stop_translation_timestep ()
{
if (text_)
- {
- text_->set_object ("side-support-elements",
- grob_list_to_grob_array (get_property ("stavesFound")));
- final_text_ = text_;
- text_ = 0;
- }
+ {
+ text_->set_object ("side-support-elements",
+ grob_list_to_grob_array (get_property ("stavesFound")));
+ final_text_ = text_;
+ text_ = 0;
+ }
mark_ev_ = 0;
}
{
if (final_text_)
final_text_->set_property ("break-visibility",
- scm_c_make_vector (3, SCM_BOOL_T));
+ scm_c_make_vector (3, SCM_BOOL_T));
final_text_ = 0;
}
create_items (mark_ev_);
/*
- automatic marks.
+ automatic marks.
*/
SCM m = mark_ev_->get_property ("label");
SCM proc = get_property ("markFormatter");
if (!Text_interface::is_markup (m)
- && ly_is_procedure (proc))
- {
- if (!scm_is_number (m))
- m = get_property ("rehearsalMark");
-
- if (scm_integer_p (m) == SCM_BOOL_T
- && scm_exact_p (m) == SCM_BOOL_T)
- {
- int mark_count = scm_to_int (m);
- mark_count++;
- context ()->set_property ("rehearsalMark",
- scm_from_int (mark_count));
- }
-
- if (scm_is_number (m))
- m = scm_call_2 (proc, m, context ()->self_scm ());
- else
- /* FIXME: constant error message. */
- warning (_ ("rehearsalMark must have integer value"));
- }
+ && ly_is_procedure (proc))
+ {
+ if (!scm_is_number (m))
+ m = get_property ("rehearsalMark");
+
+ if (scm_integer_p (m) == SCM_BOOL_T
+ && scm_exact_p (m) == SCM_BOOL_T)
+ {
+ int mark_count = scm_to_int (m);
+ mark_count++;
+ context ()->set_property ("rehearsalMark",
+ scm_from_int (mark_count));
+ }
+
+ if (scm_is_number (m))
+ m = scm_call_2 (proc, m, context ()->self_scm ());
+ else
+ /* FIXME: constant error message. */
+ warning (_ ("rehearsalMark must have integer value"));
+ }
if (Text_interface::is_markup (m))
- text_->set_property ("text", m);
+ text_->set_property ("text", m);
else
- warning (_ ("mark label must be a markup object"));
+ warning (_ ("mark label must be a markup object"));
}
}
ADD_ACKNOWLEDGER (Mark_engraver, break_alignment);
ADD_TRANSLATOR (Mark_engraver,
- /* doc */
- "Create @code{RehearsalMark} objects. It puts them on top of"
- " all staves (which is taken from the property"
- " @code{stavesFound}). If moving this engraver to a different"
- " context, @ref{Staff_collecting_engraver} must move along,"
- " otherwise all marks end up on the same Y@tie{}location.",
-
- /* create */
- "RehearsalMark ",
-
- /* read */
- "markFormatter "
- "rehearsalMark "
- "stavesFound ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create @code{RehearsalMark} objects. It puts them on top of"
+ " all staves (which is taken from the property"
+ " @code{stavesFound}). If moving this engraver to a different"
+ " context, @ref{Staff_collecting_engraver} must move along,"
+ " otherwise all marks end up on the same Y@tie{}location.",
+
+ /* create */
+ "RehearsalMark ",
+
+ /* read */
+ "markFormatter "
+ "rehearsalMark "
+ "stavesFound ",
+
+ /* write */
+ ""
+ );
if (grouping_ && now.main_part_ >= stop_grouping_mom_ && !now.grace_part_)
{
grouping_->set_bound (RIGHT,
- unsmob_grob (get_property ("currentMusicalColumn")));
+ unsmob_grob (get_property ("currentMusicalColumn")));
grouping_ = 0;
}
Rational where (0);
for (SCM s = grouping; scm_is_pair (s);
- where += Rational ((int) scm_to_int (scm_car (s))) * base_moment,
- s = scm_cdr (s))
- {
- int grouplen = scm_to_int (scm_car (s));
- if (where == mp)
- {
- if (grouping_)
- {
- programming_error ("last grouping not finished yet");
- continue;
- }
+ where += Rational ((int) scm_to_int (scm_car (s))) * base_moment,
+ s = scm_cdr (s))
+ {
+ int grouplen = scm_to_int (scm_car (s));
+ if (where == mp)
+ {
+ if (grouping_)
+ {
+ programming_error ("last grouping not finished yet");
+ continue;
+ }
if (grouplen > 1)
- {
- grouping_ = make_spanner ("MeasureGrouping", SCM_EOL);
- grouping_->set_bound (LEFT, unsmob_grob (get_property ("currentMusicalColumn")));
-
- stop_grouping_mom_ = now.main_part_ + Rational (grouplen - 1) * base_moment;
- get_global_context ()->add_moment_to_process (Moment (stop_grouping_mom_));
-
- if (grouplen == 3)
- grouping_->set_property ("style", ly_symbol2scm ("triangle"));
- else
- grouping_->set_property ("style", ly_symbol2scm ("bracket"));
-
- break;
- }
- }
- }
+ {
+ grouping_ = make_spanner ("MeasureGrouping", SCM_EOL);
+ grouping_->set_bound (LEFT, unsmob_grob (get_property ("currentMusicalColumn")));
+
+ stop_grouping_mom_ = now.main_part_ + Rational (grouplen - 1) * base_moment;
+ get_global_context ()->add_moment_to_process (Moment (stop_grouping_mom_));
+
+ if (grouplen == 3)
+ grouping_->set_property ("style", ly_symbol2scm ("triangle"));
+ else
+ grouping_->set_property ("style", ly_symbol2scm ("bracket"));
+
+ break;
+ }
+ }
+ }
}
}
ADD_ACKNOWLEDGER (Measure_grouping_engraver, note_column);
ADD_TRANSLATOR (Measure_grouping_engraver,
- /* doc */
- "Create @code{MeasureGrouping} to indicate beat subdivision.",
+ /* doc */
+ "Create @code{MeasureGrouping} to indicate beat subdivision.",
- /* create */
- "MeasureGrouping ",
+ /* create */
+ "MeasureGrouping ",
- /* read */
+ /* read */
"baseMoment "
- "beatStructure "
- "currentMusicalColumn "
- "measurePosition ",
+ "beatStructure "
+ "currentMusicalColumn "
+ "measurePosition ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Real t = Staff_symbol_referencer::line_thickness (me) * robust_scm2double (me->get_property ("thickness"), 1);
Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT),
- X_AXIS);
+ X_AXIS);
Real right_point = robust_relative_extent (me->get_bound (RIGHT),
- common, X_AXIS).linear_combination (CENTER);
+ common, X_AXIS).linear_combination (CENTER);
Real left_point = me->get_bound (LEFT)->relative_coordinate (common, X_AXIS);
Interval iv (left_point, right_point);
}
ADD_INTERFACE (Measure_grouping,
- "This object indicates groups of beats. Valid choices for"
- " @code{style} are @code{bracket} and @code{triangle}.",
-
- /* properties */
- "thickness "
- "style "
- "height "
- );
+ "This object indicates groups of beats. Valid choices for"
+ " @code{style} are @code{bracket} and @code{triangle}.",
+
+ /* properties */
+ "thickness "
+ "style "
+ "height "
+ );
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "engraver.hh"
#include "item.hh"
class Melody_engraver : public Engraver
{
Grob *melody_item_;
- Grob *stem_;
+ Grob *stem_;
protected:
-
+
DECLARE_ACKNOWLEDGER (stem);
DECLARE_ACKNOWLEDGER (slur);
TRANSLATOR_DECLARATIONS (Melody_engraver);
void process_music ();
};
-
Melody_engraver::Melody_engraver ()
{
stem_ = 0;
if (scm_is_string (get_property ("whichBar")))
melody_item_ = 0;
}
-
+
void
Melody_engraver::stop_translation_timestep ()
{
{
extract_grob_set (stem_, "rests", rests);
if (rests.size ())
- melody_item_ = 0;
+ melody_item_ = 0;
else
- {
- if (!melody_item_)
- melody_item_ = make_item ("MelodyItem", stem_->self_scm ());
+ {
+ if (!melody_item_)
+ melody_item_ = make_item ("MelodyItem", stem_->self_scm ());
- Melody_spanner::add_stem (melody_item_, stem_);
- }
+ Melody_spanner::add_stem (melody_item_, stem_);
+ }
}
stem_ = 0;
}
-
void
Melody_engraver::acknowledge_slur (Grob_info /* info */)
{
melody_item_ = 0;
}
-
void
Melody_engraver::acknowledge_stem (Grob_info info)
{
stem_ = info.grob ();
}
-
-
#include "translator.icc"
ADD_ACKNOWLEDGER (Melody_engraver, stem);
ADD_ACKNOWLEDGER (Melody_engraver, slur);
ADD_TRANSLATOR (Melody_engraver,
- /* doc */
- "Create information for context dependent typesetting"
- " decisions.",
+ /* doc */
+ "Create information for context dependent typesetting"
+ " decisions.",
+
+ /* create */
+ "MelodyItem ",
- /* create */
- "MelodyItem ",
+ /* read */
+ "",
- /* read */
- "",
+ /* write */
+ ""
+ );
- /* write */
- ""
- );
-
let's take item for now.
*/
-
/*
Interpolate stem directions for neutral stems.
*/
Melody_spanner::calc_neutral_stem_direction (SCM smob)
{
Grob *stem = unsmob_grob (smob);
- Grob *me = unsmob_grob (stem->get_object ("melody-spanner"));
+ Grob *me = unsmob_grob (stem->get_object ("melody-spanner"));
if (!me || !me->is_live ())
return scm_from_int (DOWN);
-
+
extract_grob_set (me, "stems", stems);
vector<Direction> dirs;
vsize last_nonneutral = VPOS;
vsize next_nonneutral = 0;
while (next_nonneutral != VPOS && next_nonneutral < dirs.size ()
- && !dirs[next_nonneutral])
+ && !dirs[next_nonneutral])
next_nonneutral++;
SCM retval = SCM_EOL;
- while (last_nonneutral == VPOS || last_nonneutral + 1 < dirs.size ())
+ while (last_nonneutral == VPOS || last_nonneutral + 1 < dirs.size ())
{
Direction d1 = CENTER;
Direction d2 = CENTER;
if (last_nonneutral != VPOS)
- d1 = dirs[last_nonneutral];
+ d1 = dirs[last_nonneutral];
if (next_nonneutral < dirs.size ())
- d2 = dirs[next_nonneutral];
+ d2 = dirs[next_nonneutral];
Direction total = CENTER;
if (d1 && d1 == d2)
- total = d1;
+ total = d1;
else if (d1 && !d2)
- total = d1;
+ total = d1;
else if (d2 && !d1)
- total = d2;
+ total = d2;
else
- total = to_dir (me->get_property ("neutral-direction"));
-
- for (vsize i = last_nonneutral + 1; i < next_nonneutral; i++)
- {
- if (stems[i] == stem)
- retval = scm_from_int (total);
- else
- stems[i]->set_property ("neutral-direction", scm_from_int (total));
- }
+ total = to_dir (me->get_property ("neutral-direction"));
+
+ for (vsize i = last_nonneutral + 1; i < next_nonneutral; i++)
+ {
+ if (stems[i] == stem)
+ retval = scm_from_int (total);
+ else
+ stems[i]->set_property ("neutral-direction", scm_from_int (total));
+ }
last_nonneutral = next_nonneutral;
while (last_nonneutral < dirs.size ()
- && dirs[last_nonneutral])
- last_nonneutral++;
+ && dirs[last_nonneutral])
+ last_nonneutral++;
next_nonneutral = last_nonneutral;
last_nonneutral--;
while (next_nonneutral < dirs.size ()
- && !dirs[next_nonneutral])
- next_nonneutral++;
+ && !dirs[next_nonneutral])
+ next_nonneutral++;
}
return retval;
}
ADD_INTERFACE (Melody_spanner,
- "Context dependent typesetting decisions.",
+ "Context dependent typesetting decisions.",
- /* properties */
- "stems "
- "neutral-direction "
- );
+ /* properties */
+ "stems "
+ "neutral-direction "
+ );
-
Mensural_ligature_engraver::Mensural_ligature_engraver ()
{
- brew_ligature_primitive_proc =
- Mensural_ligature::brew_ligature_primitive_proc;
+ brew_ligature_primitive_proc
+ = Mensural_ligature::brew_ligature_primitive_proc;
}
Spanner *
Stream_event *nr = info.event_cause ();
/*
- ugh. why not simply check for pitch?
+ ugh. why not simply check for pitch?
*/
if (!nr->in_event_class ("note-event"))
- {
- nr->origin ()->warning
- (_ ("cannot determine pitch of ligature primitive -> skipping"));
- at_beginning = true;
- continue;
- }
+ {
+ nr->origin ()->warning
+ (_ ("cannot determine pitch of ligature primitive -> skipping"));
+ at_beginning = true;
+ continue;
+ }
int pitch = unsmob_pitch (nr->get_property ("pitch"))->steps ();
int prim = 0;
if (at_beginning)
- {
- if (i == s - 1)
- {
- // we can get here after invalid input
- nr->origin ()->warning
- (_ ("single note ligature - skipping"));
- break;
- }
- prev_semibrevis = prev_brevis_shape = false;
- prev_primitive = NULL;
- }
+ {
+ if (i == s - 1)
+ {
+ // we can get here after invalid input
+ nr->origin ()->warning
+ (_ ("single note ligature - skipping"));
+ break;
+ }
+ prev_semibrevis = prev_brevis_shape = false;
+ prev_primitive = NULL;
+ }
else
- {
- if (pitch == prev_pitch)
- {
- nr->origin ()->warning
- (_ ("prime interval within ligature -> skipping"));
- at_beginning = true;
+ {
+ if (pitch == prev_pitch)
+ {
+ nr->origin ()->warning
+ (_ ("prime interval within ligature -> skipping"));
+ at_beginning = true;
prim = MLP_NONE;
- continue;
- }
- }
+ continue;
+ }
+ }
if (duration_log < -3 // is this possible at all???
- || duration_log > 0)
- {
- nr->origin ()->warning
- (_ ("mensural ligature: duration none of Mx, L, B, S -> skipping"));
+ || duration_log > 0)
+ {
+ nr->origin ()->warning
+ (_ ("mensural ligature: duration none of Mx, L, B, S -> skipping"));
prim = MLP_NONE;
- at_beginning = true;
- continue;
- }
+ at_beginning = true;
+ continue;
+ }
bool general_case = true;
bool make_flexa = false;
// first check special cases
// 1. beginning
if (at_beginning)
- {
- // a. semibreves
- if (duration_log == 0)
- {
+ {
+ // a. semibreves
+ if (duration_log == 0)
+ {
prim = MLP_UP | MLP_BREVIS;
- general_case = false;
- }
- // b. descendens longa or brevis
- else if (i < s - 1
- && (unsmob_pitch (primitives[i + 1].event_cause ()
- ->get_property ("pitch"))->steps () < pitch)
- && duration_log > -3)
- {
- int left_stem = duration_log == -1 ? MLP_DOWN : 0;
+ general_case = false;
+ }
+ // b. descendens longa or brevis
+ else if (i < s - 1
+ && (unsmob_pitch (primitives[i + 1].event_cause ()
+ ->get_property ("pitch"))->steps () < pitch)
+ && duration_log > -3)
+ {
+ int left_stem = duration_log == -1 ? MLP_DOWN : 0;
prim = left_stem | MLP_BREVIS;
- general_case = false;
- }
- }
+ general_case = false;
+ }
+ }
// 2. initial semibrevis must be followed by another one
else if (prev_semibrevis)
- {
- prev_semibrevis = false;
- if (duration_log == 0)
- {
- prim = MLP_BREVIS;
- general_case = false;
- }
- else
- {
- nr->origin ()->warning
- (_ ("semibrevis must be followed by another one -> skipping"));
+ {
+ prev_semibrevis = false;
+ if (duration_log == 0)
+ {
+ prim = MLP_BREVIS;
+ general_case = false;
+ }
+ else
+ {
+ nr->origin ()->warning
+ (_ ("semibrevis must be followed by another one -> skipping"));
prim = MLP_NONE;
- at_beginning = true;
- continue;
- }
- }
+ at_beginning = true;
+ continue;
+ }
+ }
// 3. semibreves are otherwise not allowed
else if (duration_log == 0)
- {
- nr->origin ()->warning
- (_ ("semibreves can only appear at the beginning of a ligature,\n"
- "and there may be only zero or two of them"));
+ {
+ nr->origin ()->warning
+ (_ ("semibreves can only appear at the beginning of a ligature,\n"
+ "and there may be only zero or two of them"));
prim = MLP_NONE;
- at_beginning = true;
- continue;
- }
+ at_beginning = true;
+ continue;
+ }
// 4. end, descendens
else if (i == s - 1 && pitch < prev_pitch)
- {
- // brevis; previous note must be turned into flexa
- if (duration_log == -1)
- {
- if (prev_brevis_shape)
- {
+ {
+ // brevis; previous note must be turned into flexa
+ if (duration_log == -1)
+ {
+ if (prev_brevis_shape)
+ {
make_flexa = true;
general_case = false;
- }
- else
- {
- nr->origin ()->warning
- (_ ("invalid ligatura ending:\n"
- "when the last note is a descending brevis,\n"
- "the penultimate note must be another one,\n"
- "or the ligatura must be LB or SSB"));
- prim = MLP_NONE;
- break;
- }
- }
- // longa
- else if (duration_log == -2)
- {
- prim = MLP_BREVIS;
- general_case = allow_flexa = false;
- }
- // else maxima; fall through to regular case below
- }
+ }
+ else
+ {
+ nr->origin ()->warning
+ (_ ("invalid ligatura ending:\n"
+ "when the last note is a descending brevis,\n"
+ "the penultimate note must be another one,\n"
+ "or the ligatura must be LB or SSB"));
+ prim = MLP_NONE;
+ break;
+ }
+ }
+ // longa
+ else if (duration_log == -2)
+ {
+ prim = MLP_BREVIS;
+ general_case = allow_flexa = false;
+ }
+ // else maxima; fall through to regular case below
+ }
if (allow_flexa
&& to_boolean (primitive->get_property ("ligature-flexa")))
breve: check whether descending
*/
int const next_pitch = unsmob_pitch
- (next_info.event_cause ()->get_property ("pitch"))->steps ();
+ (next_info.event_cause ()->get_property ("pitch"))->steps ();
if (next_pitch < pitch)
- /*
- sorry, forbidden
- */
- make_flexa = false;
+ /*
+ sorry, forbidden
+ */
+ make_flexa = false;
}
}
}
if (general_case)
- {
+ {
static int const shape[3] = {MLP_MAXIMA, MLP_LONGA, MLP_BREVIS};
prim = shape[duration_log + 3];
- }
+ }
if (make_flexa)
{
turn the note with the previous one into a flexa
*/
prev_primitive->set_property
- ("primitive",
- scm_from_int
- (MLP_FLEXA_BEGIN
- | (scm_to_int (prev_primitive->get_property ("primitive"))
- & MLP_STEM)));
+ ("primitive",
+ scm_from_int
+ (MLP_FLEXA_BEGIN
+ | (scm_to_int (prev_primitive->get_property ("primitive"))
+ & MLP_STEM)));
prev_primitive->set_property
- ("flexa-interval", scm_from_int (pitch - prev_pitch));
+ ("flexa-interval", scm_from_int (pitch - prev_pitch));
prim = MLP_FLEXA_END;
primitive->set_property
- ("flexa-interval", scm_from_int (pitch - prev_pitch));
+ ("flexa-interval", scm_from_int (pitch - prev_pitch));
}
// join_primitives replacement
if (!(at_beginning || make_flexa))
- prev_primitive->set_property ("add-join", ly_bool2scm (true));
+ prev_primitive->set_property ("add-join", ly_bool2scm (true));
at_beginning = false;
prev_primitive = primitive;
*/
void
Mensural_ligature_engraver::propagate_properties (Spanner *ligature,
- vector<Grob_info> primitives)
+ vector<Grob_info> primitives)
{
Real thickness
= robust_scm2double (ligature->get_property ("thickness"), 1.4);
thickness
- *= ligature->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
+ *= ligature->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
Real head_width
= Font_interface::get_default_font (ligature)->
- find_by_name ("noteheads.sM1mensural").extent (X_AXIS).length ();
+ find_by_name ("noteheads.sM1mensural").extent (X_AXIS).length ();
Real maxima_head_width
= Font_interface::get_default_font (ligature)->
- find_by_name ("noteheads.sM3ligmensural").extent (X_AXIS).length ();
+ find_by_name ("noteheads.sM3ligmensural").extent (X_AXIS).length ();
Item *prev_primitive = NULL;
for (vsize i = 0; i < primitives.size (); i++)
Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
int output = scm_to_int (primitive->get_property ("primitive"));
primitive->set_property ("thickness",
- scm_from_double (thickness));
-
- switch (output & MLP_ANY) {
- case MLP_BREVIS:
- case MLP_LONGA:
- primitive->set_property ("head-width", scm_from_double (head_width));
- break;
- case MLP_MAXIMA:
- primitive->set_property ("head-width",
- scm_from_double (maxima_head_width));
- break;
- case MLP_FLEXA_BEGIN:
- /*
- the next note (should be MLP_FLEXA_END) will handle this one
- */
- break;
- case MLP_FLEXA_END:
+ scm_from_double (thickness));
+
+ switch (output & MLP_ANY)
{
- SCM flexa_scm = primitive->get_property ("flexa-width");
- Real const flexa_width = robust_scm2double (flexa_scm, 2.0);
- SCM head_width = scm_from_double (0.5 * (flexa_width + thickness));
- primitive->set_property ("head-width", head_width);
- prev_primitive->set_property ("head-width", head_width);
- prev_primitive->set_property ("flexa-width", flexa_scm);
+ case MLP_BREVIS:
+ case MLP_LONGA:
+ primitive->set_property ("head-width", scm_from_double (head_width));
+ break;
+ case MLP_MAXIMA:
+ primitive->set_property ("head-width",
+ scm_from_double (maxima_head_width));
+ break;
+ case MLP_FLEXA_BEGIN:
+ /*
+ the next note (should be MLP_FLEXA_END) will handle this one
+ */
+ break;
+ case MLP_FLEXA_END:
+ {
+ SCM flexa_scm = primitive->get_property ("flexa-width");
+ Real const flexa_width = robust_scm2double (flexa_scm, 2.0);
+ SCM head_width = scm_from_double (0.5 * (flexa_width + thickness));
+ primitive->set_property ("head-width", head_width);
+ prev_primitive->set_property ("head-width", head_width);
+ prev_primitive->set_property ("flexa-width", flexa_scm);
+ }
+ break;
+ default:
+ programming_error (_ ("unexpected case fall-through"));
+ break;
}
- break;
- default:
- programming_error (_ ("unexpected case fall-through"));
- break;
- }
prev_primitive = primitive;
}
{
Item *current = dynamic_cast<Item *> (primitives[i].grob ());
if (i == 0)
- {
- first = current;
- staff_space = Staff_symbol_referencer::staff_space (first);
- thickness = scm_to_double (current->get_property ("thickness"));
- }
+ {
+ first = current;
+ staff_space = Staff_symbol_referencer::staff_space (first);
+ thickness = scm_to_double (current->get_property ("thickness"));
+ }
move_related_items_to_column (current, first->get_column (),
- distance);
+ distance);
Real head_width = scm_to_double (current->get_property ("head-width"));
distance += head_width - thickness;
if (Rhythmic_head::dot_count (current) > 0)
- /*
- Move dots above/behind the ligature.
- dots should also avoid staff lines.
- */
- {
- Grob *dot_gr = Rhythmic_head::get_dots (current);
-
- bool const on_line = Staff_symbol_referencer::on_line
- (current,
- robust_scm2int (current->get_property ("staff-position"), 0));
- Real vert_shift = on_line ? staff_space * 0.5 : 0.0;
- bool const flexa_begin =
- scm_to_int (current->get_property ("primitive"))
- & MLP_FLEXA_BEGIN;
-
- if (i + 1 < primitives.size ())
- /*
- dot in the midst => avoid next note;
- what to avoid and where depends on
- being on a line or between lines
- */
- {
- int const delta =
- scm_to_int (current->get_property ("delta-position"));
- if (flexa_begin)
- vert_shift += delta < 0
- ? staff_space : (on_line ? -2.0 : -1.0) * staff_space;
- else if (on_line)
- {
- if (0 < delta && delta < 3)
- vert_shift -= staff_space;
- }
- else if (delta == 1 || delta == -1)
- vert_shift -= delta * staff_space;
- }
-
- dot_gr->translate_axis (vert_shift, Y_AXIS);
-
- /*
- move all dots behind head
- */
- dot_gr->translate_axis
- ((flexa_begin ? staff_space * 0.6 : head_width) - 2.0*thickness, X_AXIS);
- }
+ /*
+ Move dots above/behind the ligature.
+ dots should also avoid staff lines.
+ */
+ {
+ Grob *dot_gr = Rhythmic_head::get_dots (current);
+
+ bool const on_line = Staff_symbol_referencer::on_line
+ (current,
+ robust_scm2int (current->get_property ("staff-position"), 0));
+ Real vert_shift = on_line ? staff_space * 0.5 : 0.0;
+ bool const flexa_begin
+ = scm_to_int (current->get_property ("primitive"))
+ & MLP_FLEXA_BEGIN;
+
+ if (i + 1 < primitives.size ())
+ /*
+ dot in the midst => avoid next note;
+ what to avoid and where depends on
+ being on a line or between lines
+ */
+ {
+ int const delta
+ = scm_to_int (current->get_property ("delta-position"));
+ if (flexa_begin)
+ vert_shift += delta < 0
+ ? staff_space : (on_line ? -2.0 : -1.0) * staff_space;
+ else if (on_line)
+ {
+ if (0 < delta && delta < 3)
+ vert_shift -= staff_space;
+ }
+ else if (delta == 1 || delta == -1)
+ vert_shift -= delta * staff_space;
+ }
+
+ dot_gr->translate_axis (vert_shift, Y_AXIS);
+
+ /*
+ move all dots behind head
+ */
+ dot_gr->translate_axis
+ ((flexa_begin ? staff_space * 0.6 : head_width) - 2.0 * thickness, X_AXIS);
+ }
}
}
void
Mensural_ligature_engraver::build_ligature (Spanner *ligature,
- vector<Grob_info> primitives)
+ vector<Grob_info> primitives)
{
transform_heads (primitives);
propagate_properties (ligature, primitives);
ADD_ACKNOWLEDGER (Mensural_ligature_engraver, ligature_head);
ADD_TRANSLATOR (Mensural_ligature_engraver,
- /* doc */
- "Handle @code{Mensural_ligature_events} by glueing special"
- " ligature heads together.",
+ /* doc */
+ "Handle @code{Mensural_ligature_events} by glueing special"
+ " ligature heads together.",
- /* create */
- "MensuralLigature ",
+ /* create */
+ "MensuralLigature ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
*/
Stencil
brew_flexa (Grob *me,
- bool solid,
- Real width,
- Real thickness,
- bool begin)
+ bool solid,
+ Real width,
+ Real thickness,
+ bool begin)
{
Real staff_space = Staff_symbol_referencer::staff_space (me);
Real height = staff_space - horizontal_line_thickness;
Stencil stencil;
- Real const interval =
- robust_scm2double (me->get_property ("flexa-interval"), 0.0);
+ Real const interval
+ = robust_scm2double (me->get_property ("flexa-interval"), 0.0);
Real slope = (interval / 2.0 * staff_space) / width;
// Compensate optical illusion regarding vertical position of left
{
stencil = Lookup::beam (corrected_slope, thickness, height, 0.0);
if (!begin)
- {
- stencil.translate_axis (width*0.5 - thickness, X_AXIS);
- stencil.translate_axis (corrected_slope * (width*0.5 - thickness),
+ {
+ stencil.translate_axis (width * 0.5 - thickness, X_AXIS);
+ stencil.translate_axis (corrected_slope * (width * 0.5 - thickness),
Y_AXIS);
}
- Stencil bottom_edge =
- Lookup::beam (corrected_slope, width * 0.5, horizontal_line_thickness,
- 0.0);
- bottom_edge.translate_axis (-0.5*height, Y_AXIS);
+ Stencil bottom_edge
+ = Lookup::beam (corrected_slope, width * 0.5, horizontal_line_thickness,
+ 0.0);
+ bottom_edge.translate_axis (-0.5 * height, Y_AXIS);
stencil.add_stencil (bottom_edge);
- Stencil top_edge =
- Lookup::beam (corrected_slope, width * 0.5, horizontal_line_thickness,
- 0.0);
- top_edge.translate_axis (+0.5*height, Y_AXIS);
+ Stencil top_edge
+ = Lookup::beam (corrected_slope, width * 0.5, horizontal_line_thickness,
+ 0.0);
+ top_edge.translate_axis (+0.5 * height, Y_AXIS);
stencil.add_stencil (top_edge);
}
if (primitive_scm == SCM_EOL)
{
programming_error ("Mensural_ligature:"
- " undefined primitive -> ignoring grob");
+ " undefined primitive -> ignoring grob");
return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
}
int primitive = scm_to_int (primitive_scm);
Real flexa_width = 0.0;
Real staff_space = Staff_symbol_referencer::staff_space (me);
- bool const color =
- me->get_property ("style") == ly_symbol2scm ("blackpetrucci");
- bool const semi =
- me->get_property ("style") == ly_symbol2scm ("semipetrucci");
+ bool const color
+ = me->get_property ("style") == ly_symbol2scm ("blackpetrucci");
+ bool const semi
+ = me->get_property ("style") == ly_symbol2scm ("semipetrucci");
if (primitive & MLP_ANY)
{
}
if (primitive & MLP_FLEXA)
flexa_width = robust_scm2double (me->get_property ("flexa-width"), 2.0)
- * staff_space;
+ * staff_space;
int const note_shape = primitive & MLP_ANY;
return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
case MLP_LONGA: // mensural brevis head with right cauda
out = Font_interface::get_default_font (me)->find_by_name
- (color ? "noteheads.sM2blackmensural" :
- semi ? "noteheads.sM2semimensural" : "noteheads.sM2mensural");
+ (color ? "noteheads.sM2blackmensural"
+ : semi ? "noteheads.sM2semimensural" : "noteheads.sM2mensural");
break;
case MLP_BREVIS: // mensural brevis head
out = Font_interface::get_default_font (me)->find_by_name
- (color ? "noteheads.sM1blackmensural" :
- semi ? "noteheads.sM1semimensural" : "noteheads.sM1mensural");
+ (color ? "noteheads.sM1blackmensural"
+ : semi ? "noteheads.sM1semimensural" : "noteheads.sM1mensural");
break;
case MLP_MAXIMA: // should be mensural maxima head without stem
out = Font_interface::get_default_font (me)->find_by_name
- (color ? "noteheads.sM3blackligmensural" :
- semi ? "noteheads.sM3semiligmensural" : "noteheads.sM3ligmensural");
+ (color ? "noteheads.sM3blackligmensural"
+ : semi ? "noteheads.sM3semiligmensural" : "noteheads.sM3ligmensural");
break;
case MLP_FLEXA_BEGIN:
case MLP_FLEXA_END:
out = brew_flexa (me, color, flexa_width, thickness,
- note_shape == MLP_FLEXA_BEGIN);
+ note_shape == MLP_FLEXA_BEGIN);
break;
default:
programming_error (_ ("Mensural_ligature:"
- " unexpected case fall-through"));
+ " unexpected case fall-through"));
return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
}
Real y_bottom = 0.0, y_top = 3.0 * staff_space;
if (primitive & MLP_DOWN)
- {
- y_bottom = -y_top;
- y_top = 0.0;
- }
+ {
+ y_bottom = -y_top;
+ y_top = 0.0;
+ }
Interval x_extent (0, thickness);
Interval y_extent (y_bottom, y_top);
{
int join_right = scm_to_int (me->get_property ("delta-position"));
if (join_right)
- {
- Real y_top = join_right * 0.5 * staff_space;
- Real y_bottom = 0.0;
-
- if (y_top < 0.0)
- {
- y_bottom = y_top;
- y_top = 0.0;
-
- /*
- if the previous note is longa-shaped,
- the joining line may hide the stem, so made it longer
- to serve as stem as well
- */
- if (primitive & MLP_LONGA)
- /*
- instead of 3.0 the length of a longa stem should be used
- Font_interface::get_default_font (???)->find_by_name
- ("noteheads.s-2mensural").extent (Y_AXIS).length () * 0.5
- */
- y_bottom -= 3.0 * staff_space;
- }
-
- Interval x_extent (width - thickness, width);
- Interval y_extent (y_bottom, y_top);
- Box join_box (x_extent, y_extent);
- Stencil join = Lookup::round_filled_box (join_box, blotdiameter);
-
- out.add_stencil (join);
- }
+ {
+ Real y_top = join_right * 0.5 * staff_space;
+ Real y_bottom = 0.0;
+
+ if (y_top < 0.0)
+ {
+ y_bottom = y_top;
+ y_top = 0.0;
+
+ /*
+ if the previous note is longa-shaped,
+ the joining line may hide the stem, so made it longer
+ to serve as stem as well
+ */
+ if (primitive & MLP_LONGA)
+ /*
+ instead of 3.0 the length of a longa stem should be used
+ Font_interface::get_default_font (???)->find_by_name
+ ("noteheads.s-2mensural").extent (Y_AXIS).length () * 0.5
+ */
+ y_bottom -= 3.0 * staff_space;
+ }
+
+ Interval x_extent (width - thickness, width);
+ Interval y_extent (y_bottom, y_top);
+ Box join_box (x_extent, y_extent);
+ Stencil join = Lookup::round_filled_box (join_box, blotdiameter);
+
+ out.add_stencil (join);
+ }
else
- programming_error (_ ("Mensural_ligature: (join_right == 0)"));
+ programming_error (_ ("Mensural_ligature: (join_right == 0)"));
}
#if 0 /* what happend with the ledger lines? */
}
ADD_INTERFACE (Mensural_ligature,
- "A mensural ligature.",
-
- /* properties */
- "delta-position "
- "ligature-flexa "
- "head-width "
- "add-join "
- "flexa-interval "
- "primitive "
- "thickness "
- );
+ "A mensural ligature.",
+
+ /* properties */
+ "delta-position "
+ "ligature-flexa "
+ "head-width "
+ "add-join "
+ "flexa-interval "
+ "primitive "
+ "thickness "
+ );
safe_is_member (SCM scm, SCM lst)
{
return scm_list_p (lst) == SCM_BOOL_T
- && scm_member (scm, lst) != SCM_BOOL_F;
+ && scm_member (scm, lst) != SCM_BOOL_F;
}
void
== ly_symbol2scm ("staff-bar"))
bar_ = g;
else if (text_
- && !support_
- && safe_is_member (g->get_property ("break-align-symbol"),
- text_->get_property ("break-align-symbols"))
- && Item::break_visible (g))
+ && !support_
+ && safe_is_member (g->get_property ("break-align-symbol"),
+ text_->get_property ("break-align-symbols"))
+ && Item::break_visible (g))
{
support_ = g;
text_->set_parent (g, X_AXIS);
if (text_)
for (SCM s = text_->get_property ("non-break-align-symbols");
- scm_is_pair (s);
- s = scm_cdr (s))
+ scm_is_pair (s);
+ s = scm_cdr (s))
if (g->internal_has_interface (scm_car (s)))
- text_->set_parent (g, X_AXIS);
+ text_->set_parent (g, X_AXIS);
}
void
if (text_)
{
if (text_->get_parent (X_AXIS)
- && text_->get_parent (X_AXIS)->internal_has_interface (ly_symbol2scm ("multi-measure-rest-interface"))
- && bar_)
- text_->set_parent (bar_, X_AXIS);
+ && text_->get_parent (X_AXIS)->internal_has_interface (ly_symbol2scm ("multi-measure-rest-interface"))
+ && bar_)
+ text_->set_parent (bar_, X_AXIS);
else if (!support_)
- {
- /*
- Gardner Read "Music Notation", p.278
-
- Align the metronome mark over the time signature (or the
- first notational element of the measure if no time
- signature is present in that measure).
- */
- if (Grob *mc = unsmob_grob (get_property ("currentMusicalColumn")))
- text_->set_parent (mc, X_AXIS);
- else if (Grob *cc = unsmob_grob (get_property ("currentCommandColumn")))
- text_->set_parent (cc, X_AXIS);
- }
+ {
+ /*
+ Gardner Read "Music Notation", p.278
+
+ Align the metronome mark over the time signature (or the
+ first notational element of the measure if no time
+ signature is present in that measure).
+ */
+ if (Grob *mc = unsmob_grob (get_property ("currentMusicalColumn")))
+ text_->set_parent (mc, X_AXIS);
+ else if (Grob *cc = unsmob_grob (get_property ("currentCommandColumn")))
+ text_->set_parent (cc, X_AXIS);
+ }
text_->set_object ("side-support-elements",
- grob_list_to_grob_array (get_property ("stavesFound")));
+ grob_list_to_grob_array (get_property ("stavesFound")));
text_ = 0;
support_ = 0;
bar_ = 0;
SCM proc = get_property ("metronomeMarkFormatter");
SCM result = scm_call_2 (proc,
- tempo_ev_->self_scm (),
- context ()->self_scm ());
+ tempo_ev_->self_scm (),
+ context ()->self_scm ());
text_->set_property ("text", result);
}
ADD_ACKNOWLEDGER (Metronome_mark_engraver, grob);
ADD_TRANSLATOR (Metronome_mark_engraver,
- /* doc */
- "Engrave metronome marking. This delegates the formatting"
- " work to the function in the @code{metronomeMarkFormatter}"
- " property. The mark is put over all staves. The staves are"
- " taken from the @code{stavesFound} property, which is"
- " maintained by @ref{Staff_collecting_engraver}.",
-
- /* create */
- "MetronomeMark ",
-
- /* read */
- "currentCommandColumn "
- "currentMusicalColumn "
- "metronomeMarkFormatter "
- "stavesFound "
- "tempoHideNote ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Engrave metronome marking. This delegates the formatting"
+ " work to the function in the @code{metronomeMarkFormatter}"
+ " property. The mark is put over all staves. The staves are"
+ " taken from the @code{stavesFound} property, which is"
+ " maintained by @ref{Staff_collecting_engraver}.",
+
+ /* create */
+ "MetronomeMark ",
+
+ /* read */
+ "currentCommandColumn "
+ "currentMusicalColumn "
+ "metronomeMarkFormatter "
+ "stavesFound "
+ "tempoHideNote ",
+
+ /* write */
+ ""
+ );
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2007--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "string-convert.hh"
Midi_track::Midi_track (int number, bool port)
- : number_ (number)
+ : number_ (number)
{
// 4D 54 72 6B MTrk
// 00 00 00 3B chunk length (59)
// mi = 1: minor key
char const *data_str0 = ""
- // "00" "ff58" "0404" "0218" "08"
- // "00" "ff51" "0307" "a120"
- // why a key at all, in midi?
- // key: C
- // "00" "ff59" "02" "00" "00"
- // key: F (scsii-menuetto)
- // "00" "ff59" "02" "ff" "00"
- ;
+ // "00" "ff58" "0404" "0218" "08"
+ // "00" "ff51" "0307" "a120"
+ // why a key at all, in midi?
+ // key: C
+ // "00" "ff59" "02" "00" "00"
+ // key: F (scsii-menuetto)
+ // "00" "ff59" "02" "ff" "00"
+ ;
string data_string;
// only for format 0 (currently using format 1)?
if (port)
{
string port = "00" "ff" "21" "01"
- + String_convert::int2hex (number_, 2, '0');
+ + String_convert::int2hex (number_, 2, '0');
data_string += String_convert::hex2bin (port);
}
{
string str = Midi_chunk::data_string ();
- for (vector<Midi_event*>::const_iterator i (events_.begin ());
- i != events_.end (); i ++)
+ for (vector<Midi_event *>::const_iterator i (events_.begin ());
+ i != events_.end (); i++)
{
str += (*i)->to_string ();
}
return str;
}
-
Midi_track::~Midi_track ()
{
- junk_pointers (events_);
+ junk_pointers (events_);
}
/****************************************************************
}
/****************************************************************
header
-*/
+*/
Midi_header::Midi_header (int format, int tracks, int clocks_per_4)
{
set ("MThd", str, "");
}
-
/****************************************************************
chunk
*/
Midi_chunk::~Midi_chunk ()
{
-
+
}
void
string str = header_string_;
string dat = data_string ();
string length_string = String_convert::int2hex (dat.length ()
- + footer_string_.length (), 8, '0');
+ + footer_string_.length (), 8, '0');
length_string = String_convert::hex2bin (length_string);
str += length_string;
return 0;
}
-
-
Midi_duration::Midi_duration (Real seconds_f)
{
seconds_ = seconds_f;
}
Midi_instrument::Midi_instrument (Audio_instrument *a)
- : Midi_channel_item (a)
- , audio_ (a)
+ : Midi_channel_item (a),
+ audio_ (a)
{
audio_->str_ = String_convert::to_lower (audio_->str_);
}
{
str += ::to_string ((char)buffer);
if (buffer & 0x80)
- buffer >>= 8;
+ buffer >>= 8;
else
- break;
+ break;
}
return str;
}
}
Midi_time_signature::Midi_time_signature (Audio_time_signature *a)
- : audio_ (a)
- , clocks_per_1_ (18)
+ : audio_ (a),
+ clocks_per_1_ (18)
{
}
int den = audio_->one_beat_;
-
-
string str = "ff5804";
str += String_convert::int2hex (num, 2, '0');
str += String_convert::int2hex (intlog2 (den), 2, '0');
}
Midi_note::Midi_note (Audio_note *a)
- : Midi_channel_item (a)
- , audio_ (a)
- , dynamic_byte_ (a->dynamic_ && a->dynamic_->volume_ >= 0
- ? Byte (a->dynamic_->volume_ * 0x7f) : Byte (0x5a))
+ : Midi_channel_item (a),
+ audio_ (a),
+ dynamic_byte_ (a->dynamic_ && a->dynamic_->volume_ >= 0
+ ? Byte (a->dynamic_->volume_ * 0x7f) : Byte (0x5a))
{
}
Midi_note::get_fine_tuning () const
{
Rational tune = (audio_->pitch_.tone_pitch ()
- + audio_->transposing_.tone_pitch ()) * Rational (2);
+ + audio_->transposing_.tone_pitch ()) * Rational (2);
tune -= Rational (get_semitone_pitch ());
tune *= PITCH_WHEEL_SEMITONE;
Midi_note::get_semitone_pitch () const
{
double tune = double ((audio_->pitch_.tone_pitch ()
- + audio_->transposing_.tone_pitch ()) * Rational (2));
+ + audio_->transposing_.tone_pitch ()) * Rational (2));
return int (rint (tune));
}
// Move pitch wheel back to the central position.
str += ::to_string ((char) 0x00);
str += ::to_string ((char) (0xE0 + channel_));
- str += ::to_string ((char) (PITCH_WHEEL_CENTER &0x7F));
+ str += ::to_string ((char) (PITCH_WHEEL_CENTER & 0x7F));
str += ::to_string ((char) (PITCH_WHEEL_CENTER >> 7));
}
}
Midi_dynamic::Midi_dynamic (Audio_dynamic *a)
- : Midi_channel_item (a)
- , audio_ (a)
+ : Midi_channel_item (a),
+ audio_ (a)
{
}
int const volume_default = 100;
if (audio_->volume_ < 0 || audio_->silent_)
volume = volume_default;
-
+
str += ::to_string ((char)0x07);
str += ::to_string ((char)volume);
return str;
}
Midi_piano_pedal::Midi_piano_pedal (Audio_piano_pedal *a)
- : Midi_channel_item (a)
- , audio_ (a)
+ : Midi_channel_item (a),
+ audio_ (a)
{
}
char const *
Midi_item::name () const
{
- return this->class_name ();
+ return this->class_name ();
}
}
bool
-audio_item_less (Audio_item * const a,
- Audio_item * const b)
+audio_item_less (Audio_item *const a,
+ Audio_item *const b)
{
- return a->get_column ()->when_ < b->get_column ()->when_;
+ return a->get_column ()->when_ < b->get_column ()->when_;
}
Midi_walker::Midi_walker (Audio_staff *audio_staff, Midi_track *track)
{
/* if this pitch already in queue */
if (stop_note_queue[i].val->get_semitone_pitch ()
- == note->get_semitone_pitch ())
- {
- int queued_ticks
- = stop_note_queue[i].val->audio_->audio_column_->ticks ();
- // If the two notes started at the same time, or option is set,
- if (now_ticks == queued_ticks || merge_unisons_)
- {
- // merge them.
- if (stop_note_queue[i].key < stop_ticks)
- {
- Midi_note_event e;
- e.val = stop_note_queue[i].val;
- e.key = stop_ticks;
- stop_note_queue[i].ignore_ = true;
- stop_note_queue.insert (e);
- }
- note = 0;
- break;
- }
- else
- {
- // A note was played that interruped a played note.
- // Stop the old note, and continue to the greatest moment
- // between the two.
- if (stop_note_queue[i].key > stop_ticks)
- {
- stop_ticks = stop_note_queue[i].key;
- }
- output_event (now_ticks, stop_note_queue[i].val);
- stop_note_queue[i].ignore_ = true;
- break;
- }
- }
+ == note->get_semitone_pitch ())
+ {
+ int queued_ticks
+ = stop_note_queue[i].val->audio_->audio_column_->ticks ();
+ // If the two notes started at the same time, or option is set,
+ if (now_ticks == queued_ticks || merge_unisons_)
+ {
+ // merge them.
+ if (stop_note_queue[i].key < stop_ticks)
+ {
+ Midi_note_event e;
+ e.val = stop_note_queue[i].val;
+ e.key = stop_ticks;
+ stop_note_queue[i].ignore_ = true;
+ stop_note_queue.insert (e);
+ }
+ note = 0;
+ break;
+ }
+ else
+ {
+ // A note was played that interruped a played note.
+ // Stop the old note, and continue to the greatest moment
+ // between the two.
+ if (stop_note_queue[i].key > stop_ticks)
+ {
+ stop_ticks = stop_note_queue[i].key;
+ }
+ output_event (now_ticks, stop_note_queue[i].val);
+ stop_note_queue[i].ignore_ = true;
+ break;
+ }
+ }
}
if (note)
{
Midi_note_event e = stop_note_queue.get ();
if (e.ignore_)
- {
- continue;
- }
+ {
+ continue;
+ }
int stop_ticks = e.key;
Midi_note *note = e.val;
if (Midi_item *midi = get_midi (audio))
{
if (Midi_note *note = dynamic_cast<Midi_note *> (midi))
- {
- if (note->audio_->length_mom_.to_bool ())
- do_start_note (note);
- }
+ {
+ if (note->audio_->length_mom_.to_bool ())
+ do_start_note (note);
+ }
else
- output_event (audio->audio_column_->ticks (), midi);
+ output_event (audio->audio_column_->ticks (), midi);
}
}
-Midi_item*
+Midi_item *
Midi_walker::get_midi (Audio_item *i)
{
Midi_item *mi = Midi_item::get_midi (i);
if (percussion_)
- if (Midi_channel_item *mci = dynamic_cast<Midi_channel_item*> (mi))
+ if (Midi_channel_item *mci = dynamic_cast<Midi_channel_item *> (mi))
mci->channel_ = 9;
midi_events_.push_back (mi);
}
void
-Midi_walker::operator ++ (int)
+Midi_walker::operator ++(int)
{
assert (ok ());
index_++;
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "misc.hh"
#include "warn.hh"
return ceil (f);
}
-
-
/*
0 at threshold, 1 at 0, with 1/x falloff.
*/
Real
-peak_around (Real epsilon, Real threshold, Real x)
+peak_around (Real epsilon, Real threshold, Real x)
{
if (x < 0)
return 1.0;
}
/*
- 0 at 0, 1 at standard_x, and increasing thereafter.
+ 0 at 0, 1 at standard_x, and increasing thereafter.
*/
Real
convex_amplifier (Real standard_x, Real increase_factor, Real x)
{
- return (exp (increase_factor * x / standard_x) - 1.0) / (exp (increase_factor) - 1.0);
+ return (exp (increase_factor * x / standard_x) - 1.0) / (exp (increase_factor) - 1.0);
}
string
camel_case_to_lisp_identifier (string in)
{
vector<char> out;
-
+
/* don't add '-' before first character */
out.push_back (char (tolower (in[0])));
-
+
for (size_t inpos = 1; inpos < in.size (); inpos++)
{
if (isupper (in[inpos]))
- out.push_back ('-');
- out.push_back ( char(tolower (in[inpos])));
+ out.push_back ('-');
+ out.push_back ( char (tolower (in[inpos])));
}
-
+
string result (&out[0], out.size ());
replace_all (&result, '_', '-');
#include "program-option.hh"
Modified_font_metric::Modified_font_metric (Font_metric *fm,
- Real magnification)
+ Real magnification)
{
magnification_ = magnification;
#include "main.hh"
#include "std-string.hh"
-
/*
If a variable is changed in SRC, then DEST doesn't see the
definitions.
static SCM
module_define_closure_func (void *closure,
- SCM key,
- SCM val,
- SCM /* result */)
+ SCM key,
+ SCM val,
+ SCM /* result */)
{
SCM module = (SCM) closure;
if (scm_variable_bound_p (val) == SCM_BOOL_T)
}
LY_DEFINE (ly_module_copy, "ly:module-copy",
- 2, 0, 0, (SCM dest, SCM src),
- "Copy all bindings from module @var{src} into @var{dest}.")
+ 2, 0, 0, (SCM dest, SCM src),
+ "Copy all bindings from module @var{src} into @var{dest}.")
{
#define FUNC_NAME __FUNCTION__
SCM_VALIDATE_MODULE (1, src);
scm_internal_hash_fold ((scm_t_hash_fold_fn) &module_define_closure_func,
- (void *) dest,
- SCM_EOL, SCM_MODULE_OBARRAY (src));
+ (void *) dest,
+ SCM_EOL, SCM_MODULE_OBARRAY (src));
return SCM_UNSPECIFIED;
}
-
/* Lookup SYM, but don't give error when it is not defined. */
SCM
ly_module_lookup (SCM module, SCM sym)
/* Lookup SYM in a list of modules, which do not have to be related.
Return the first instance. */
LY_DEFINE (ly_modules_lookup, "ly:modules-lookup",
- 2, 1, 0,
- (SCM modules, SCM sym, SCM def),
- "Look up @var{sym} in the list @var{modules},"
- " returning the first occurence. If not found, return"
- " @var{def} or @code{#f} if @var{def} isn't specified.")
+ 2, 1, 0,
+ (SCM modules, SCM sym, SCM def),
+ "Look up @var{sym} in the list @var{modules},"
+ " returning the first occurence. If not found, return"
+ " @var{def} or @code{#f} if @var{def} isn't specified.")
{
for (SCM s = modules; scm_is_pair (s); s = scm_cdr (s))
{
SCM mod = scm_car (s);
SCM v = ly_module_lookup (mod, sym);
if (SCM_VARIABLEP (v) && SCM_VARIABLE_REF (v) != SCM_UNDEFINED)
- return scm_variable_ref (v);
+ return scm_variable_ref (v);
}
if (def != SCM_UNDEFINED)
/* TODO: add optional factor argument. */
LY_DEFINE (ly_make_moment, "ly:make-moment",
- 2, 2, 0, (SCM n, SCM d, SCM gn, SCM gd),
- "Create the rational number with main timing @var{n}/@var{d},"
- " and optional grace timing @var{gn}/@var{gd}.\n"
- "\n"
- "A @dfn{moment} is a point in musical time. It consists of"
- " a pair of rationals (@var{m},@tie{}@var{g}), where @var{m} is"
- " the timing for the main notes, and @var{g} the timing for"
- " grace notes. In absence of grace notes, @var{g}@tie{}is zero.")
+ 2, 2, 0, (SCM n, SCM d, SCM gn, SCM gd),
+ "Create the rational number with main timing @var{n}/@var{d},"
+ " and optional grace timing @var{gn}/@var{gd}.\n"
+ "\n"
+ "A @dfn{moment} is a point in musical time. It consists of"
+ " a pair of rationals (@var{m},@tie{}@var{g}), where @var{m} is"
+ " the timing for the main notes, and @var{g} the timing for"
+ " grace notes. In absence of grace notes, @var{g}@tie{}is zero.")
{
LY_ASSERT_TYPE (scm_is_integer, n, 1);
LY_ASSERT_TYPE (scm_is_integer, d, 2);
}
return Moment (Rational (scm_to_int (n), scm_to_int (d)),
- Rational (grace_num, grace_den)).smobbed_copy ();
+ Rational (grace_num, grace_den)).smobbed_copy ();
}
LY_DEFINE (ly_moment_sub, "ly:moment-sub",
- 2, 0, 0, (SCM a, SCM b),
- "Subtract two moments.")
+ 2, 0, 0, (SCM a, SCM b),
+ "Subtract two moments.")
{
- LY_ASSERT_SMOB (Moment, a, 1);
+ LY_ASSERT_SMOB (Moment, a, 1);
LY_ASSERT_SMOB (Moment, b, 2);
-
+
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
}
LY_DEFINE (ly_moment_add, "ly:moment-add",
- 2, 0, 0, (SCM a, SCM b),
- "Add two moments.")
+ 2, 0, 0, (SCM a, SCM b),
+ "Add two moments.")
{
- LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB (Moment, b, 2);
+ LY_ASSERT_SMOB (Moment, a, 1);
+ LY_ASSERT_SMOB (Moment, b, 2);
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
}
LY_DEFINE (ly_moment_mul, "ly:moment-mul",
- 2, 0, 0, (SCM a, SCM b),
- "Multiply two moments.")
+ 2, 0, 0, (SCM a, SCM b),
+ "Multiply two moments.")
{
- LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB (Moment, b, 2);
+ LY_ASSERT_SMOB (Moment, a, 1);
+ LY_ASSERT_SMOB (Moment, b, 2);
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
}
LY_DEFINE (ly_moment_div, "ly:moment-div",
- 2, 0, 0, (SCM a, SCM b),
- "Divide two moments.")
+ 2, 0, 0, (SCM a, SCM b),
+ "Divide two moments.")
{
- LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB (Moment, b, 2);
+ LY_ASSERT_SMOB (Moment, a, 1);
+ LY_ASSERT_SMOB (Moment, b, 2);
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
-
+
return (*ma / * mb).smobbed_copy ();
}
LY_DEFINE (ly_moment_mod, "ly:moment-mod",
- 2, 0, 0, (SCM a, SCM b),
- "Modulo of two moments.")
+ 2, 0, 0, (SCM a, SCM b),
+ "Modulo of two moments.")
{
- LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB (Moment, b, 2);
-
+ LY_ASSERT_SMOB (Moment, a, 1);
+ LY_ASSERT_SMOB (Moment, b, 2);
+
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
return (*ma % * mb).smobbed_copy ();
}
LY_DEFINE (ly_moment_grace_numerator, "ly:moment-grace-numerator",
- 1, 0, 0, (SCM mom),
- "Extract numerator from grace timing.")
+ 1, 0, 0, (SCM mom),
+ "Extract numerator from grace timing.")
{
LY_ASSERT_SMOB (Moment, mom, 1);
}
LY_DEFINE (ly_moment_grace_denominator, "ly:moment-grace-denominator",
- 1, 0, 0, (SCM mom),
- "Extract denominator from grace timing.")
+ 1, 0, 0, (SCM mom),
+ "Extract denominator from grace timing.")
{
LY_ASSERT_SMOB (Moment, mom, 1);
Moment *ma = unsmob_moment (mom);
return scm_from_int64 (ma->grace_part_.denominator ());
}
LY_DEFINE (ly_moment_main_numerator, "ly:moment-main-numerator",
- 1, 0, 0, (SCM mom),
- "Extract numerator from main timing.")
+ 1, 0, 0, (SCM mom),
+ "Extract numerator from main timing.")
{
LY_ASSERT_SMOB (Moment, mom, 1);
Moment *ma = unsmob_moment (mom);
}
LY_DEFINE (ly_moment_main_denominator, "ly:moment-main-denominator",
- 1, 0, 0, (SCM mom),
- "Extract denominator from main timing.")
+ 1, 0, 0, (SCM mom),
+ "Extract denominator from main timing.")
{
LY_ASSERT_SMOB (Moment, mom, 1);
Moment *ma = unsmob_moment (mom);
}
LY_DEFINE (ly_moment_less_p, "ly:moment<?",
- 2, 0, 0, (SCM a, SCM b),
- "Compare two moments.")
+ 2, 0, 0, (SCM a, SCM b),
+ "Compare two moments.")
{
- LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB (Moment, b, 2);
-
+ LY_ASSERT_SMOB (Moment, a, 1);
+ LY_ASSERT_SMOB (Moment, b, 2);
+
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
Moment::as_scheme () const
{
return scm_list_5 (ly_symbol2scm ("ly:make-moment"),
- scm_from_int64 (main_part_.num ()),
- scm_from_int64 (main_part_.den ()),
- scm_from_int64 (grace_part_.num ()),
- scm_from_int64 (grace_part_.den ()));
+ scm_from_int64 (main_part_.num ()),
+ scm_from_int64 (main_part_.den ()),
+ scm_from_int64 (grace_part_.num ()),
+ scm_from_int64 (grace_part_.den ()));
}
SCM
private:
Stream_event *rest_ev_;
- vector<Stream_event*> text_events_;
+ vector<Stream_event *> text_events_;
int start_measure_;
Rational last_main_moment_;
Moment stop_moment_;
Spanner *last_rest_;
Spanner *mmrest_;
- vector<Spanner*> numbers_;
- vector<Spanner*> last_numbers_;
+ vector<Spanner *> numbers_;
+ vector<Spanner *> last_numbers_;
};
Multi_measure_rest_engraver::Multi_measure_rest_engraver ()
mmrest_ = make_spanner ("MultiMeasureRest", rest_ev_->self_scm ());
Spanner *sp
- = make_spanner ("MultiMeasureRestNumber", rest_ev_->self_scm ());
+ = make_spanner ("MultiMeasureRestNumber", rest_ev_->self_scm ());
numbers_.push_back (sp);
if (text_events_.size ())
- {
- for (vsize i = 0; i < text_events_.size (); i++)
- {
- Stream_event *e = text_events_[i];
- Spanner *sp
- = make_spanner ("MultiMeasureRestText", e->self_scm ());
- SCM t = e->get_property ("text");
- SCM dir = e->get_property ("direction");
- sp->set_property ("text", t);
- if (is_direction (dir))
- sp->set_property ("direction", dir);
-
- numbers_.push_back (sp);
- }
-
- /*
- Stack different scripts.
- */
- Direction d = DOWN;
- do
- {
- Grob *last = 0;
- for (vsize i = 0; i < numbers_.size (); i++)
- {
- if (scm_from_int (d) == numbers_[i]->get_property ("direction"))
- {
- if (last)
- Side_position_interface::add_support (numbers_[i], last);
- last = numbers_[i];
- }
- }
- }
- while (flip (&d) != DOWN);
- }
+ {
+ for (vsize i = 0; i < text_events_.size (); i++)
+ {
+ Stream_event *e = text_events_[i];
+ Spanner *sp
+ = make_spanner ("MultiMeasureRestText", e->self_scm ());
+ SCM t = e->get_property ("text");
+ SCM dir = e->get_property ("direction");
+ sp->set_property ("text", t);
+ if (is_direction (dir))
+ sp->set_property ("direction", dir);
+
+ numbers_.push_back (sp);
+ }
+
+ /*
+ Stack different scripts.
+ */
+ Direction d = DOWN;
+ do
+ {
+ Grob *last = 0;
+ for (vsize i = 0; i < numbers_.size (); i++)
+ {
+ if (scm_from_int (d) == numbers_[i]->get_property ("direction"))
+ {
+ if (last)
+ Side_position_interface::add_support (numbers_[i], last);
+ last = numbers_[i];
+ }
+ }
+ }
+ while (flip (&d) != DOWN);
+ }
for (vsize i = 0; i < numbers_.size (); i++)
- {
- Side_position_interface::add_support (numbers_[i], mmrest_);
- numbers_[i]->set_parent (mmrest_, Y_AXIS);
- }
+ {
+ Side_position_interface::add_support (numbers_[i], mmrest_);
+ numbers_[i]->set_parent (mmrest_, Y_AXIS);
+ }
start_measure_
- = scm_to_int (get_property ("internalBarNumber"));
+ = scm_to_int (get_property ("internalBarNumber"));
}
bar_seen_ = bar_seen_ || scm_is_string (get_property ("whichBar"));
if (last_command_item_ && (mmrest_ || last_rest_))
{
if (last_rest_)
- {
- add_bound_item (last_rest_, last_command_item_);
- for (vsize i = 0; i < last_numbers_.size (); i++)
- add_bound_item (last_numbers_[i], last_command_item_);
- }
+ {
+ add_bound_item (last_rest_, last_command_item_);
+ for (vsize i = 0; i < last_numbers_.size (); i++)
+ add_bound_item (last_numbers_[i], last_command_item_);
+ }
if (mmrest_)
- {
- add_bound_item (mmrest_, last_command_item_);
- for (vsize i = 0; i < numbers_.size (); i++)
- add_bound_item (numbers_[i], last_command_item_);
+ {
+ add_bound_item (mmrest_, last_command_item_);
+ for (vsize i = 0; i < numbers_.size (); i++)
+ add_bound_item (numbers_[i], last_command_item_);
- last_command_item_ = 0;
- }
+ last_command_item_ = 0;
+ }
}
Moment mp (robust_scm2moment (get_property ("measurePosition"), Moment (0)));
int num = cur - start_measure_;
/*
- We can't plug a markup directly into the grob, since the
- measure-count determines the formatting of the mmrest.
+ We can't plug a markup directly into the grob, since the
+ measure-count determines the formatting of the mmrest.
*/
last_rest_->set_property ("measure-count", scm_from_int (num));
Grob *last = last_numbers_.size () ? last_numbers_[0] : 0;
if (last && last->get_property ("text") == SCM_EOL)
- {
- SCM thres = get_property ("restNumberThreshold");
- int t = 1;
- if (scm_is_number (thres))
- t = scm_to_int (thres);
-
- if (num <= t)
- last->suicide ();
- else
- {
- SCM text
- = scm_number_to_string (scm_from_int (num), scm_from_int (10));
- last->set_property ("text", text);
- }
- }
+ {
+ SCM thres = get_property ("restNumberThreshold");
+ int t = 1;
+ if (scm_is_number (thres))
+ t = scm_to_int (thres);
+
+ if (num <= t)
+ last->suicide ();
+ else
+ {
+ SCM text
+ = scm_number_to_string (scm_from_int (num), scm_from_int (10));
+ last->set_property ("text", text);
+ }
+ }
}
last_main_moment_ = now.main_part_;
}
ADD_TRANSLATOR (Multi_measure_rest_engraver,
- /* doc */
- "Engrave multi-measure rests that are produced with"
- " @samp{R}. It reads @code{measurePosition} and"
- " @code{internalBarNumber} to determine what number to print"
- " over the @ref{MultiMeasureRest}.",
-
- /* create */
- "MultiMeasureRest "
- "MultiMeasureRestNumber "
- "MultiMeasureRestText ",
-
- /* read */
- "internalBarNumber "
- "restNumberThreshold "
- "currentCommandColumn "
- "measurePosition ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Engrave multi-measure rests that are produced with"
+ " @samp{R}. It reads @code{measurePosition} and"
+ " @code{internalBarNumber} to determine what number to print"
+ " over the @ref{MultiMeasureRest}.",
+
+ /* create */
+ "MultiMeasureRest "
+ "MultiMeasureRestNumber "
+ "MultiMeasureRestText ",
+
+ /* read */
+ "internalBarNumber "
+ "restNumberThreshold "
+ "currentCommandColumn "
+ "measurePosition ",
+
+ /* write */
+ ""
+ );
{
Item *col = me->get_bound (d)->get_column ();
SCM align_sym
- = (scm_is_pair (spacing_pair)
- ? index_get_cell (spacing_pair, d)
- : ly_symbol2scm ("staff-bar"));
+ = (scm_is_pair (spacing_pair)
+ ? index_get_cell (spacing_pair, d)
+ : ly_symbol2scm ("staff-bar"));
Interval coldim = Paper_column::break_align_width (col, align_sym);
iv[d] = coldim[-d];
// ugh copy & paste.
Grob *common_x = sp->get_bound (LEFT)->common_refpoint (sp->get_bound (RIGHT),
- X_AXIS);
+ X_AXIS);
Interval sp_iv = bar_width (sp);
Real x_off = 0.0;
measure_duration_log (Grob *me)
{
SCM sml = dynamic_cast<Spanner *> (me)->get_bound (LEFT)
- ->get_property ("measure-length");
+ ->get_property ("measure-length");
bool round = to_boolean (me->get_property ("round-to-longer-rest"));
Rational ml = (unsmob_moment (sml)) ? unsmob_moment (sml)->main_part_ : Rational (1);
int closest_list_elt = -15; // -15 is out of range.
for (int i = 0; i < scm_to_int (scm_length (duration_logs_list)); i++)
- {
- int list_elt = scm_to_int (scm_list_ref (duration_logs_list, scm_from_int (i)));
- int shortest_distance = abs (measure_duration_log - closest_list_elt);
- int distance = abs (measure_duration_log - list_elt);
- if (distance < shortest_distance)
- closest_list_elt = list_elt;
- }
+ {
+ int list_elt = scm_to_int (scm_list_ref (duration_logs_list, scm_from_int (i)));
+ int shortest_distance = abs (measure_duration_log - closest_list_elt);
+ int distance = abs (measure_duration_log - list_elt);
+ if (distance < shortest_distance)
+ closest_list_elt = list_elt;
+ }
return closest_list_elt;
}
*/
Stencil
Multi_measure_rest::church_rest (Grob *me, Font_metric *musfont, int measures,
- Real space)
+ Real space)
{
SCM mols = SCM_EOL;
SCM duration_logs_list = me->get_property ("usable-duration-logs");
int longest_church_rest = 10; // 10 is out of range.
for (int i = 0; i < scm_to_int (scm_length (duration_logs_list)); i++)
- {
- longest_church_rest = min (longest_church_rest,
- scm_to_int (scm_list_ref (duration_logs_list,
- scm_from_int (i))));
- }
-
- while (l)
- {
- int k;
- int i = longest_church_rest - 1;
- int length;
- int mdl = measure_duration_log (me);
-
- do
{
- i++;
- length = int (pow (2.0, -i));
+ longest_church_rest = min (longest_church_rest,
+ scm_to_int (scm_list_ref (duration_logs_list,
+ scm_from_int (i))));
}
- while (i <= 0 &&
- !(l >= length && mdl >= longest_church_rest - i));
-
- l -= length;
- k = mdl + i;
- Stencil r (musfont->find_by_name ("rests." + to_string (k)));
- if (k == 0)
+ while (l)
{
- Real staff_space = Staff_symbol_referencer::staff_space (me);
- r.translate_axis (staff_space, Y_AXIS);
+ int k;
+ int i = longest_church_rest - 1;
+ int length;
+ int mdl = measure_duration_log (me);
+
+ do
+ {
+ i++;
+ length = int (pow (2.0, -i));
+ }
+ while (i <= 0
+ && !(l >= length && mdl >= longest_church_rest - i));
+
+ l -= length;
+ k = mdl + i;
+
+ Stencil r (musfont->find_by_name ("rests." + to_string (k)));
+ if (k == 0)
+ {
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ r.translate_axis (staff_space, Y_AXIS);
+ }
+ symbols_width += r.extent (X_AXIS).length ();
+ mols = scm_cons (r.smobbed_copy (), mols);
+ count++;
}
- symbols_width += r.extent (X_AXIS).length ();
- mols = scm_cons (r.smobbed_copy (), mols);
- count++;
- }
/* Make outer padding this much bigger. */
Real outer_padding_factor = 1.5;
Real inner_padding = (space - symbols_width)
- / (2 * outer_padding_factor + (count - 1));
+ / (2 * outer_padding_factor + (count - 1));
if (inner_padding < 0)
inner_padding = 1.0;
Stencil mol;
for (SCM s = mols; scm_is_pair (s); s = scm_cdr (s))
mol.add_at_edge (X_AXIS, LEFT, *unsmob_stencil (scm_car (s)),
- inner_padding);
+ inner_padding);
mol.align_to (X_AXIS, LEFT);
mol.translate_axis (outer_padding_factor * inner_padding, X_AXIS);
Item *rb = ri->find_prebroken_piece (LEFT);
Item *combinations[4][2] = {{li, ri},
- {lb, ri},
- {li, rb},
- {lb, rb}};
+ {lb, ri},
+ {li, rb},
+ {lb, rb}
+ };
for (int i = 0; i < 4; i++)
{
Item *ri = combinations[i][1];
if (!li || !ri)
- continue;
+ continue;
Rod rod;
rod.item_drul_[LEFT] = li;
rod.item_drul_[RIGHT] = ri;
rod.distance_ = Paper_column::minimum_distance (li, ri)
- + length
- + 2 * robust_scm2double (me->get_property ("bound-padding"), 1.0);
+ + length
+ + 2 * robust_scm2double (me->get_property ("bound-padding"), 1.0);
Real minlen = robust_scm2double (me->get_property ("minimum-length"), 0);
rod.distance_ = max (rod.distance_, minlen);
/* FIXME uncached */
Real len = (stil && !stil->extent (X_AXIS).is_empty ())
- ? stil->extent (X_AXIS).length ()
- : 0.0;
+ ? stil->extent (X_AXIS).length ()
+ : 0.0;
calculate_spacing_rods (me, len);
return SCM_UNSPECIFIED;
}
ADD_INTERFACE (Multi_measure_rest,
- "A rest that spans a whole number of measures.",
-
- /* properties */
- "bound-padding "
- "expand-limit "
- "hair-thickness "
- "measure-count "
- "minimum-length "
- "round-to-longer-rest "
- "spacing-pair "
- "thick-thickness "
+ "A rest that spans a whole number of measures.",
+
+ /* properties */
+ "bound-padding "
+ "expand-limit "
+ "hair-thickness "
+ "measure-count "
+ "minimum-length "
+ "round-to-longer-rest "
+ "spacing-pair "
+ "thick-thickness "
"usable-duration-logs "
- );
+ );
#include "music-function.hh"
LY_DEFINE (ly_music_function_p, "ly:music-function?", 1, 0, 0,
- (SCM x),
- "Is @var{x} a @code{music-function}?")
+ (SCM x),
+ "Is @var{x} a @code{music-function}?")
{
return is_music_function (x) ? SCM_BOOL_T : SCM_BOOL_F;
}
-
+
LY_DEFINE (ly_music_function_extract, "ly:music-function-extract", 1, 0, 0,
- (SCM x),
- "Return the Scheme function inside@tie{}@var{x}.")
+ (SCM x),
+ "Return the Scheme function inside@tie{}@var{x}.")
{
LY_ASSERT_TYPE (is_music_function, x, 1);
-
- return SCM_CELL_OBJECT_1(x);
+
+ return SCM_CELL_OBJECT_1 (x);
}
LY_DEFINE (ly_make_music_function, "ly:make-music-function", 2, 0, 0,
- (SCM signature, SCM func),
- "Make a function to process music, to be used for the"
- " parser. @var{func} is the function, and @var{signature}"
- " describes its arguments. @var{signature} is a list"
- " containing either @code{ly:music?} predicates or other type"
- " predicates.")
+ (SCM signature, SCM func),
+ "Make a function to process music, to be used for the"
+ " parser. @var{func} is the function, and @var{signature}"
+ " describes its arguments. @var{signature} is a list"
+ " containing either @code{ly:music?} predicates or other type"
+ " predicates.")
{
LY_ASSERT_TYPE (ly_is_procedure, func, 1);
- return make_music_function (signature, func);
+ return make_music_function (signature, func);
}
make_music_function (SCM signature, SCM func)
{
scm_set_object_property_x (func, ly_symbol2scm ("music-function-signature"),
- signature);
+ signature);
SCM_RETURN_NEWSMOB (music_function_tag, func);
}
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include <cstdio>
using namespace std;
else
{
if (dynamic_cast<Music_wrapper *> (m))
- p = new Music_wrapper_iterator;
+ p = new Music_wrapper_iterator;
else if (m->is_mus_type ("event"))
p = new Event_iterator;
else
- p = new Simple_music_iterator;
+ p = new Simple_music_iterator;
iter = p->self_scm ();
p->unprotect ();
set_context (get_outlet ()->get_default_interpreter ());
}
-void
+void
Music_iterator::report_event (Music *m)
{
descend_to_bottom_context ();
/*
- FIXME: then don't do it.
+ FIXME: then don't do it.
*/
if (!m->is_mus_type ("event"))
m->origin ()->programming_error (_ ("Sending non-event to context"));
}
int
-Music_iterator::print_smob (SCM sm, SCM port, scm_print_state*)
+Music_iterator::print_smob (SCM sm, SCM port, scm_print_state *)
{
char s[1000];
}
int
-Music_output::print_smob (SCM s, SCM p, scm_print_state*)
+Music_output::print_smob (SCM s, SCM p, scm_print_state *)
{
Music_output *sc = (Music_output *) SCM_CELL_WORD_1 (s);
scm_puts ("#<", p);
#include "warn.hh"
LY_DEFINE (ly_music_length, "ly:music-length",
- 1, 0, 0, (SCM mus),
- "Get the length of music expression @var{mus} and return"
- " it as a @code{Moment} object.")
+ 1, 0, 0, (SCM mus),
+ "Get the length of music expression @var{mus} and return"
+ " it as a @code{Moment} object.")
{
LY_ASSERT_TYPE (unsmob_music, mus, 1);
Music *sc = unsmob_music (mus);
}
LY_DEFINE (ly_music_property, "ly:music-property",
- 2, 1, 0, (SCM mus, SCM sym, SCM val),
- "Return the value for property @var{sym} of music expression"
- " @var{mus}. If no value is found, return @var{val} or"
- " @code{'()} if @var{val} is not specified.")
+ 2, 1, 0, (SCM mus, SCM sym, SCM val),
+ "Return the value for property @var{sym} of music expression"
+ " @var{mus}. If no value is found, return @var{val} or"
+ " @code{'()} if @var{val} is not specified.")
{
LY_ASSERT_TYPE (unsmob_music, mus, 1);
return ly_prob_property (mus, sym, val);
}
LY_DEFINE (ly_music_set_property_x, "ly:music-set-property!",
- 3, 0, 0, (SCM mus, SCM sym, SCM val),
- "Set property @var{sym} in music expression @var{mus} to"
- " @var{val}.")
+ 3, 0, 0, (SCM mus, SCM sym, SCM val),
+ "Set property @var{sym} in music expression @var{mus} to"
+ " @var{val}.")
{
LY_ASSERT_TYPE (unsmob_music, mus, 1);
return ly_prob_set_property_x (mus, sym, val);
}
-
/* todo: property args */
LY_DEFINE (ly_make_music, "ly:make-music",
- 1, 0, 0, (SCM props),
- "Make a C++ @code{Music} object and initialize it with"
- " @var{props}.\n"
- "\n"
- "This function is for internal use and is only called by"
- " @code{make-music}, which is the preferred interface"
- " for creating music objects.")
+ 1, 0, 0, (SCM props),
+ "Make a C++ @code{Music} object and initialize it with"
+ " @var{props}.\n"
+ "\n"
+ "This function is for internal use and is only called by"
+ " @code{make-music}, which is the preferred interface"
+ " for creating music objects.")
{
Music *ms = new Music (props);
return ms->unprotect ();
}
LY_DEFINE (ly_music_p, "ly:music?",
- 1, 0, 0, (SCM obj),
- "Is @var{obj} a music object?")
+ 1, 0, 0, (SCM obj),
+ "Is @var{obj} a music object?")
{
return scm_from_bool (unsmob_music (obj));
}
/* todo: property args */
LY_DEFINE (ly_music_mutable_properties, "ly:music-mutable-properties",
- 1, 0, 0, (SCM mus),
- "Return an alist containing the mutable properties of @var{mus}."
- " The immutable properties are not available, since they are"
- " constant and initialized by the @code{make-music} function.")
+ 1, 0, 0, (SCM mus),
+ "Return an alist containing the mutable properties of @var{mus}."
+ " The immutable properties are not available, since they are"
+ " constant and initialized by the @code{make-music} function.")
{
LY_ASSERT_TYPE (unsmob_music, mus, 1);
Music *m = unsmob_music (mus);
}
LY_DEFINE (ly_music_list_p, "ly:music-list?",
- 1, 0, 0, (SCM lst),
- "Is @var{lst} a list of music objects?")
+ 1, 0, 0, (SCM lst),
+ "Is @var{lst} a list of music objects?")
{
if (scm_list_p (lst) == SCM_BOOL_T)
while (scm_is_pair (lst))
{
- if (!unsmob_music (scm_car (lst)))
- return SCM_BOOL_F;
- lst = scm_cdr (lst);
+ if (!unsmob_music (scm_car (lst)))
+ return SCM_BOOL_F;
+ lst = scm_cdr (lst);
}
return SCM_BOOL_T;
}
LY_DEFINE (ly_music_deep_copy, "ly:music-deep-copy",
- 1, 0, 0, (SCM m),
- "Copy @var{m} and all sub expressions of@tie{}@var{m}.")
+ 1, 0, 0, (SCM m),
+ "Copy @var{m} and all sub expressions of@tie{}@var{m}.")
{
SCM copy = m;
if (unsmob_music (m))
}
else if (scm_is_pair (m))
copy = scm_cons (ly_music_deep_copy (scm_car (m)),
- ly_music_deep_copy (scm_cdr (m)));
+ ly_music_deep_copy (scm_cdr (m)));
return copy;
}
LY_DEFINE (ly_music_transpose, "ly:music-transpose",
- 2, 0, 0, (SCM m, SCM p),
- "Transpose @var{m} such that central@tie{}C is mapped"
- " to@tie{}@var{p}. Return@tie{}@var{m}.")
+ 2, 0, 0, (SCM m, SCM p),
+ "Transpose @var{m} such that central@tie{}C is mapped"
+ " to@tie{}@var{p}. Return@tie{}@var{m}.")
{
LY_ASSERT_TYPE (unsmob_music, m, 1);
LY_ASSERT_SMOB (Pitch, p, 2);
TODO: should take moment factor?
*/
LY_DEFINE (ly_music_compress, "ly:music-compress",
- 2, 0, 0, (SCM m, SCM factor),
- "Compress music object@tie{}@var{m} by moment @var{factor}.")
+ 2, 0, 0, (SCM m, SCM factor),
+ "Compress music object@tie{}@var{m} by moment @var{factor}.")
{
LY_ASSERT_TYPE (unsmob_music, m, 1);
LY_ASSERT_TYPE (unsmob_moment, factor, 2);
}
LY_DEFINE (ly_music_duration_length, "ly:music-duration-length", 1, 0, 0,
- (SCM mus),
- "Extract the duration field from @var{mus} and return the"
- " length.")
+ (SCM mus),
+ "Extract the duration field from @var{mus} and return the"
+ " length.")
{
LY_ASSERT_TYPE (unsmob_music, mus, 1);
Music *m = unsmob_music (mus);
}
LY_DEFINE (ly_music_duration_compress, "ly:music-duration-compress", 2, 0, 0,
- (SCM mus, SCM fact),
- "Compress @var{mus} by factor @var{fact}, which is a"
- " @code{Moment}.")
+ (SCM mus, SCM fact),
+ "Compress @var{mus} by factor @var{fact}, which is a"
+ " @code{Moment}.")
{
LY_ASSERT_TYPE (unsmob_music, mus, 1);
LY_ASSERT_SMOB (Moment, fact, 2);
-
+
Music *m = unsmob_music (mus);
Moment *f = unsmob_moment (fact);
TODO: this should use ly:pitch.
*/
LY_DEFINE (ly_transpose_key_alist, "ly:transpose-key-alist",
- 2, 0, 0, (SCM l, SCM pit),
- "Make a new key alist of@tie{}@var{l} transposed by"
- " pitch @var{pit}.")
+ 2, 0, 0, (SCM l, SCM pit),
+ "Make a new key alist of@tie{}@var{l} transposed by"
+ " pitch @var{pit}.")
{
SCM newlist = SCM_EOL;
Pitch *p = unsmob_pitch (pit);
SCM key = scm_caar (s);
SCM alter = scm_cdar (s);
if (scm_is_pair (key))
- {
- Pitch orig (scm_to_int (scm_car (key)),
- scm_to_int (scm_cdr (key)),
- ly_scm2rational (alter));
+ {
+ Pitch orig (scm_to_int (scm_car (key)),
+ scm_to_int (scm_cdr (key)),
+ ly_scm2rational (alter));
- orig = orig.transposed (*p);
+ orig = orig.transposed (*p);
- SCM key = scm_cons (scm_from_int (orig.get_octave ()),
- scm_from_int (orig.get_notename ()));
+ SCM key = scm_cons (scm_from_int (orig.get_octave ()),
+ scm_from_int (orig.get_notename ()));
- newlist = scm_cons (scm_cons (key, ly_rational2scm (orig.get_alteration ())),
- newlist);
- }
+ newlist = scm_cons (scm_cons (key, ly_rational2scm (orig.get_alteration ())),
+ newlist);
+ }
else if (scm_is_number (key))
- {
- Pitch orig (0, scm_to_int (key), ly_scm2rational (alter));
- orig = orig.transposed (*p);
-
- key = scm_from_int (orig.get_notename ());
- alter = ly_rational2scm (orig.get_alteration ());
- newlist = scm_cons (scm_cons (key, alter), newlist);
- }
+ {
+ Pitch orig (0, scm_to_int (key), ly_scm2rational (alter));
+ orig = orig.transposed (*p);
+
+ key = scm_from_int (orig.get_notename ());
+ alter = ly_rational2scm (orig.get_alteration ());
+ newlist = scm_cons (scm_cons (key, alter), newlist);
+ }
}
return scm_reverse_x (newlist, SCM_EOL);
}
{
Moment l = unsmob_music (scm_car (s))->get_length ();
if (last_len.grace_part_ && l.main_part_)
- last_len.grace_part_ = Rational (0);
+ last_len.grace_part_ = Rational (0);
cumulative += last_len;
last_len = l;
}
{
Music *m = unsmob_music (scm_car (s));
if (!m)
- programming_error ("Music sequence should have music elements");
+ programming_error ("Music sequence should have music elements");
else
- {
- Moment l = m->get_length ();
- dur = max (dur, l);
- }
+ {
+ Moment l = m->get_length ();
+ dur = max (dur, l);
+ }
}
return dur;
for (SCM s = l; scm_is_pair (s); s = scm_cdr (s))
{
if (Music *m = unsmob_music (scm_car (s)))
- {
- last = m->to_relative_octave (last);
- if (!count++)
- first = last;
- }
+ {
+ last = m->to_relative_octave (last);
+ if (!count++)
+ first = last;
+ }
}
return (ret_first) ? first : last;
Moment l = mus->get_length ();
Moment s = mus->start_mom ();
if (l.to_bool () || s.to_bool ())
- return s;
+ return s;
}
return m;
}
Pitch retval_1_8 = music_list_to_relative (copied, p, true);
if (retval_1_8 != retval)
- lily_1_8_compatibility_used = true;
+ lily_1_8_compatibility_used = true;
retval = retval_1_8;
}
Music *me = unsmob_music (music);
Pitch p = *unsmob_pitch (pitch);
return music_list_to_relative (me->get_property ("elements"),
- p, true).smobbed_copy ();
+ p, true).smobbed_copy ();
}
MAKE_SCHEME_CALLBACK (Music_sequence, repeated_chord_relative_callback, 2);
if (original_chord)
{
for (SCM s = original_chord->get_property ("elements"); scm_is_pair (s); s = scm_cdr (s))
- {
- if (Music *m = unsmob_music (scm_car (s)))
- {
- p = unsmob_pitch (m->get_property ("pitch"));
- if (p)
- break;
- }
- }
+ {
+ if (Music *m = unsmob_music (scm_car (s)))
+ {
+ p = unsmob_pitch (m->get_property ("pitch"));
+ if (p)
+ break;
+ }
+ }
}
/* Use the `pitch' argument if no pitch found in original chord. */
if (! p)
for (SCM s = repeated_chord->get_property ("elements"); scm_is_pair (s); s = scm_cdr (s))
{
if (Music *m = unsmob_music (scm_car (s)))
- {
- Pitch *first_pitch = unsmob_pitch (m->get_property ("pitch"));
- if (first_pitch)
- {
- Pitch new_pitch = Pitch (-1,
- first_pitch->get_notename (),
- first_pitch->get_alteration ());
- m->set_property ("pitch", new_pitch.smobbed_copy ());
- break;
- }
- }
+ {
+ Pitch *first_pitch = unsmob_pitch (m->get_property ("pitch"));
+ if (first_pitch)
+ {
+ Pitch new_pitch = Pitch (-1,
+ first_pitch->get_notename (),
+ first_pitch->get_alteration ());
+ m->set_property ("pitch", new_pitch.smobbed_copy ());
+ break;
+ }
+ }
}
music_list_to_relative (repeated_chord->get_property ("elements"), *p, true).smobbed_copy ();
/* Return `pitch' instead of the repeated chord first pitch,
Music *my_music = get_music ();
Music *child = unsmob_music (my_music->get_property ("element"));
child_iter_ = (child)
- ? unsmob_iterator (get_iterator (child))
- : 0;
+ ? unsmob_iterator (get_iterator (child))
+ : 0;
}
bool
bool
Music_wrapper_iterator::run_always () const
{
- return (child_iter_ && child_iter_->run_always ());
+ return (child_iter_ && child_iter_->run_always ());
}
length_callback_ = m.length_callback_;
start_callback_ = m.start_callback_;
- /// why?
+ /// why?
set_spot (*m.origin ());
}
}
}
-
Pitch
Music::generic_to_relative_octave (Pitch last)
{
SCM check = get_property ("absolute-octave");
if (scm_is_number (check)
- && new_pit.get_octave () != scm_to_int (check))
- {
- Pitch expected_pit (scm_to_int (check),
- new_pit.get_notename (),
- new_pit.get_alteration ());
- origin ()->warning (_f ("octave check failed; expected \"%s\", found: \"%s\"",
- expected_pit.to_string (),
- new_pit.to_string ()));
- new_pit = expected_pit;
- }
+ && new_pit.get_octave () != scm_to_int (check))
+ {
+ Pitch expected_pit (scm_to_int (check),
+ new_pit.get_notename (),
+ new_pit.get_alteration ());
+ origin ()->warning (_f ("octave check failed; expected \"%s\", found: \"%s\"",
+ expected_pit.to_string (),
+ new_pit.to_string ()));
+ new_pit = expected_pit;
+ }
set_property ("pitch", new_pit.smobbed_copy ());
if (ly_is_procedure (callback))
{
Pitch *p = unsmob_pitch (scm_call_2 (callback, self_scm (),
- last.smobbed_copy ()));
+ last.smobbed_copy ()));
return *p;
}
Duration *d = unsmob_duration (get_property ("duration"));
if (d)
set_property ("duration",
- d->compressed (factor.main_part_).smobbed_copy ());
+ d->compressed (factor.main_part_).smobbed_copy ());
}
/*
- This mutates alist. Hence, make sure that it is not shared
+ This mutates alist. Hence, make sure that it is not shared
*/
void
transpose_mutable (SCM alist, Pitch delta)
SCM new_val = val;
if (Pitch *p = unsmob_pitch (val))
- {
- Pitch transposed = p->transposed (delta);
- if (transposed.get_alteration ().abs () > Rational (1,1))
- {
- string delta_str;
- if (delta.get_alteration ().abs () > Rational (1, 1))
- delta_str = (delta.normalized ().to_string ()
- + " " + _ ("(normalized pitch)"));
- else
- delta_str = delta.to_string ();
-
- warning (_f ("Transposing %s by %s makes alteration larger than double",
- p->to_string (),
- delta_str));
- transposed = transposed.normalized ();
- }
-
- new_val = transposed.smobbed_copy ();
- }
+ {
+ Pitch transposed = p->transposed (delta);
+ if (transposed.get_alteration ().abs () > Rational (1, 1))
+ {
+ string delta_str;
+ if (delta.get_alteration ().abs () > Rational (1, 1))
+ delta_str = (delta.normalized ().to_string ()
+ + " " + _ ("(normalized pitch)"));
+ else
+ delta_str = delta.to_string ();
+
+ warning (_f ("Transposing %s by %s makes alteration larger than double",
+ p->to_string (),
+ delta_str));
+ transposed = transposed.normalized ();
+ }
+
+ new_val = transposed.smobbed_copy ();
+ }
else if (prop == ly_symbol2scm ("element"))
- {
- if (Music *m = unsmob_music (val))
- m->transpose (delta);
- }
+ {
+ if (Music *m = unsmob_music (val))
+ m->transpose (delta);
+ }
else if (prop == ly_symbol2scm ("elements"))
- transpose_music_list (val, delta);
- else if (prop == ly_symbol2scm ("pitch-alist") &&
- scm_is_pair (val))
- new_val = ly_transpose_key_alist (val, delta.smobbed_copy ());
+ transpose_music_list (val, delta);
+ else if (prop == ly_symbol2scm ("pitch-alist")
+ && scm_is_pair (val))
+ new_val = ly_transpose_key_alist (val, delta.smobbed_copy ());
if (val != new_val)
- scm_set_cdr_x (entry , new_val);
+ scm_set_cdr_x (entry, new_val);
}
}
{
SCM art_ev = SCM_EOL;
for (; scm_is_pair (art_mus); art_mus = scm_cdr (art_mus))
- {
- Music *m = unsmob_music (scm_car (art_mus));
- SCM ev = m ? m->to_event ()->unprotect () : scm_car (art_mus);
- art_ev = scm_cons (ev, art_ev);
- }
+ {
+ Music *m = unsmob_music (scm_car (art_mus));
+ SCM ev = m ? m->to_event ()->unprotect () : scm_car (art_mus);
+ art_ev = scm_cons (ev, art_ev);
+ }
e->set_property ("articulations", scm_reverse_x (art_ev, SCM_EOL));
}
#include "context.hh"
#include "grob.hh"
-
/*
Drop symbol from the list alist..alist_end.
*/
while (alist != alist_end)
{
if (ly_is_equal (scm_caar (alist), symbol))
- {
- alist = scm_cdr (alist);
- break;
- }
+ {
+ alist = scm_cdr (alist);
+ break;
+ }
*tail = scm_cons (scm_car (alist), SCM_EOL);
tail = SCM_CDRLOC (*tail);
SCM
nested_property_revert_alist (SCM alist, SCM prop_path)
{
- int copy_count = 0;
- bool drop = false;
- assert(scm_is_pair (prop_path));
+ assert (scm_is_pair (prop_path));
SCM wanted_sym = scm_car (prop_path);
{
SCM sub_sym = scm_caar (s);
SCM old_val = scm_cdar (s);
- drop = false;
if (sub_sym == wanted_sym)
- {
- if (scm_is_pair (scm_cdr (prop_path)))
- {
- SCM new_val = nested_property_revert_alist (old_val, scm_cdr (prop_path));
-
- /* nothing changed: drop newly constructed list. */
- if (old_val == new_val)
- return alist;
-
- *tail = scm_acons (sub_sym, new_val, SCM_EOL);
- tail = SCM_CDRLOC(*tail);
- *tail = scm_cdr (s);
- return new_list;
- }
- else
- {
- /* old value should be dropped only if we have another copy of it in the alist */
- copy_count++;
- /*
- Only drop the first instance found.
- the overridden value is always the first
- if this was the only copy, we will return
- the original list anyways so it is not relevant
- if we drop this pair
- */
- if (copy_count == 1)
- drop = true;
- }
- /* we now iterate over every item */
- }
- /*
- Make a new list with every item
- except for the eventual dropped one
- */
- if (!drop)
{
- *tail = scm_acons (sub_sym, old_val, SCM_EOL);
- tail = SCM_CDRLOC (*tail);
+ if (scm_is_pair (scm_cdr (prop_path)))
+ {
+ SCM new_val = nested_property_revert_alist (old_val, scm_cdr (prop_path));
+
+ /* nothing changed: drop newly constructed list. */
+ if (old_val == new_val)
+ return alist;
+
+ *tail = scm_acons (sub_sym, new_val, SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ }
+ else
+ {
+ /* old value is dropped. */
+ }
+
+ *tail = scm_cdr (s);
+ return new_list;
}
+
+ *tail = scm_acons (sub_sym, old_val, SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
}
- /*
- If we find more than one copy of the property
- push the new list, else it means we are trying to
- revert the original value
- */
- if (copy_count > 1)
- return new_list;
- else
- return alist;
+ /* Wanted symbol not found: drop newly constructed list. */
+ return alist;
}
-
void
set_nested_property (Grob *me, SCM big_to_small, SCM value)
{
me->set_property (scm_car (big_to_small), alist);
}
-
private:
SCM get_property_setting (Stream_event *evt, char const *evprop,
- char const *ctxprop);
+ char const *ctxprop);
string get_spanner_type (Stream_event *ev);
Drul_array<Stream_event *> accepted_spanevents_drul_;
SCM
New_dynamic_engraver::get_property_setting (Stream_event *evt,
- char const *evprop,
- char const *ctxprop)
+ char const *evprop,
+ char const *ctxprop)
{
SCM spanner_type = evt->get_property (evprop);
if (spanner_type == SCM_EOL)
{
if (current_spanner_
&& (accepted_spanevents_drul_[STOP]
- || script_event_
- || accepted_spanevents_drul_[START]))
+ || script_event_
+ || accepted_spanevents_drul_[START]))
{
Stream_event *ender = accepted_spanevents_drul_[STOP];
if (!ender)
- ender = script_event_;
+ ender = script_event_;
if (!ender)
- ender = accepted_spanevents_drul_[START];
+ ender = accepted_spanevents_drul_[START];
finished_spanner_ = current_spanner_;
announce_end_grob (finished_spanner_, ender->self_scm ());
string start_type = get_spanner_type (current_span_event_);
SCM cresc_type = get_property_setting (current_span_event_, "span-type",
- (start_type + "Spanner").c_str ());
+ (start_type + "Spanner").c_str ());
if (cresc_type == ly_symbol2scm ("text"))
- {
- current_spanner_
- = make_spanner ("DynamicTextSpanner",
- accepted_spanevents_drul_[START]->self_scm ());
-
- SCM text = get_property_setting (current_span_event_, "span-text",
- (start_type + "Text").c_str ());
- if (Text_interface::is_markup (text))
- current_spanner_->set_property ("text", text);
- /*
- If the line of a text spanner is hidden, end the alignment spanner
- early: this allows dynamics to be spaced individually instead of
- being linked together.
- */
- if (current_spanner_->get_property ("style") == ly_symbol2scm ("none"))
- current_spanner_->set_property ("spanner-broken", SCM_BOOL_T);
- }
+ {
+ current_spanner_
+ = make_spanner ("DynamicTextSpanner",
+ accepted_spanevents_drul_[START]->self_scm ());
+
+ SCM text = get_property_setting (current_span_event_, "span-text",
+ (start_type + "Text").c_str ());
+ if (Text_interface::is_markup (text))
+ current_spanner_->set_property ("text", text);
+ /*
+ If the line of a text spanner is hidden, end the alignment spanner
+ early: this allows dynamics to be spaced individually instead of
+ being linked together.
+ */
+ if (current_spanner_->get_property ("style") == ly_symbol2scm ("none"))
+ current_spanner_->set_property ("spanner-broken", SCM_BOOL_T);
+ }
else
- {
- if (cresc_type != ly_symbol2scm ("hairpin"))
- {
- string as_string = ly_scm_write_string (cresc_type);
- current_span_event_
- ->origin()->warning (_f ("unknown crescendo style: %s\ndefaulting to hairpin.", as_string.c_str()));
- }
- current_spanner_ = make_spanner ("Hairpin",
- current_span_event_->self_scm ());
- }
+ {
+ if (cresc_type != ly_symbol2scm ("hairpin"))
+ {
+ string as_string = ly_scm_write_string (cresc_type);
+ current_span_event_
+ ->origin ()->warning (_f ("unknown crescendo style: %s\ndefaulting to hairpin.", as_string.c_str ()));
+ }
+ current_spanner_ = make_spanner ("Hairpin",
+ current_span_event_->self_scm ());
+ }
// if we have a break-dynamic-span event right after the start dynamic, break the new spanner immediately
if (end_new_spanner_)
{
end_new_spanner_ = false;
}
if (finished_spanner_)
- {
- if (Hairpin::has_interface (finished_spanner_))
- Pointer_group_interface::add_grob (finished_spanner_,
- ly_symbol2scm ("adjacent-spanners"),
- current_spanner_);
- if (Hairpin::has_interface (current_spanner_))
- Pointer_group_interface::add_grob (current_spanner_,
- ly_symbol2scm ("adjacent-spanners"),
- finished_spanner_);
- }
+ {
+ if (Hairpin::has_interface (finished_spanner_))
+ Pointer_group_interface::add_grob (finished_spanner_,
+ ly_symbol2scm ("adjacent-spanners"),
+ current_spanner_);
+ if (Hairpin::has_interface (current_spanner_))
+ Pointer_group_interface::add_grob (current_spanner_,
+ ly_symbol2scm ("adjacent-spanners"),
+ finished_spanner_);
+ }
}
if (script_event_)
{
script_ = make_item ("DynamicText", script_event_->self_scm ());
script_->set_property ("text",
- script_event_->get_property ("text"));
+ script_event_->get_property ("text"));
if (finished_spanner_)
- finished_spanner_->set_bound (RIGHT, script_);
+ finished_spanner_->set_bound (RIGHT, script_);
if (current_spanner_)
- current_spanner_->set_bound (LEFT, script_);
+ current_spanner_->set_bound (LEFT, script_);
}
}
{
if (finished_spanner_ && !finished_spanner_->get_bound (RIGHT))
finished_spanner_
- ->set_bound (RIGHT,
- unsmob_grob (get_property ("currentMusicalColumn")));
+ ->set_bound (RIGHT,
+ unsmob_grob (get_property ("currentMusicalColumn")));
if (current_spanner_ && !current_spanner_->get_bound (LEFT))
current_spanner_
- ->set_bound (LEFT,
- unsmob_grob (get_property ("currentMusicalColumn")));
+ ->set_bound (LEFT,
+ unsmob_grob (get_property ("currentMusicalColumn")));
script_ = 0;
script_event_ = 0;
accepted_spanevents_drul_.set (0, 0);
if (current_spanner_)
{
current_span_event_
- ->origin ()->warning (_f ("unterminated %s",
- get_spanner_type (current_span_event_)
- .c_str ()));
+ ->origin ()->warning (_f ("unterminated %s",
+ get_spanner_type (current_span_event_)
+ .c_str ()));
current_spanner_->suicide ();
current_spanner_ = 0;
}
{
extract_grob_set (info.grob (), "note-heads", heads);
/*
- Spacing constraints may require dynamics to be aligned on rests,
- so check for a rest if this note column has no note heads.
+ Spacing constraints may require dynamics to be aligned on rests,
+ so check for a rest if this note column has no note heads.
*/
Grob *x_parent = (heads.size ()
- ? heads[0]
- : unsmob_grob (info.grob ()->get_object ("rest")));
+ ? heads[0]
+ : unsmob_grob (info.grob ()->get_object ("rest")));
if (x_parent)
- {
- script_->set_parent (x_parent, X_AXIS);
- Self_alignment_interface::set_center_parent (script_, X_AXIS);
- }
+ {
+ script_->set_parent (x_parent, X_AXIS);
+ Self_alignment_interface::set_center_parent (script_, X_AXIS);
+ }
}
if (current_spanner_ && !current_spanner_->get_bound (LEFT))
ADD_ACKNOWLEDGER (New_dynamic_engraver, note_column);
ADD_TRANSLATOR (New_dynamic_engraver,
- /* doc */
- "Create hairpins, dynamic texts and dynamic text spanners.",
-
- /* create */
- "DynamicTextSpanner "
- "DynamicText "
- "Hairpin ",
-
- /* read */
- "crescendoSpanner "
- "crescendoText "
- "currentMusicalColumn "
- "decrescendoSpanner "
- "decrescendoText ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create hairpins, dynamic texts and dynamic text spanners.",
+
+ /* create */
+ "DynamicTextSpanner "
+ "DynamicText "
+ "Hairpin ",
+
+ /* read */
+ "crescendoSpanner "
+ "crescendoText "
+ "currentMusicalColumn "
+ "decrescendoSpanner "
+ "decrescendoText ",
+
+ /* write */
+ ""
+ );
#include "translator.icc"
-
struct Finger_tuple
{
Grob *head_;
};
bool
-operator< (Finger_tuple const &a, Finger_tuple const &b)
+operator < (Finger_tuple const &a, Finger_tuple const &b)
{
return a.position_ < b.position_;
}
DECLARE_ACKNOWLEDGER (rhythmic_head);
DECLARE_ACKNOWLEDGER (stem);
void add_fingering (Grob *, SCM,
- vector<Finger_tuple> *,
- Stream_event *, Stream_event *);
+ vector<Finger_tuple> *,
+ Stream_event *, Stream_event *);
void add_script (Grob *, Stream_event *, Stream_event *);
void add_string (Grob *, Stream_event *, Stream_event *);
void position_scripts (SCM orientations, vector<Finger_tuple> *);
Stream_event *ev = unsmob_stream_event (scm_car (s));
if (!ev)
- continue;
+ continue;
if (ev->in_event_class ("fingering-event"))
- add_fingering (inf.grob (),
- ly_symbol2scm ("Fingering"),
- &fingerings_,
- ev, note_ev);
+ add_fingering (inf.grob (),
+ ly_symbol2scm ("Fingering"),
+ &fingerings_,
+ ev, note_ev);
else if (ev->in_event_class ("text-script-event"))
- ev->origin ()->warning (_ ("cannot add text scripts to individual note heads"));
+ ev->origin ()->warning (_ ("cannot add text scripts to individual note heads"));
else if (ev->in_event_class ("script-event"))
- add_script (inf.grob (), ev, note_ev);
+ add_script (inf.grob (), ev, note_ev);
else if (ev->in_event_class ("string-number-event"))
- add_fingering (inf.grob (),
- ly_symbol2scm ("StringNumber"), &string_numbers_,
- ev, note_ev);
+ add_fingering (inf.grob (),
+ ly_symbol2scm ("StringNumber"), &string_numbers_,
+ ev, note_ev);
else if (ev->in_event_class ("stroke-finger-event"))
- add_fingering (inf.grob (),
- ly_symbol2scm ("StrokeFinger"), &stroke_fingerings_,
- ev, note_ev);
+ add_fingering (inf.grob (),
+ ly_symbol2scm ("StrokeFinger"), &stroke_fingerings_,
+ ev, note_ev);
else if (ev->in_event_class ("harmonic-event"))
- {
- inf.grob ()->set_property ("style", ly_symbol2scm ("harmonic"));
- Grob *d = unsmob_grob (inf.grob ()->get_object ("dot"));
- if (d && !to_boolean (get_property ("harmonicDots")))
- d->suicide ();
- }
+ {
+ inf.grob ()->set_property ("style", ly_symbol2scm ("harmonic"));
+ Grob *d = unsmob_grob (inf.grob ()->get_object ("dot"));
+ if (d && !to_boolean (get_property ("harmonicDots")))
+ d->suicide ();
+ }
}
heads_.push_back (inf.grob ());
void
New_fingering_engraver::add_script (Grob *head,
- Stream_event *event,
- Stream_event * /* note */)
+ Stream_event *event,
+ Stream_event * /* note */)
{
Finger_tuple ft;
Grob *g = make_item ("Script", event->self_scm ());
make_script_from_event (g, context (),
- event->get_property ("articulation-type"), 0);
+ event->get_property ("articulation-type"), 0);
ft.script_ = g;
ft.script_->set_parent (head, X_AXIS);
void
New_fingering_engraver::add_fingering (Grob *head,
- SCM grob_sym,
- vector<Finger_tuple> *tuple_vector,
- Stream_event *event,
- Stream_event *hevent)
+ SCM grob_sym,
+ vector<Finger_tuple> *tuple_vector,
+ Stream_event *event,
+ Stream_event *hevent)
{
Finger_tuple ft;
ft.script_ = internal_make_item (grob_sym, event->self_scm (),
- ly_symbol2string (grob_sym).c_str (),
- __FILE__, __LINE__, __FUNCTION__);
+ ly_symbol2string (grob_sym).c_str (),
+ __FILE__, __LINE__, __FUNCTION__);
Side_position_interface::add_support (ft.script_, head);
void
New_fingering_engraver::position_scripts (SCM orientations,
- vector<Finger_tuple> *scripts)
+ vector<Finger_tuple> *scripts)
{
for (vsize i = 0; i < scripts->size (); i++)
if (stem_ && to_boolean (scripts->at (i).script_->get_property ("add-stem-support")))
{
SCM d = (*scripts)[i].finger_event_->get_property ("direction");
if (to_dir (d))
- {
- ((to_dir (d) == UP) ? up : down).push_back ((*scripts)[i]);
- scripts->erase (scripts->begin () + i);
- }
+ {
+ ((to_dir (d) == UP) ? up : down).push_back ((*scripts)[i]);
+ scripts->erase (scripts->begin () + i);
+ }
}
vector_sort (*scripts, less<Finger_tuple> ());
if (left_p || right_p)
{
if (up_p && !up.size () && scripts->size ())
- {
- up.push_back (scripts->back ());
- scripts->pop_back ();
- }
+ {
+ up.push_back (scripts->back ());
+ scripts->pop_back ();
+ }
if (down_p && !down.size () && scripts->size ())
- {
- down.push_back ((*scripts)[0]);
- scripts->erase (scripts->begin ());
- }
+ {
+ down.push_back ((*scripts)[0]);
+ scripts->erase (scripts->begin ());
+ }
horiz.insert (horiz.end (), scripts->begin (), scripts->end ());
}
else
{
if (!down_p)
- {
- warning (_ ("no placement found for fingerings"));
- warning (_ ("placing below"));
- }
+ {
+ warning (_ ("no placement found for fingerings"));
+ warning (_ ("placing below"));
+ }
down.insert (down.end (), scripts->begin (), scripts->end ());
scripts->clear ();
}
f->set_parent (ft.head_, Y_AXIS);
f->set_property ("avoid-slur", SCM_BOOL_F);
if (hordir == LEFT
- && unsmob_grob (ft.head_->get_object ("accidental-grob")))
- Side_position_interface::add_support (f,
- unsmob_grob (ft.head_->get_object ("accidental-grob")));
+ && unsmob_grob (ft.head_->get_object ("accidental-grob")))
+ Side_position_interface::add_support (f,
+ unsmob_grob (ft.head_->get_object ("accidental-grob")));
else if (unsmob_grob (ft.head_->get_object ("dot")))
- Side_position_interface::add_support (f,
- unsmob_grob (ft.head_->get_object ("dot")));
+ Side_position_interface::add_support (f,
+ unsmob_grob (ft.head_->get_object ("dot")));
Self_alignment_interface::set_align_self (f, Y_AXIS);
Self_alignment_interface::set_center_parent (f, Y_AXIS);
do
{
for (vsize i = 0; i < vertical[d].size (); i++)
- {
- Finger_tuple ft = vertical[d][i];
- Grob *f = ft.script_;
- int finger_prio = robust_scm2int (f->get_property ("script-priority"), 200);
- f->set_parent (ft.head_, X_AXIS);
- f->set_property ("script-priority",
- scm_from_int (finger_prio + d * ft.position_));
-
- Self_alignment_interface::set_align_self (f, X_AXIS);
- Self_alignment_interface::set_center_parent (f, X_AXIS);
- Side_position_interface::set_axis (f, Y_AXIS);
-
- f->set_property ("direction", scm_from_int (d));
- }
+ {
+ Finger_tuple ft = vertical[d][i];
+ Grob *f = ft.script_;
+ int finger_prio = robust_scm2int (f->get_property ("script-priority"), 200);
+ f->set_parent (ft.head_, X_AXIS);
+ f->set_property ("script-priority",
+ scm_from_int (finger_prio + d * ft.position_));
+
+ Self_alignment_interface::set_align_self (f, X_AXIS);
+ Self_alignment_interface::set_center_parent (f, X_AXIS);
+ Side_position_interface::set_axis (f, Y_AXIS);
+
+ f->set_property ("direction", scm_from_int (d));
+ }
}
while (flip (&d) != DOWN);
}
if (fingerings_.size ())
{
position_scripts (get_property ("fingeringOrientations"),
- &fingerings_);
+ &fingerings_);
fingerings_.clear ();
}
if (string_numbers_.size ())
{
position_scripts (get_property ("stringNumberOrientations"),
- &string_numbers_);
+ &string_numbers_);
string_numbers_.clear ();
}
if (stroke_fingerings_.size ())
{
position_scripts (get_property ("strokeFingerOrientations"),
- &stroke_fingerings_);
+ &stroke_fingerings_);
stroke_fingerings_.clear ();
}
Grob *script = articulations_[i].script_;
for (vsize j = heads_.size (); j--;)
- Side_position_interface::add_support (script, heads_[j]);
+ Side_position_interface::add_support (script, heads_[j]);
if (stem_ && to_dir (script->get_property ("side-relative-direction")))
- script->set_object ("direction-source", stem_->self_scm ());
+ script->set_object ("direction-source", stem_->self_scm ());
if (stem_ && to_boolean (script->get_property ("add-stem-support")))
- Side_position_interface::add_support (script, stem_);
+ Side_position_interface::add_support (script, stem_);
}
articulations_.clear ();
}
ADD_ACKNOWLEDGER (New_fingering_engraver, stem);
ADD_TRANSLATOR (New_fingering_engraver,
- /* doc */
- "Create fingering scripts for notes in a new chord. This"
- " engraver is ill-named, since it also takes care of"
- " articulations and harmonic note heads.",
-
- /* create */
- "Fingering "
- "StringNumber "
- "StrokeFinger "
- "Script ",
-
- /* read */
- "fingeringOrientations "
- "harmonicDots "
- "strokeFingerOrientations "
- "stringNumberOrientations ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create fingering scripts for notes in a new chord. This"
+ " engraver is ill-named, since it also takes care of"
+ " articulations and harmonic note heads.",
+
+ /* create */
+ "Fingering "
+ "StringNumber "
+ "StrokeFinger "
+ "Script ",
+
+ /* read */
+ "fingeringOrientations "
+ "harmonicDots "
+ "strokeFingerOrientations "
+ "stringNumberOrientations ",
+
+ /* write */
+ ""
+ );
#include "stem.hh"
#include "warn.hh"
-
void
check_meshing_chords (Grob *me,
- Drul_array<vector<Real> > *offsets,
- Drul_array<vector<Slice> > const &extents,
- Drul_array<vector<Grob*> > const &clash_groups)
+ Drul_array<vector<Real> > *offsets,
+ Drul_array<vector<Slice> > const &extents,
+ Drul_array<vector<Grob *> > const &clash_groups)
{
if (!extents[UP].size () || !extents[DOWN].size ())
if (!Note_column::get_stem (clash_up) || !Note_column::get_stem (clash_down))
return;
- Drul_array<Grob*> stems (Note_column::get_stem (clash_down),
- Note_column::get_stem (clash_up));
+ Drul_array<Grob *> stems (Note_column::get_stem (clash_down),
+ Note_column::get_stem (clash_up));
Grob *head_up = Note_column::first_head (clash_up);
Grob *head_down = Note_column::first_head (clash_down);
/* Do not merge notes typeset in different style. */
if (!ly_is_equal (head_up->get_property ("style"),
- head_down->get_property ("style")))
+ head_down->get_property ("style")))
merge_possible = false;
int up_ball_type = Rhythmic_head::duration_log (head_up);
them indistinguishable. */
if (merge_possible
&& ((Stem::duration_log (stems[UP]) == 1
- && Stem::duration_log (stems[DOWN]) == 2)
- || (Stem::duration_log (stems[UP]) == 2
- && Stem::duration_log (stems[DOWN]) == 1)))
+ && Stem::duration_log (stems[DOWN]) == 2)
+ || (Stem::duration_log (stems[UP]) == 2
+ && Stem::duration_log (stems[DOWN]) == 1)))
merge_possible = false;
/*
bool distant_half_collide = false;
bool full_collide = false;
- for (vsize i = 0, j = 0; i < ups.size () && j < dps.size (); )
+ for (vsize i = 0, j = 0; i < ups.size () && j < dps.size ();)
{
if (abs (ups[i] - dps[j]) == 1)
- {
- merge_possible = false;
- if (ups[i] > dps[j])
- close_half_collide = true;
- else
- distant_half_collide = true;
- }
+ {
+ merge_possible = false;
+ if (ups[i] > dps[j])
+ close_half_collide = true;
+ else
+ distant_half_collide = true;
+ }
else if (ups[i] == dps[j])
- full_collide = true;
+ full_collide = true;
else if (ups[i] > dps[0] && ups[i] < dps.back ())
- merge_possible = false;
+ merge_possible = false;
else if (dps[j] > ups[0] && dps[j] < ups.back ())
- merge_possible = false;
+ merge_possible = false;
if (ups[i] < dps[j])
- i++;
+ i++;
else if (ups[i] > dps[j])
- j++;
+ j++;
else
- {
- i++;
- j++;
- }
+ {
+ i++;
+ j++;
+ }
}
full_collide = full_collide || (close_half_collide
- && distant_half_collide);
+ && distant_half_collide);
Real shift_amount = 1;
the top note of which is the same pitch as the lowest upstem note, they
shouldn't count as touching.
*/
- if (dps.back () == ups[0] && dps.size () > 1 && dps[dps.size() - 2] == ups[0] - 1)
+ if (dps.back () == ups[0] && dps.size () > 1 && dps[dps.size () - 2] == ups[0] - 1)
touch = false;
if (touch)
if (full_collide)
{
if (Rhythmic_head::dot_count (head_up) > Rhythmic_head::dot_count (head_down))
- shift_amount = 1;
+ shift_amount = 1;
else if (Rhythmic_head::dot_count (head_up) < Rhythmic_head::dot_count (head_down))
- stem_to_stem = true;
+ stem_to_stem = true;
}
/* The solfa is a triangle, which is inverted depending on stem
shift_amount = 0;
/* If possible, don't wipe any heads. Else, wipe shortest head,
- or head with smallest amount of dots. Note: when merging
- different heads, dots on the smaller one disappear. */
+ or head with smallest amount of dots. Note: when merging
+ different heads, dots on the smaller one disappear. */
Grob *wipe_ball = 0;
Grob *dot_wipe_head = head_up;
if (up_ball_type == down_ball_type)
- {
- if (Rhythmic_head::dot_count (head_down) < Rhythmic_head::dot_count (head_up))
- {
- wipe_ball = head_down;
- dot_wipe_head = head_down;
- }
- else if (Rhythmic_head::dot_count (head_down) > Rhythmic_head::dot_count (head_up))
- {
- dot_wipe_head = head_up;
- wipe_ball = head_up;
- }
- else
- dot_wipe_head = head_up;
- }
+ {
+ if (Rhythmic_head::dot_count (head_down) < Rhythmic_head::dot_count (head_up))
+ {
+ wipe_ball = head_down;
+ dot_wipe_head = head_down;
+ }
+ else if (Rhythmic_head::dot_count (head_down) > Rhythmic_head::dot_count (head_up))
+ {
+ dot_wipe_head = head_up;
+ wipe_ball = head_up;
+ }
+ else
+ dot_wipe_head = head_up;
+ }
else if (down_ball_type > up_ball_type)
- {
- wipe_ball = head_down;
- dot_wipe_head = head_down;
- }
+ {
+ wipe_ball = head_down;
+ dot_wipe_head = head_down;
+ }
else if (down_ball_type < up_ball_type)
- {
- wipe_ball = head_up;
- dot_wipe_head = head_up;
- /*
- If upper head is eighth note or shorter, and lower head is half note,
- shift by the difference between the open and filled note head widths,
- otherwise upper stem will be misaligned slightly.
- */
- if (Stem::duration_log (stems[DOWN]) == 1
- && Stem::duration_log (stems[UP]) >= 3)
- shift_amount = (1 - head_up->extent (head_up, X_AXIS).length () /
- head_down->extent (head_down, X_AXIS).length ()) * 0.5;
- }
+ {
+ wipe_ball = head_up;
+ dot_wipe_head = head_up;
+ /*
+ If upper head is eighth note or shorter, and lower head is half note,
+ shift by the difference between the open and filled note head widths,
+ otherwise upper stem will be misaligned slightly.
+ */
+ if (Stem::duration_log (stems[DOWN]) == 1
+ && Stem::duration_log (stems[UP]) >= 3)
+ shift_amount = (1 - head_up->extent (head_up, X_AXIS).length ()
+ / head_down->extent (head_down, X_AXIS).length ()) * 0.5;
+ }
if (dot_wipe_head)
- {
- if (Grob *d = unsmob_grob (dot_wipe_head->get_object ("dot")))
- d->suicide ();
- }
+ {
+ if (Grob *d = unsmob_grob (dot_wipe_head->get_object ("dot")))
+ d->suicide ();
+ }
if (wipe_ball && wipe_ball->is_live ())
- wipe_ball->set_property ("transparent", SCM_BOOL_T);
+ wipe_ball->set_property ("transparent", SCM_BOOL_T);
}
/* TODO: these numbers are magic; should devise a set of grob props
to tune this behavior. */
shift_amount *= 0.17;
/*
-
*/
if (full_collide
- && down_ball_type * up_ball_type == 0)
+ && down_ball_type *up_ball_type == 0)
{
if (up_ball_type == 0 && down_ball_type == 1)
- shift_amount *= 1.25;
+ shift_amount *= 1.25;
else if (up_ball_type == 0 && down_ball_type == 2)
- shift_amount *= 1.35;
+ shift_amount *= 1.35;
else if (down_ball_type == 0 && up_ball_type == 1)
- shift_amount *= 0.7;
+ shift_amount *= 0.7;
else if (down_ball_type == 0 && up_ball_type == 2)
- shift_amount *= 0.75;
+ shift_amount *= 0.75;
}
/*
{
Grob *staff = Staff_symbol_referencer::get_staff_symbol (me);
if (!Staff_symbol_referencer::on_line (staff, ups[0]))
- {
- /*
- TODO: consider junking the else body.
- */
- if (to_boolean (me->get_property ("prefer-dotted-right")))
- shift_amount = 0.5;
- else
- {
- Grob *d = unsmob_grob (head_up->get_object ("dot"));
- Grob *parent = d->get_parent (X_AXIS);
- if (Dot_column::has_interface (parent))
- Side_position_interface::add_support (parent, head_down);
- }
- }
+ {
+ /*
+ TODO: consider junking the else body.
+ */
+ if (to_boolean (me->get_property ("prefer-dotted-right")))
+ shift_amount = 0.5;
+ else
+ {
+ Grob *d = unsmob_grob (head_up->get_object ("dot"));
+ Grob *parent = d->get_parent (X_AXIS);
+ if (Dot_column::has_interface (parent))
+ Side_position_interface::add_support (parent, head_down);
+ }
+ }
}
/* For full or close half collisions, the right hand head may
Grob *parent = d->get_parent (X_AXIS);
/*
- FIXME:
+ FIXME:
- |
- x . o
- |
+ |
+ x . o
+ |
- the . is put right of o which is erroneous o force-shifted
- far to the right.
+ the . is put right of o which is erroneous o force-shifted
+ far to the right.
*/
if (Dot_column::has_interface (parent))
- {
- Grob *stem = unsmob_grob (head_up->get_object ("stem"));
- extract_grob_set (stem, "note-heads", heads);
- for (vsize i = 0; i < heads.size (); i++)
- Side_position_interface::add_support (parent, heads[i]);
- }
+ {
+ Grob *stem = unsmob_grob (head_up->get_object ("stem"));
+ extract_grob_set (stem, "note-heads", heads);
+ for (vsize i = 0; i < heads.size (); i++)
+ Side_position_interface::add_support (parent, heads[i]);
+ }
}
Direction d = UP;
do
{
for (vsize i = 0; i < clash_groups[d].size (); i++)
- (*offsets)[d][i] += d * shift_amount;
+ (*offsets)[d][i] += d * shift_amount;
}
while ((flip (&d)) != UP);
}
-
MAKE_SCHEME_CALLBACK (Note_collision_interface, calc_positioning_done, 1)
SCM
Note_collision_interface::calc_positioning_done (SCM smob)
Grob *me = unsmob_grob (smob);
me->set_property ("positioning-done", SCM_BOOL_T);
- Drul_array<vector<Grob*> > clash_groups = get_clash_groups (me);
+ Drul_array<vector<Grob *> > clash_groups = get_clash_groups (me);
Direction d = UP;
do
{
- for (vsize i = clash_groups[d].size (); i--; )
- {
- /*
- Trigger positioning
- */
- clash_groups[d][i]->extent (me, X_AXIS);
- }
+ for (vsize i = clash_groups[d].size (); i--;)
+ {
+ /*
+ Trigger positioning
+ */
+ clash_groups[d][i]->extent (me, X_AXIS);
+ }
}
while (flip (&d) != UP);
do
{
if (clash_groups[d].size ())
- {
- Grob *h = clash_groups[d][0];
- Grob *fh = Note_column::first_head (h);
- if (fh)
- wid = fh->extent (h, X_AXIS).length ();
- }
+ {
+ Grob *h = clash_groups[d][0];
+ Grob *fh = Note_column::first_head (h);
+ if (fh)
+ wid = fh->extent (h, X_AXIS).length ();
+ }
}
while (flip (&d) != UP);
- vector<Grob*> done;
+ vector<Grob *> done;
Real left_most = 1e6;
vector<Real> amounts;
done.push_back (s);
amounts.push_back (amount);
if (amount < left_most)
- left_most = amount;
+ left_most = amount;
}
for (; scm_is_pair (autos); autos = scm_cdr (autos))
{
vsize x = find (done, s) - done.begin ();
if (x == VPOS || x >= done.size ())
- {
- done.push_back (s);
- amounts.push_back (amount);
- if (amount < left_most)
- left_most = amount;
- }
+ {
+ done.push_back (s);
+ amounts.push_back (amount);
+ if (amount < left_most)
+ left_most = amount;
+ }
}
for (vsize i = 0; i < amounts.size (); i++)
return SCM_BOOL_T;
}
-Drul_array < vector<Grob*> >
+Drul_array < vector<Grob *> >
Note_collision_interface::get_clash_groups (Grob *me)
{
- Drul_array<vector<Grob*> > clash_groups;
+ Drul_array<vector<Grob *> > clash_groups;
extract_grob_set (me, "elements", elements);
for (vsize i = 0; i < elements.size (); i++)
{
Grob *se = elements[i];
if (Note_column::has_interface (se))
- {
- if (!Note_column::dir (se))
- se->programming_error ("note-column has no direction");
- else
- clash_groups[Note_column::dir (se)].push_back (se);
- }
+ {
+ if (!Note_column::dir (se))
+ se->programming_error ("note-column has no direction");
+ else
+ clash_groups[Note_column::dir (se)].push_back (se);
+ }
}
Direction d = UP;
do
{
- vector<Grob*> &clashes (clash_groups[d]);
+ vector<Grob *> &clashes (clash_groups[d]);
vector_sort (clashes, Note_column::shift_less);
}
while ((flip (&d)) != UP);
*/
SCM
Note_collision_interface::automatic_shift (Grob *me,
- Drul_array<vector<Grob*> > clash_groups)
+ Drul_array<vector<Grob *> > clash_groups)
{
Drul_array < vector<int> > shifts;
SCM tups = SCM_EOL;
do
{
vector<int> &shift (shifts[d]);
- vector<Grob*> &clashes (clash_groups[d]);
+ vector<Grob *> &clashes (clash_groups[d]);
for (vsize i = 0; i < clashes.size (); i++)
- {
- SCM sh
- = clashes[i]->get_property ("horizontal-shift");
+ {
+ SCM sh
+ = clashes[i]->get_property ("horizontal-shift");
- if (scm_is_number (sh))
- shift.push_back (scm_to_int (sh));
- else
- shift.push_back (0);
- }
+ if (scm_is_number (sh))
+ shift.push_back (scm_to_int (sh));
+ else
+ shift.push_back (0);
+ }
for (vsize i = 1; i < shift.size (); i++)
- {
- if (shift[i - 1] == shift[i])
- {
- clashes[0]->warning (_ ("ignoring too many clashing note columns"));
- return tups;
- }
- }
+ {
+ if (shift[i - 1] == shift[i])
+ {
+ clashes[0]->warning (_ ("ignoring too many clashing note columns"));
+ return tups;
+ }
+ }
}
while ((flip (&d)) != UP);
do
{
for (vsize i = 0; i < clash_groups[d].size (); i++)
- {
- Slice s (Note_column::head_positions_interval (clash_groups[d][i]));
- s[LEFT]--;
- s[RIGHT]++;
- extents[d].push_back (s);
- offsets[d].push_back (d * 0.5 * i);
- }
+ {
+ Slice s (Note_column::head_positions_interval (clash_groups[d][i]));
+ s[LEFT]--;
+ s[RIGHT]++;
+ extents[d].push_back (s);
+ offsets[d].push_back (d * 0.5 * i);
+ }
}
while ((flip (&d)) != UP);
do
{
for (vsize i = 1; i < clash_groups[d].size (); i++)
- {
- Slice prev = extents[d][i - 1];
- prev.intersect (extents[d][i]);
- if (prev.length () > 0
- || (extents[-d].size () && d * (extents[d][i][-d] - extents[-d][0][d]) < 0))
- for (vsize j = i; j < clash_groups[d].size (); j++)
- offsets[d][j] += d * 0.5;
- }
+ {
+ Slice prev = extents[d][i - 1];
+ prev.intersect (extents[d][i]);
+ if (prev.length () > 0
+ || (extents[-d].size () && d * (extents[d][i][-d] - extents[-d][0][d]) < 0))
+ for (vsize j = i; j < clash_groups[d].size (); j++)
+ offsets[d][j] += d * 0.5;
+ }
}
while ((flip (&d)) != UP);
-
/*
see input/regression/dot-up-voice-collision.ly
*/
Grob *dc = Note_column::dot_column (g);
if (dc)
- for (vsize j = i + 1; j < clash_groups[UP].size (); j++)
- {
- Grob *stem = Note_column::get_stem (clash_groups[UP][j]);
- Side_position_interface::add_support (dc, stem);
- }
+ for (vsize j = i + 1; j < clash_groups[UP].size (); j++)
+ {
+ Grob *stem = Note_column::get_stem (clash_groups[UP][j]);
+ Side_position_interface::add_support (dc, stem);
+ }
}
/*
do
{
for (vsize i = 0; i < clash_groups[d].size (); i++)
- tups = scm_cons (scm_cons (clash_groups[d][i]->self_scm (),
- scm_from_double (offsets[d][i])),
- tups);
+ tups = scm_cons (scm_cons (clash_groups[d][i]->self_scm (),
+ scm_from_double (offsets[d][i])),
+ tups);
}
while (flip (&d) != UP);
SCM force = se->get_property ("force-hshift");
if (scm_is_number (force))
- tups = scm_cons (scm_cons (se->self_scm (), force),
- tups);
+ tups = scm_cons (scm_cons (se->self_scm (), force),
+ tups);
}
return tups;
}
}
ADD_INTERFACE (Note_collision_interface,
- "An object that handles collisions between notes with"
- " different stem directions and horizontal shifts. Most of"
- " the interesting properties are to be set in"
- " @ref{note-column-interface}: these are @code{force-hshift}"
- " and @code{horizontal-shift}.",
-
- /* properties */
- "merge-differently-dotted "
- "merge-differently-headed "
- "positioning-done "
- "prefer-dotted-right "
- );
+ "An object that handles collisions between notes with"
+ " different stem directions and horizontal shifts. Most of"
+ " the interesting properties are to be set in"
+ " @ref{note-column-interface}: these are @code{force-hshift}"
+ " and @code{horizontal-shift}.",
+
+ /* properties */
+ "merge-differently-dotted "
+ "merge-differently-headed "
+ "positioning-done "
+ "prefer-dotted-right "
+ );
LilyPond is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+ along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
#include "note-column.hh"
#include "grob.hh"
LY_DEFINE (ly_note_column_accidentals, "ly:note-column-accidentals",
- 1, 0, 0, (SCM note_column),
- "Return the @code{AccidentalPlacement} grob from @var{note-column}"
- " if any, or @code{SCM_EOL} otherwise.")
+ 1, 0, 0, (SCM note_column),
+ "Return the @code{AccidentalPlacement} grob from @var{note-column}"
+ " if any, or @code{SCM_EOL} otherwise.")
{
Grob *grob = unsmob_grob (note_column);
LY_ASSERT_SMOB (Grob, note_column, 1);
}
LY_DEFINE (ly_note_column_dot_column, "ly:note-column-dot-column",
- 1, 0, 0, (SCM note_column),
- "Return the @code{DotColumn} grob from @var{note-column}"
- " if any, or @code{SCM_EOL} otherwise.")
+ 1, 0, 0, (SCM note_column),
+ "Return the @code{DotColumn} grob from @var{note-column}"
+ " if any, or @code{SCM_EOL} otherwise.")
{
Grob *grob = unsmob_grob (note_column);
LY_ASSERT_SMOB (Grob, note_column, 1);
#include "note-column.hh"
-#include <cmath> // ceil
+#include <cmath> // ceil
using namespace std;
#include "accidental-placement.hh"
{
extract_grob_set (me, "note-heads", heads);
if (heads.size ())
- return (Direction)sign (head_positions_interval (me).center ());
+ return (Direction)sign (head_positions_interval (me).center ());
}
programming_error ("note column without heads and stem");
{
extract_grob_set (me, "note-heads", heads);
if (heads.size ())
- both = true;
+ both = true;
else
- me->set_object ("rest", h->self_scm ());
+ me->set_object ("rest", h->self_scm ());
}
else if (Note_head::has_interface (h))
{
if (unsmob_grob (me->get_object ("rest")))
- both = true;
+ both = true;
Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-heads"), h);
}
Grob *h = heads[i];
acc = h ? unsmob_grob (h->get_object ("accidental-grob")) : 0;
if (acc)
- break;
+ break;
}
if (!acc)
{
Grob *dots = unsmob_grob (heads[i]->get_object ("dot"));
if (dots)
- return dots->get_parent (X_AXIS);
+ return dots->get_parent (X_AXIS);
}
return 0;
}
ADD_INTERFACE (Note_column,
- "Stem and noteheads combined.",
-
- /* properties */
- "arpeggio "
- "force-hshift "
- "horizontal-shift "
- "ignore-collision "
- "note-heads "
- "rest "
- "rest-collision "
- "stem "
- );
+ "Stem and noteheads combined.",
+
+ /* properties */
+ "arpeggio "
+ "force-hshift "
+ "horizontal-shift "
+ "ignore-collision "
+ "note-heads "
+ "rest "
+ "rest-collision "
+ "stem "
+ );
#include "spanner.hh"
#include "item.hh"
-
/**
Create line-spanner grobs for lines that connect note heads.
Should probably store follow_ in line_, and suicide at some
later point */
if (follow_)
- line_ = make_spanner ("VoiceFollower", head_->self_scm ());
+ line_ = make_spanner ("VoiceFollower", head_->self_scm ());
line_->set_bound (LEFT, last_head_);
line_->set_bound (RIGHT, head_);
ADD_ACKNOWLEDGER (Note_head_line_engraver, rhythmic_head);
ADD_TRANSLATOR (Note_head_line_engraver,
- /* doc */
- "Engrave a line between two note heads, for example a"
- " glissando. If @code{followVoice} is set, staff switches"
- " also generate a line.",
+ /* doc */
+ "Engrave a line between two note heads, for example a"
+ " glissando. If @code{followVoice} is set, staff switches"
+ " also generate a line.",
- /* create */
- "Glissando "
- "VoiceFollower ",
+ /* create */
+ "Glissando "
+ "VoiceFollower ",
- /* read */
- "followVoice ",
+ /* read */
+ "followVoice ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "note-head.hh"
#include "font-metric.hh"
-
LY_DEFINE (ly_note_head__stem_attachment, "ly:note-head::stem-attachment",
- 2, 0, 0, (SCM font_metric, SCM glyph_name),
- "Get attachment in @var{font-metric} for attaching a stem to"
- " notehead @var{glyph-name}.")
+ 2, 0, 0, (SCM font_metric, SCM glyph_name),
+ "Get attachment in @var{font-metric} for attaching a stem to"
+ " notehead @var{glyph-name}.")
{
LY_ASSERT_SMOB (Font_metric, font_metric, 1);
Font_metric *fm = unsmob_metrics (font_metric);
LY_ASSERT_TYPE (scm_is_string, glyph_name, 2);
-
+
return ly_offset2scm (Note_head::get_stem_attachment (fm, ly_scm2string (glyph_name)));
}
#include <cmath>
#include <cctype>
-#include <algorithm> // min, max
+#include <algorithm> // min, max
using namespace std;
{
SCM gn = me->get_property ("glyph-name");
if (scm_is_string (gn))
- suffix = ly_scm2string (gn);
+ suffix = ly_scm2string (gn);
}
Font_metric *fm = Font_interface::get_default_font (me);
Grob *stem = unsmob_grob (me->get_object ("stem"));
Direction stem_dir = stem ? get_grob_direction (stem) : CENTER;
-
+
if (stem_dir == CENTER)
- programming_error ("must have stem dir for note head");
-
- idx_directed = idx_either =
- prefix + ((stem_dir == UP) ? "u" : "d") + suffix;
+ programming_error ("must have stem dir for note head");
+
+ idx_directed = idx_either
+ = prefix + ((stem_dir == UP) ? "u" : "d") + suffix;
out = fm->find_by_name (idx_directed);
}
-
if (out.is_empty ())
{
me->warning (_f ("none of note heads `%s' or `%s' found",
- idx_symmetric.c_str (), idx_directed.c_str ()));
+ idx_symmetric.c_str (), idx_directed.c_str ()));
out = Stencil (Box (Interval (0, 0), Interval (0, 0)), SCM_EOL);
}
else
}
/*
- TODO: make stem X-parent of notehead.
+ TODO: make stem X-parent of notehead.
*/
MAKE_SCHEME_CALLBACK (Note_head, stem_x_shift, 1);
SCM
// the interval between the note and the first ledger line, not
// the whole interval between the note and the staff.
Interval iv (min (0.0, lines[UP] - my_ext[DOWN] + 1),
- max (0.0, lines[DOWN] - my_ext[UP] - 1));
+ max (0.0, lines[DOWN] - my_ext[UP] - 1));
return ly_interval2scm (iv);
}
Note_head::stem_attachment_coordinate (Grob *me, Axis a)
{
Offset off = robust_scm2offset (me->get_property ("stem-attachment"),
- Offset (0,0));
-
+ Offset (0, 0));
+
return off [a];
}
Note_head::get_stem_attachment (Font_metric *fm, string key)
{
Offset att;
-
+
int k = fm->name_to_index (key);
if (k >= 0)
{
Box b = fm->get_indexed_char_dimensions (k);
Offset wxwy = fm->attachment_point (key);
- for (int i = X_AXIS ; i < NO_AXES; i++)
- {
- Axis a = Axis (i);
-
- Interval v = b[a];
- if (!v.is_empty ())
- {
- att[a] = (2 * (wxwy[a] - v.center ()) / v.length ());
- }
- }
+ for (int i = X_AXIS; i < NO_AXES; i++)
+ {
+ Axis a = Axis (i);
+
+ Interval v = b[a];
+ if (!v.is_empty ())
+ {
+ att[a] = (2 * (wxwy[a] - v.center ()) / v.length ());
+ }
+ }
}
return att;
SCM
Note_head::calc_stem_attachment (SCM smob)
{
- Grob *me = unsmob_grob (smob);
+ Grob *me = unsmob_grob (smob);
Font_metric *fm = Font_interface::get_default_font (me);
string key;
internal_print (me, &key);
return ly_offset2scm (get_stem_attachment (fm, key));
}
-
ADD_INTERFACE (Note_head,
- "A note head. There are many possible values for"
- " @code{style}. For a complete list, see"
- " @ruser{Note head styles}.",
-
- /* properties */
- "note-names "
- "accidental-grob "
- "glyph-name "
- "stem-attachment "
- "style "
- );
+ "A note head. There are many possible values for"
+ " @code{style}. For a complete list, see"
+ " @ruser{Note head styles}.",
+
+ /* properties */
+ "note-names "
+ "accidental-grob "
+ "glyph-name "
+ "stem-attachment "
+ "style "
+ );
#if 0 /* TODO: should have a mechanism to switch off these warnings. */
if (!pit)
- ev->origin ()->warning (_ ("NoteEvent without pitch"));
+ ev->origin ()->warning (_ ("NoteEvent without pitch"));
#endif
int pos;
if (pit == 0)
- pos = 0;
+ pos = 0;
else if (ly_is_procedure (layout_proc))
- {
- SCM pitch = ev->get_property ("pitch");
- pos = scm_to_int (scm_call_1 (layout_proc, pitch));
- }
+ {
+ SCM pitch = ev->get_property ("pitch");
+ pos = scm_to_int (scm_call_1 (layout_proc, pitch));
+ }
else
- pos = pit->steps ();
+ pos = pit->steps ();
if (scm_is_number (c0))
- pos += scm_to_int (c0);
+ pos += scm_to_int (c0);
note->set_property ("staff-position", scm_from_int (pos));
/*
- Shape note heads change on step of the scale.
+ Shape note heads change on step of the scale.
*/
SCM shape_vector = get_property ("shapeNoteStyles");
if (scm_is_vector (shape_vector))
- {
- SCM scm_tonic = get_property ("tonic");
- Pitch tonic (0, 0, 0);
- if (unsmob_pitch (scm_tonic))
- tonic = *unsmob_pitch (scm_tonic);
-
- unsigned int delta = (pit->get_notename () - tonic.get_notename () + 7) % 7;
-
- SCM style = SCM_EOL;
- if (scm_c_vector_length (shape_vector) > delta
- && scm_is_symbol (scm_vector_ref (shape_vector, scm_from_int (delta))))
- style = scm_vector_ref (shape_vector, scm_from_int (delta));
- if (scm_is_symbol (style))
- note->set_property ("style", style);
- }
+ {
+ SCM scm_tonic = get_property ("tonic");
+ Pitch tonic (0, 0, 0);
+ if (unsmob_pitch (scm_tonic))
+ tonic = *unsmob_pitch (scm_tonic);
+
+ unsigned int delta = (pit->get_notename () - tonic.get_notename () + 7) % 7;
+
+ SCM style = SCM_EOL;
+ if (scm_c_vector_length (shape_vector) > delta
+ && scm_is_symbol (scm_vector_ref (shape_vector, scm_from_int (delta))))
+ style = scm_vector_ref (shape_vector, scm_from_int (delta));
+ if (scm_is_symbol (style))
+ note->set_property ("style", style);
+ }
}
}
}
ADD_TRANSLATOR (Note_heads_engraver,
- /* doc */
- "Generate note heads.",
+ /* doc */
+ "Generate note heads.",
- /* create */
- "NoteHead ",
+ /* create */
+ "NoteHead ",
- /* read */
- "middleCPosition "
- "staffLineLayoutFunction ",
+ /* read */
+ "middleCPosition "
+ "staffLineLayoutFunction ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
for (vsize i = 0; i < events_.size (); i++)
{
if (i)
- s += " ";
+ s += " ";
Pitch p = *unsmob_pitch (events_[i]->get_property ("pitch"));
if (!to_boolean (get_property ("printOctaveNames")))
- p = Pitch (-1, p.get_notename (), p.get_alteration ());
+ p = Pitch (-1, p.get_notename (), p.get_alteration ());
s += p.to_string ();
}
}
ADD_TRANSLATOR (Note_name_engraver,
- /* doc */
- "Print pitches as words.",
+ /* doc */
+ "Print pitches as words.",
- /* create */
- "NoteName ",
+ /* create */
+ "NoteName ",
- /* read */
- "printOctaveNames ",
+ /* read */
+ "printOctaveNames ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
DECLARE_TRANSLATOR_LISTENER (note);
private:
- vector<Stream_event*> note_evs_;
- vector<Audio_note*> notes_;
+ vector<Stream_event *> note_evs_;
+ vector<Audio_note *> notes_;
-
- vector<Audio_note*> last_notes_;
+ vector<Audio_note *> last_notes_;
Moment last_start_;
-
+
};
void
if (unsmob_pitch (prop))
transposing = *unsmob_pitch (prop);
- for (vsize i = 0; i < note_evs_.size (); i ++)
+ for (vsize i = 0; i < note_evs_.size (); i++)
{
Stream_event *n = note_evs_[i];
SCM pit = n->get_property ("pitch");
if (Pitch *pitp = unsmob_pitch (pit))
- {
- SCM articulations = n->get_property ("articulations");
- Stream_event *tie_event = 0;
- for (SCM s = articulations;
- !tie_event && scm_is_pair (s);
- s = scm_cdr (s))
- {
- Stream_event *ev = unsmob_stream_event (scm_car (s));
- if (!ev)
- continue;
-
- if (ev->in_event_class ("tie-event"))
- tie_event = ev;
- }
-
- Moment len = get_event_length (n, now_mom ());
-
- Audio_note *p = new Audio_note (*pitp, len,
- tie_event, transposing.negated ());
- Audio_element_info info (p, n);
- announce_element (info);
- notes_.push_back (p);
-
- /*
- shorten previous note.
- */
- if (now_mom ().grace_part_)
- {
- if (last_start_.grace_part_ == Rational (0))
- {
- for (vsize i = 0; i < last_notes_.size (); i++)
- last_notes_[i]->length_mom_ += Moment (0,
- now_mom().grace_part_);
- }
- }
- }
+ {
+ SCM articulations = n->get_property ("articulations");
+ Stream_event *tie_event = 0;
+ for (SCM s = articulations;
+ !tie_event && scm_is_pair (s);
+ s = scm_cdr (s))
+ {
+ Stream_event *ev = unsmob_stream_event (scm_car (s));
+ if (!ev)
+ continue;
+
+ if (ev->in_event_class ("tie-event"))
+ tie_event = ev;
+ }
+
+ Moment len = get_event_length (n, now_mom ());
+
+ Audio_note *p = new Audio_note (*pitp, len,
+ tie_event, transposing.negated ());
+ Audio_element_info info (p, n);
+ announce_element (info);
+ notes_.push_back (p);
+
+ /*
+ shorten previous note.
+ */
+ if (now_mom ().grace_part_)
+ {
+ if (last_start_.grace_part_ == Rational (0))
+ {
+ for (vsize i = 0; i < last_notes_.size (); i++)
+ last_notes_[i]->length_mom_ += Moment (0,
+ now_mom ().grace_part_);
+ }
+ }
+ }
}
}
}
ADD_TRANSLATOR (Note_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Note_performer::Note_performer ()
{
class Note_spacing_engraver : public Engraver
{
- typedef map <Context*, Grob*> Last_spacing_map;
+ typedef map <Context *, Grob *> Last_spacing_map;
Last_spacing_map last_spacings_;
Grob *last_spacing_;
-
+
Grob *spacing_;
void add_spacing_item (Grob *);
{
spacing_ = make_item ("NoteSpacing", g->self_scm ());
}
-
+
if (spacing_)
{
Pointer_group_interface::add_grob (spacing_,
- ly_symbol2scm ("left-items"),
- g);
+ ly_symbol2scm ("left-items"),
+ g);
if (last_spacing_)
- Pointer_group_interface::add_grob (last_spacing_,
- ly_symbol2scm ("right-items"),
- g);
+ Pointer_group_interface::add_grob (last_spacing_,
+ ly_symbol2scm ("right-items"),
+ g);
}
}
-
void
Note_spacing_engraver::acknowledge_note_column (Grob_info gi)
{
if (last_spacing
&& !unsmob_grob_array (last_spacing->get_object ("right-items")))
{
- Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
-
+ Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
+
Pointer_group_interface::add_grob (last_spacing,
- ly_symbol2scm ("right-items"),
- col);
+ ly_symbol2scm ("right-items"),
+ col);
}
}
{
Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
Pointer_group_interface::add_grob (last_spacing,
- ly_symbol2scm ("right-items"),
- col);
+ ly_symbol2scm ("right-items"),
+ col);
}
-
+
if (spacing_)
{
last_spacings_[parent] = spacing_;
ADD_ACKNOWLEDGER (Note_spacing_engraver, rhythmic_grob);
ADD_TRANSLATOR (Note_spacing_engraver,
- /* doc */
- "Generate @code{NoteSpacing}, an object linking horizontal"
- " lines for use in spacing.",
+ /* doc */
+ "Generate @code{NoteSpacing}, an object linking horizontal"
+ " lines for use in spacing.",
- /* create */
- "NoteSpacing ",
+ /* create */
+ "NoteSpacing ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Spring
Note_spacing::get_spacing (Grob *me, Item *right_col,
- Real base_space, Real increment)
+ Real base_space, Real increment)
{
vector<Item *> note_columns = Spacing_interface::left_note_columns (me);
Real left_head_end = 0;
Grob *col = note_columns[i]->get_column ();
if (!g)
- g = Note_column::first_head (note_columns[i]);
+ g = Note_column::first_head (note_columns[i]);
/*
- Ugh. If Stem is switched off, we don't know what the
- first note head will be.
+ Ugh. If Stem is switched off, we don't know what the
+ first note head will be.
*/
if (g)
- {
- if (g->common_refpoint (col, X_AXIS) != col)
- programming_error ("Note_spacing::get_spacing (): Common refpoint incorrect");
- else
- left_head_end = g->extent (col, X_AXIS)[RIGHT];
- }
+ {
+ if (g->common_refpoint (col, X_AXIS) != col)
+ programming_error ("Note_spacing::get_spacing (): Common refpoint incorrect");
+ else
+ left_head_end = g->extent (col, X_AXIS)[RIGHT];
+ }
}
/*
&& to_boolean (me->get_property ("space-to-barline")))
{
Grob *bar = Pointer_group_interface::find_grob (right_col,
- ly_symbol2scm ("elements"),
- Bar_line::non_empty_barline);
+ ly_symbol2scm ("elements"),
+ Bar_line::non_empty_barline);
if (bar)
- {
- Real shift = bar->extent (right_col, X_AXIS)[LEFT];
- ideal -= shift;
- min_desired_space -= max (shift, 0.0);
- }
+ {
+ Real shift = bar->extent (right_col, X_AXIS)[LEFT];
+ ideal -= shift;
+ min_desired_space -= max (shift, 0.0);
+ }
else
- ideal -= right_col->extent (right_col, X_AXIS)[RIGHT];
+ ideal -= right_col->extent (right_col, X_AXIS)[RIGHT];
}
ideal = max (ideal, min_desired_space);
head_extent = head->extent (rcolumn, X_AXIS);
if (!head_extent.is_empty ())
- note_head_width = head_extent[RIGHT];
+ note_head_width = head_extent[RIGHT];
note_head_width -= Stem::thickness (right_stem);
}
return -note_head_width * get_grob_direction (right_stem)
- * robust_scm2double (note_spacing->get_property ("knee-spacing-correction"), 0);
+ * robust_scm2double (note_spacing->get_property ("knee-spacing-correction"), 0);
}
static Real
different_directions_correction (Grob *note_spacing,
- Drul_array<Interval> stem_posns,
- Direction left_stem_dir)
+ Drul_array<Interval> stem_posns,
+ Direction left_stem_dir)
{
Real ret = 0.0;
Interval intersect = stem_posns[LEFT];
ret = abs (intersect.length ());
/*
- Ugh. 7 is hardcoded.
+ Ugh. 7 is hardcoded.
*/
ret = min (ret / 7, 1.0)
- * left_stem_dir
- * robust_scm2double (note_spacing->get_property ("stem-spacing-correction"), 0);
+ * left_stem_dir
+ * robust_scm2double (note_spacing->get_property ("stem-spacing-correction"), 0);
}
return ret;
}
*/
void
Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
- Real increment,
- Real *space, Real *fixed)
+ Real increment,
+ Real *space, Real *fixed)
{
Drul_array<Direction> stem_dirs (CENTER, CENTER);
Drul_array<Interval> stem_posns;
Drul_array<Interval> head_posns;
Drul_array<SCM> props (me->get_object ("left-items"),
- me->get_object ("right-items"));
+ me->get_object ("right-items"));
Drul_array<Spanner *> beams_drul (0, 0);
Drul_array<Grob *> stems_drul (0, 0);
bool acc_right = false;
Grob *bar = Spacing_interface::extremal_break_aligned_grob (me, RIGHT,
- rcolumn->break_status_dir (),
- &bar_xextent);
+ rcolumn->break_status_dir (),
+ &bar_xextent);
if (bar && dynamic_cast<Item *> (bar)->get_column () == rcolumn)
bar_yextent = Staff_spacing::bar_y_positions (bar);
{
vector<Grob *> const &items (ly_scm2link_array (props [d]));
for (vsize i = 0; i < items.size (); i++)
- {
- Item *it = dynamic_cast<Item *> (items[i]);
- if (!Note_column::has_interface (it))
- continue;
- if (d == RIGHT && it->get_column () != rcolumn)
- continue;
-
- /*
- Find accidentals which are sticking out of the right side.
- */
- if (d == RIGHT)
- acc_right = acc_right || Note_column::accidentals (it);
-
- Grob *stem = Note_column::get_stem (it);
-
- if (!stem || !stem->is_live () || Stem::is_invisible (stem))
- return;
-
- stems_drul[d] = stem;
- beams_drul[d] = Stem::get_beam (stem);
-
- Direction stem_dir = get_grob_direction (stem);
- if (stem_dirs[d] && stem_dirs[d] != stem_dir)
- return;
-
- stem_dirs[d] = stem_dir;
-
- /*
- Correction doesn't seem appropriate when there is a large flag
- hanging from the note.
- */
- if (d == LEFT
- && Stem::duration_log (stem) > 2 && !Stem::get_beam (stem))
- return;
-
- Interval hp = Stem::head_positions (stem);
- if (!hp.is_empty ())
- {
- Real chord_start = hp[stem_dir];
-
- /*
- can't look at stem-end-position, since that triggers
- beam slope computations.
- */
- Real stem_end = hp[stem_dir]
- + stem_dir * robust_scm2double (stem->get_property ("length"), 7);
-
- stem_posns[d] = Interval (min (chord_start, stem_end),
- max (chord_start, stem_end));
- head_posns[d].unite (hp);
- }
- }
+ {
+ Item *it = dynamic_cast<Item *> (items[i]);
+ if (!Note_column::has_interface (it))
+ continue;
+ if (d == RIGHT && it->get_column () != rcolumn)
+ continue;
+
+ /*
+ Find accidentals which are sticking out of the right side.
+ */
+ if (d == RIGHT)
+ acc_right = acc_right || Note_column::accidentals (it);
+
+ Grob *stem = Note_column::get_stem (it);
+
+ if (!stem || !stem->is_live () || Stem::is_invisible (stem))
+ return;
+
+ stems_drul[d] = stem;
+ beams_drul[d] = Stem::get_beam (stem);
+
+ Direction stem_dir = get_grob_direction (stem);
+ if (stem_dirs[d] && stem_dirs[d] != stem_dir)
+ return;
+
+ stem_dirs[d] = stem_dir;
+
+ /*
+ Correction doesn't seem appropriate when there is a large flag
+ hanging from the note.
+ */
+ if (d == LEFT
+ && Stem::duration_log (stem) > 2 && !Stem::get_beam (stem))
+ return;
+
+ Interval hp = Stem::head_positions (stem);
+ if (!hp.is_empty ())
+ {
+ Real chord_start = hp[stem_dir];
+
+ /*
+ can't look at stem-end-position, since that triggers
+ beam slope computations.
+ */
+ Real stem_end = hp[stem_dir]
+ + stem_dir * robust_scm2double (stem->get_property ("length"), 7);
+
+ stem_posns[d] = Interval (min (chord_start, stem_end),
+ max (chord_start, stem_end));
+ head_posns[d].unite (hp);
+ }
+ }
}
while (flip (&d) != LEFT);
if (stem_dirs[LEFT] * stem_dirs[RIGHT] == -1)
{
if (beams_drul[LEFT] && beams_drul[LEFT] == beams_drul[RIGHT])
- {
- correction = knee_correction (me, stems_drul[RIGHT], increment);
- *fixed += correction;
- }
+ {
+ correction = knee_correction (me, stems_drul[RIGHT], increment);
+ *fixed += correction;
+ }
else
- {
- correction = different_directions_correction (me, stem_posns, stem_dirs[LEFT]);
+ {
+ correction = different_directions_correction (me, stem_posns, stem_dirs[LEFT]);
- if (!bar_yextent.is_empty ())
- correction *= 0.5;
- }
+ if (!bar_yextent.is_empty ())
+ correction *= 0.5;
+ }
}
/*
Only apply same direction correction if there are no
accidentals sticking out of the right hand side.
*/
else if (stem_dirs[LEFT] * stem_dirs[RIGHT] == 1
- && !acc_right)
+ && !acc_right)
correction = same_direction_correction (me, head_posns);
*space += correction;
}
ADD_INTERFACE (Note_spacing,
- "This object calculates spacing wishes for individual voices.",
-
- /* properties */
- "knee-spacing-correction "
- "left-items "
- "right-items "
- "same-direction-correction "
- "stem-spacing-correction "
- "space-to-barline "
- );
+ "This object calculates spacing wishes for individual voices.",
+
+ /* properties */
+ "knee-spacing-correction "
+ "left-items "
+ "right-items "
+ "same-direction-correction "
+ "stem-spacing-correction "
+ "space-to-barline "
+ );
#include "open-type-font.hh"
LY_DEFINE (ly_font_sub_fonts, "ly:font-sub-fonts", 1, 0, 0,
- (SCM font),
- "Given the font metric @var{font} of an OpenType font, return the"
- " names of the subfonts within @var{font}.")
+ (SCM font),
+ "Given the font metric @var{font} of an OpenType font, return the"
+ " names of the subfonts within @var{font}.")
{
LY_ASSERT_SMOB (Font_metric, font, 1);
}
LY_DEFINE (ly_otf_font_glyph_info, "ly:otf-font-glyph-info", 2, 0, 0,
- (SCM font, SCM glyph),
- "Given the font metric @var{font} of an OpenType font, return the"
- " information about named glyph @var{glyph} (a string).")
+ (SCM font, SCM glyph),
+ "Given the font metric @var{font} of an OpenType font, return the"
+ " information about named glyph @var{glyph} (a string).")
{
Modified_font_metric *fm
= dynamic_cast<Modified_font_metric *> (unsmob_metrics (font));
Open_type_font *otf = fm
- ? dynamic_cast<Open_type_font *> (fm->original_font ())
- : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
+ ? dynamic_cast<Open_type_font *> (fm->original_font ())
+ : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OpenType font");
LY_ASSERT_TYPE (scm_is_string, glyph, 2);
}
LY_DEFINE (ly_otf_font_table_data, "ly:otf-font-table-data", 2, 0, 0,
- (SCM font, SCM tag),
- "Extract a table @var{tag} from @var{font}. Return empty string"
- " for non-existent @var{tag}.")
+ (SCM font, SCM tag),
+ "Extract a table @var{tag} from @var{font}. Return empty string"
+ " for non-existent @var{tag}.")
{
Modified_font_metric *fm
= dynamic_cast<Modified_font_metric *> (unsmob_metrics (font));
Open_type_font *otf = fm
- ? dynamic_cast<Open_type_font *> (fm->original_font ())
- : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
+ ? dynamic_cast<Open_type_font *> (fm->original_font ())
+ : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OpenType font");
LY_ASSERT_TYPE (scm_is_string, tag, 2);
}
LY_DEFINE (ly_otf_font_p, "ly:otf-font?", 1, 0, 0,
- (SCM font),
- "Is @var{font} an OpenType font?")
+ (SCM font),
+ "Is @var{font} an OpenType font?")
{
Modified_font_metric *fm
= dynamic_cast<Modified_font_metric *> (unsmob_metrics (font));
Open_type_font *otf = fm
- ? dynamic_cast<Open_type_font *> (fm->original_font ())
- : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
+ ? dynamic_cast<Open_type_font *> (fm->original_font ())
+ : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
return scm_from_bool (otf);
}
LY_DEFINE (ly_otf_glyph_count, "ly:otf-glyph-count", 1, 0, 0,
- (SCM font),
- "Return the number of glyphs in @var{font}.")
+ (SCM font),
+ "Return the number of glyphs in @var{font}.")
{
Modified_font_metric *fm
= dynamic_cast<Modified_font_metric *> (unsmob_metrics (font));
Open_type_font *otf = fm
- ? dynamic_cast<Open_type_font *> (fm->original_font ())
- : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
+ ? dynamic_cast<Open_type_font *> (fm->original_font ())
+ : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OpenType font");
}
LY_DEFINE (ly_otf_glyph_list, "ly:otf-glyph-list", 1, 0, 0,
- (SCM font),
- "Return a list of glyph names for @var{font}.")
+ (SCM font),
+ "Return a list of glyph names for @var{font}.")
{
Modified_font_metric *fm
= dynamic_cast<Modified_font_metric *> (unsmob_metrics (font));
Open_type_font *otf = fm
- ? dynamic_cast<Open_type_font *> (fm->original_font ())
- : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
+ ? dynamic_cast<Open_type_font *> (fm->original_font ())
+ : dynamic_cast<Open_type_font *> (unsmob_metrics (font));
SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OpenType font");
{
FT_Byte *buffer = (FT_Byte *) malloc (*length);
if (buffer == NULL)
- error (_f ("cannot allocate %lu bytes", *length));
+ error (_f ("cannot allocate %lu bytes", *length));
error_code = FT_Load_Sfnt_Table (face, tag, 0, buffer, length);
if (error_code)
- error (_f ("cannot load font table: %s", tag_str));
+ error (_f ("cannot load font table: %s", tag_str));
return buffer;
}
else
programming_error (_f ("FreeType error: %s",
- freetype_error_string (error_code).c_str ()
- ));
+ freetype_error_string (error_code).c_str ()
+ ));
return 0;
}
SCM tab = SCM_EOL;
if (buffer)
{
- string contents ((char const*)buffer, length);
+ string contents ((char const *)buffer, length);
contents = "(quote (" + contents + "))";
tab = scm_c_eval_string (contents.c_str ());
return tab;
}
-
Open_type_font::~Open_type_font ()
{
FT_Done_Face (face_);
{
FT_ULong len;
FT_Byte *tab = load_table (tag.c_str (), face, &len);
- string ret ((char const*) tab, len);
+ string ret ((char const *) tab, len);
free (tab);
return ret;
if (error_code == FT_Err_Unknown_File_Format)
error (_f ("unsupported font format: %s", str.c_str ()));
else if (error_code)
- error (_f ("error reading font file %s: %s",
- str.c_str (),
- freetype_error_string (error_code).c_str ()));
+ error (_f ("error reading font file %s: %s",
+ str.c_str (),
+ freetype_error_string (error_code).c_str ()));
return face;
}
if (SCM_HASHTABLE_P (lily_index_to_bbox_table_))
{
SCM box = scm_hashq_ref (lily_index_to_bbox_table_,
- scm_from_unsigned_integer (signed_idx), SCM_BOOL_F);
+ scm_from_unsigned_integer (signed_idx), SCM_BOOL_F);
Box *box_ptr = Box::unsmob (box);
if (box_ptr)
- return *box_ptr;
+ return *box_ptr;
}
if (SCM_HASHTABLE_P (lily_character_table_))
const size_t len = 256;
char name[len];
FT_Error code = FT_Get_Glyph_Name (face_, FT_UInt (signed_idx),
- name, FT_UInt (len));
+ name, FT_UInt (len));
if (code)
- warning (_f ("FT_Get_Glyph_Name () Freetype error: %s",
- freetype_error_string (code)));
+ warning (_f ("FT_Get_Glyph_Name () Freetype error: %s",
+ freetype_error_string (code)));
SCM sym = ly_symbol2scm (name);
SCM alist = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F);
if (alist != SCM_BOOL_F)
- {
- SCM bbox = scm_cdr (scm_assq (ly_symbol2scm ("bbox"), alist));
-
- Box b;
- b[X_AXIS][LEFT] = scm_to_double (scm_car (bbox));
- bbox = scm_cdr (bbox);
- b[Y_AXIS][LEFT] = scm_to_double (scm_car (bbox));
- bbox = scm_cdr (bbox);
- b[X_AXIS][RIGHT] = scm_to_double (scm_car (bbox));
- bbox = scm_cdr (bbox);
- b[Y_AXIS][RIGHT] = scm_to_double (scm_car (bbox));
- bbox = scm_cdr (bbox);
-
- b.scale (point_constant);
-
- scm_hashq_set_x (lily_index_to_bbox_table_,
- scm_from_unsigned_integer (signed_idx),
- b.smobbed_copy ());
- return b;
- }
+ {
+ SCM bbox = scm_cdr (scm_assq (ly_symbol2scm ("bbox"), alist));
+
+ Box b;
+ b[X_AXIS][LEFT] = scm_to_double (scm_car (bbox));
+ bbox = scm_cdr (bbox);
+ b[Y_AXIS][LEFT] = scm_to_double (scm_car (bbox));
+ bbox = scm_cdr (bbox);
+ b[X_AXIS][RIGHT] = scm_to_double (scm_car (bbox));
+ bbox = scm_cdr (bbox);
+ b[Y_AXIS][RIGHT] = scm_to_double (scm_car (bbox));
+ bbox = scm_cdr (bbox);
+
+ b.scale (point_constant);
+
+ scm_hashq_set_x (lily_index_to_bbox_table_,
+ scm_from_unsigned_integer (signed_idx),
+ b.smobbed_copy ());
+ return b;
+ }
}
FT_UInt idx = FT_UInt (signed_idx);
FT_Pos hb = m.horiBearingX;
FT_Pos vb = m.horiBearingY;
Box b (Interval (Real (-hb), Real (m.width - hb)),
- Interval (Real (-vb), Real (m.height - vb)));
+ Interval (Real (-vb), Real (m.height - vb)));
b.scale (design_size () / Real (face_->units_per_EM));
return b;
char *nm_str = (char *) nm.c_str ();
if (FT_UInt idx = FT_Get_Name_Index (face_, nm_str))
return (size_t) idx;
-
- return (size_t) -1;
+
+ return (size_t) - 1;
}
size_t
Open_type_font::design_size () const
{
SCM entry = scm_hashq_ref (lily_global_table_,
- ly_symbol2scm ("design_size"),
-
- /*
- Hmm. Design size is arbitrary for
- non-design-size fonts. I vote for 1 -
- which will trip errors more
- quickly. --hwn.
- */
- scm_from_unsigned_integer (1));
+ ly_symbol2scm ("design_size"),
+
+ /*
+ Hmm. Design size is arbitrary for
+ non-design-size fonts. I vote for 1 -
+ which will trip errors more
+ quickly. --hwn.
+ */
+ scm_from_unsigned_integer (1));
return scm_to_double (entry) * Real (point_constant);
}
{
SCM retval = SCM_EOL;
SCM *tail = &retval;
-
+
for (int i = 0; i < face_->num_glyphs; i++)
{
const size_t len = 256;
char name[len];
FT_Error code = FT_Get_Glyph_Name (face_, i, name, len);
if (code)
- warning (_f ("FT_Get_Glyph_Name () error: %s",
- freetype_error_string (code).c_str ()));
+ warning (_f ("FT_Get_Glyph_Name () error: %s",
+ freetype_error_string (code).c_str ()));
*tail = scm_cons (scm_from_locale_string (name), SCM_EOL);
tail = SCM_CDRLOC (*tail);
}
-
+
return retval;
}
// Note that system_count () only counts non-title systems.
vsize ideal_sys_count = system_count ();
-
+
if (!scm_is_integer (forced_page_count))
{
/* find out the ideal number of pages */
message (_ ("Finding the ideal number of pages..."));
-
+
best = space_systems_on_best_pages (0, first_page_num);
page_count = best.systems_per_page_.size ();
min_sys_count = ideal_sys_count - best.systems_per_page_.back ();
-
+
if (page_count > 1 && best.systems_per_page_[page_count - 2] > 1)
- min_sys_count -= best.systems_per_page_[page_count - 2];
+ min_sys_count -= best.systems_per_page_[page_count - 2];
min_sys_count = max (min_sys_count, (vsize)1);
}
else
{
/* If systems-per-page and page-count are both specified, we know exactly
- how many systems should be present. */
+ how many systems should be present. */
if (systems_per_page () > 0)
- {
- ideal_sys_count = systems_per_page () * page_count;
-
- if (ideal_sys_count > max_system_count (0, end)
- || ideal_sys_count < min_system_count (0, end))
- {
- warning (_ ("could not satisfy systems-per-page and page-count at the same time, ignoring systems-per-page"));
- ideal_sys_count = system_count ();
- min_sys_count = page_count;
- }
- else
- {
- set_current_breakpoints (0, end, ideal_sys_count);
- min_sys_count = max_sys_count = ideal_sys_count;
- ideal_line_division = best_division = current_configuration (0);
- }
- }
+ {
+ ideal_sys_count = systems_per_page () * page_count;
+
+ if (ideal_sys_count > max_system_count (0, end)
+ || ideal_sys_count < min_system_count (0, end))
+ {
+ warning (_ ("could not satisfy systems-per-page and page-count at the same time, ignoring systems-per-page"));
+ ideal_sys_count = system_count ();
+ min_sys_count = page_count;
+ }
+ else
+ {
+ set_current_breakpoints (0, end, ideal_sys_count);
+ min_sys_count = max_sys_count = ideal_sys_count;
+ ideal_line_division = best_division = current_configuration (0);
+ }
+ }
else
- min_sys_count = page_count;
+ min_sys_count = page_count;
/* TODO: the following line will spit out programming errors if the
- ideal line spacing doesn't fit on PAGE_COUNT pages */
+ ideal line spacing doesn't fit on PAGE_COUNT pages */
best = space_systems_on_n_pages (0, page_count, first_page_num);
}
else if (scm_is_integer (forced_page_count))
message (_f ("Fitting music on %d pages...", (int)page_count));
else
- message (_f ("Fitting music on %d or %d pages...", (int)page_count-1, (int)page_count));
+ message (_f ("Fitting music on %d or %d pages...", (int)page_count - 1, (int)page_count));
/* try a smaller number of systems than the ideal number for line breaking */
Line_division bound = ideal_line_division;
set_current_breakpoints (0, end, sys_count, Line_division (), bound);
if (debug_page_breaking_scoring)
- message (_f ("trying %d systems", (int)sys_count));
+ message (_f ("trying %d systems", (int)sys_count));
for (vsize i = 0; i < current_configuration_count (); i++)
- {
- Page_spacing_result cur;
+ {
+ Page_spacing_result cur;
- if (scm_is_integer (forced_page_count))
- cur = space_systems_on_n_pages (i, page_count, first_page_num);
- else
- cur = space_systems_on_best_pages (i, first_page_num);
+ if (scm_is_integer (forced_page_count))
+ cur = space_systems_on_n_pages (i, page_count, first_page_num);
+ else
+ cur = space_systems_on_best_pages (i, first_page_num);
- if (cur.demerits_ < best_for_this_sys_count.demerits_)
- {
- best_for_this_sys_count = cur;
- bound = current_configuration (i);
- }
- }
+ if (cur.demerits_ < best_for_this_sys_count.demerits_)
+ {
+ best_for_this_sys_count = cur;
+ bound = current_configuration (i);
+ }
+ }
if (debug_page_breaking_scoring)
- message (_f ("best score for this sys-count: %f", best_for_this_sys_count.demerits_));
+ message (_f ("best score for this sys-count: %f", best_for_this_sys_count.demerits_));
if (best_for_this_sys_count.demerits_ < best.demerits_)
- {
- best = best_for_this_sys_count;
- best_division = bound;
- }
+ {
+ best = best_for_this_sys_count;
+ best_division = bound;
+ }
/* Check to see if we already have too few systems. There are two ways
- we check this: if we are trying one less than the ideal number of pages
- and the pages are stretched on average then we have too
- few systems. If the spacing is worse than BAD_SPACING_PENALTY, then we
- have too few systems. In either case, though, we need to continue reducing
- the number of systems if max-systems-per-page requires it. */
+ we check this: if we are trying one less than the ideal number of pages
+ and the pages are stretched on average then we have too
+ few systems. If the spacing is worse than BAD_SPACING_PENALTY, then we
+ have too few systems. In either case, though, we need to continue reducing
+ the number of systems if max-systems-per-page requires it. */
if (!(best.system_count_status_ & SYSTEM_COUNT_TOO_MANY))
- {
- if (best_for_this_sys_count.page_count () < page_count
- && best_for_this_sys_count.average_force () > 0)
- break;
-
- if (best_for_this_sys_count.demerits_ >= BAD_SPACING_PENALTY)
- break;
- }
+ {
+ if (best_for_this_sys_count.page_count () < page_count
+ && best_for_this_sys_count.average_force () > 0)
+ break;
+
+ if (best_for_this_sys_count.demerits_ >= BAD_SPACING_PENALTY)
+ break;
+ }
}
/* try a larger number of systems than the ideal line breaking number. This
is more or less C&P, but the loop bounds make it difficult to try something
like do {...} while (flip(&d) != UP). */
bound = ideal_line_division;
- for (vsize sys_count = ideal_sys_count+1; sys_count <= max_sys_count; sys_count++)
+ for (vsize sys_count = ideal_sys_count + 1; sys_count <= max_sys_count; sys_count++)
{
Real best_demerits_for_this_sys_count = infinity_f;
set_current_breakpoints (0, end, sys_count, bound);
if (debug_page_breaking_scoring)
- message (_f ("trying %d systems", (int)sys_count));
+ message (_f ("trying %d systems", (int)sys_count));
for (vsize i = 0; i < current_configuration_count (); i++)
- {
- vsize min_p_count = min_page_count (i, first_page_num);
- Page_spacing_result cur;
-
- if (min_p_count > page_count)
- continue;
- else if (scm_is_integer (forced_page_count))
- cur = space_systems_on_n_pages (i, page_count, first_page_num);
- else
- cur = space_systems_on_best_pages (i, first_page_num);
-
- if (cur.demerits_ < best.demerits_)
- {
- best = cur;
- best_division = current_configuration (i);
- }
-
- if (cur.demerits_ < best_demerits_for_this_sys_count)
- {
- best_demerits_for_this_sys_count = cur.demerits_;
- bound = current_configuration (i);
- }
- }
+ {
+ vsize min_p_count = min_page_count (i, first_page_num);
+ Page_spacing_result cur;
+
+ if (min_p_count > page_count)
+ continue;
+ else if (scm_is_integer (forced_page_count))
+ cur = space_systems_on_n_pages (i, page_count, first_page_num);
+ else
+ cur = space_systems_on_best_pages (i, first_page_num);
+
+ if (cur.demerits_ < best.demerits_)
+ {
+ best = cur;
+ best_division = current_configuration (i);
+ }
+
+ if (cur.demerits_ < best_demerits_for_this_sys_count)
+ {
+ best_demerits_for_this_sys_count = cur.demerits_;
+ bound = current_configuration (i);
+ }
+ }
if (debug_page_breaking_scoring)
- message (_f ("best score for this sys-count: %f", best_demerits_for_this_sys_count));
+ message (_f ("best score for this sys-count: %f", best_demerits_for_this_sys_count));
if (best_demerits_for_this_sys_count >= BAD_SPACING_PENALTY
- && !(best.system_count_status_ & SYSTEM_COUNT_TOO_FEW))
- break;
+ && !(best.system_count_status_ & SYSTEM_COUNT_TOO_FEW))
+ break;
}
message (_ ("Drawing systems..."));
broken[d] = (b->break_status_dir () != CENTER);
if (Note_column::has_interface (b))
- {
- extract_grob_set (b, "note-heads", heads);
- common = common_refpoint_of_array (heads, common, X_AXIS);
- for (vsize i = 0; i < heads.size (); i++)
- {
- Grob *h = heads[i];
- Grob *dots = Rhythmic_head::get_dots (h);
- if (dots)
- common = dots->common_refpoint (common, X_AXIS);
- }
- }
+ {
+ extract_grob_set (b, "note-heads", heads);
+ common = common_refpoint_of_array (heads, common, X_AXIS);
+ for (vsize i = 0; i < heads.size (); i++)
+ {
+ Grob *h = heads[i];
+ Grob *dots = Rhythmic_head::get_dots (h);
+ if (dots)
+ common = dots->common_refpoint (common, X_AXIS);
+ }
+ }
}
while (flip (&d) != LEFT);
Stencil text;
if (Text_interface::is_markup (markup))
text = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (),
- properties, markup));
+ properties, markup));
Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"),
- Interval (0, 0));
+ Interval (0, 0));
/*
TODO: we should check if there are ledgers, and modify length of
Interval ext;
if (Note_column::has_interface (b))
- {
- extract_grob_set (b, "note-heads", heads);
- for (vsize i = 0; i < heads.size (); i++)
- {
- Grob *h = heads[i];
- ext.unite (h->extent (common, X_AXIS));
- Grob *dots = Rhythmic_head::get_dots (h);
-
- if (dots && d == RIGHT)
- ext.unite (dots->extent (common, X_AXIS));
- }
- }
+ {
+ extract_grob_set (b, "note-heads", heads);
+ for (vsize i = 0; i < heads.size (); i++)
+ {
+ Grob *h = heads[i];
+ ext.unite (h->extent (common, X_AXIS));
+ Grob *dots = Rhythmic_head::get_dots (h);
+
+ if (dots && d == RIGHT)
+ ext.unite (dots->extent (common, X_AXIS));
+ }
+ }
if (ext.is_empty ())
- ext = robust_relative_extent (b, common, X_AXIS);
+ ext = robust_relative_extent (b, common, X_AXIS);
if (broken[d])
- {
- span_points[d] = b->extent (common, X_AXIS)[RIGHT];
- shorten[d] = 0.;
- }
+ {
+ span_points[d] = b->extent (common, X_AXIS)[RIGHT];
+ shorten[d] = 0.;
+ }
else
- span_points[d] = ext[d];
+ span_points[d] = ext[d];
}
while (flip (&d) != LEFT);
0.3 is ~ italic correction.
*/
Real text_size = text.extent (X_AXIS).is_empty ()
- ? 0.0 : text.extent (X_AXIS)[RIGHT] + 0.3;
+ ? 0.0 : text.extent (X_AXIS)[RIGHT] + 0.3;
span_points[LEFT]
= min (span_points[LEFT],
- (span_points[RIGHT] - text_size
- - robust_scm2double (me->get_property ("minimum-length"), -1.0)));
+ (span_points[RIGHT] - text_size
+ - robust_scm2double (me->get_property ("minimum-length"), -1.0)));
Interval bracket_span_points = span_points;
bracket_span_points[LEFT] += text_size;
Drul_array<Real> edge_height = robust_scm2interval (me->get_property ("edge-height"),
- Interval (1.0, 1.0));
+ Interval (1.0, 1.0));
Drul_array<Real> flare = robust_scm2interval (me->get_property ("bracket-flare"),
- Interval (0, 0));
+ Interval (0, 0));
do
{
edge_height[d] *= -get_grob_direction (me);
if (broken[d])
- edge_height[d] = 0.0;
+ edge_height[d] = 0.0;
}
- while (flip(&d) != LEFT);
+ while (flip (&d) != LEFT);
Stencil b;
Interval empty;
if (!bracket_span_points.is_empty () && bracket_span_points.length () > 0.001)
b = Tuplet_bracket::make_bracket (me,
- Y_AXIS, Offset (bracket_span_points.length (), 0),
- edge_height,
- empty,
- flare, shorten);
+ Y_AXIS, Offset (bracket_span_points.length (), 0),
+ edge_height,
+ empty,
+ flare, shorten);
/*
The vertical lines should not take space, for the following scenario:
*/
b = Stencil (Box (b.extent (X_AXIS),
- Interval (0.1, 0.1)),
- b.expr ());
+ Interval (0.1, 0.1)),
+ b.expr ());
b.translate_axis (bracket_span_points[LEFT], X_AXIS);
text.translate_axis (span_points[LEFT], X_AXIS);
}
ADD_INTERFACE (Ottava_bracket,
- "An ottava bracket.",
-
- /* properties */
- "edge-height "
- "bracket-flare "
- "shorten-pair "
- "minimum-length "
- );
+ "An ottava bracket.",
+
+ /* properties */
+ "edge-height "
+ "bracket-flare "
+ "shorten-pair "
+ "minimum-length "
+ );
#include "spanner.hh"
#include "text-interface.hh"
-
class Ottava_spanner_engraver : public Engraver
{
public:
finished_ = span_;
span_ = 0;
if (Text_interface::is_markup (ott))
- {
- span_ = make_spanner ("OttavaBracket", SCM_EOL);
- span_->set_property ("text", ott);
-
- SCM offset (get_property ("middleCOffset"));
- if (robust_scm2double (offset, 0) > 0)
- span_->set_property ("direction", scm_from_int (DOWN));
- }
+ {
+ span_ = make_spanner ("OttavaBracket", SCM_EOL);
+ span_->set_property ("text", ott);
+
+ SCM offset (get_property ("middleCOffset"));
+ if (robust_scm2double (offset, 0) > 0)
+ span_->set_property ("direction", scm_from_int (DOWN));
+ }
}
last_ottavation_ = ott;
}
Side_position_interface::add_support (span_, it);
if (!span_->get_bound (LEFT))
- span_->set_bound (LEFT, it);
+ span_->set_bound (LEFT, it);
span_->set_bound (RIGHT, it);
}
}
{
Direction d = LEFT;
do
- {
- if (!finished_->get_bound (RIGHT))
- {
- Grob *e = unsmob_grob (get_property ("currentMusicalColumn"));
- finished_->set_bound (d, e);
- }
- }
+ {
+ if (!finished_->get_bound (RIGHT))
+ {
+ Grob *e = unsmob_grob (get_property ("currentMusicalColumn"));
+ finished_->set_bound (d, e);
+ }
+ }
while (flip (&d) != LEFT);
finished_ = 0;
ADD_ACKNOWLEDGER (Ottava_spanner_engraver, note_column);
ADD_TRANSLATOR (Ottava_spanner_engraver,
- /* doc */
- "Create a text spanner when the ottavation property changes.",
-
- /* create */
- "OttavaBracket ",
-
- /* read */
- "middleCOffset "
- "ottavation "
- "currentMusicalColumn ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create a text spanner when the ottavation property changes.",
+
+ /* create */
+ "OttavaBracket ",
+
+ /* read */
+ "middleCOffset "
+ "ottavation "
+ "currentMusicalColumn ",
+
+ /* write */
+ ""
+ );
#include "minimal-page-breaking.hh"
LY_DEFINE (ly_page_turn_breaking, "ly:page-turn-breaking",
- 1, 0, 0, (SCM pb),
- "Optimally break (pages and lines) the @code{Paper_book} object"
- " @var{pb} such that page turns only happen in specified places,"
- " returning its pages.")
+ 1, 0, 0, (SCM pb),
+ "Optimally break (pages and lines) the @code{Paper_book} object"
+ " @var{pb} such that page turns only happen in specified places,"
+ " returning its pages.")
{
Page_turn_page_breaking b (unsmob_paper_book (pb));
return b.solve ();
}
LY_DEFINE (ly_optimal_breaking, "ly:optimal-breaking",
- 1, 0, 0, (SCM pb),
- "Optimally break (pages and lines) the @code{Paper_book} object"
- " @var{pb} to minimize badness in bother vertical and horizontal"
- " spacing.")
+ 1, 0, 0, (SCM pb),
+ "Optimally break (pages and lines) the @code{Paper_book} object"
+ " @var{pb} to minimize badness in bother vertical and horizontal"
+ " spacing.")
{
Optimal_page_breaking b (unsmob_paper_book (pb));
return b.solve ();
}
LY_DEFINE (ly_minimal_breaking, "ly:minimal-breaking",
- 1, 0, 0, (SCM pb),
- "Break (pages and lines) the @code{Paper_book} object @var{pb}"
- " without looking for optimal spacing: stack as many lines on"
- " a page before moving to the next one.")
+ 1, 0, 0, (SCM pb),
+ "Break (pages and lines) the @code{Paper_book} object @var{pb}"
+ " without looking for optimal spacing: stack as many lines on"
+ " a page before moving to the next one.")
{
Minimal_page_breaking b (unsmob_paper_book (pb));
return b.solve ();
for (vsize i = 0; i < orig.size (); i++)
{
if (ret.size () && !scm_is_symbol (ret.back ().page_permission_))
- {
- Line_details const &old = ret.back ();
- Line_details compressed = orig[i];
- /*
- We must account for the padding between the lines that we are compressing.
- The padding values come from "old," which is the upper system here. Note
- the meaning of tight-spacing: if a system has tight-spacing, then the padding
- _before_ it is ignored.
- */
- Real padding = 0;
- if (!orig[i].tight_spacing_)
- padding = orig[i].title_ ? old.title_padding_ : old.padding_;
-
- // FIXME: double check these. Doesn't foo.piggyback (bar) mean
- // that foo goes on top?
- // TODO: break out a Line_details::piggyback from here?
- compressed.shape_ = old.shape_.piggyback (orig[i].shape_, padding);
- compressed.refpoint_extent_[UP] = old.refpoint_extent_[UP];
- compressed.refpoint_extent_[DOWN] += compressed.shape_.rest_[UP] - old.shape_.rest_[UP];
- compressed.space_ += old.space_;
- compressed.inverse_hooke_ += old.inverse_hooke_;
-
- compressed.compressed_lines_count_ = old.compressed_lines_count_ + 1;
- compressed.compressed_nontitle_lines_count_ =
- old.compressed_nontitle_lines_count_ + (compressed.title_ ? 0 : 1);
-
- // compressed.title_ is true if and only if the first of its
- // compressed lines was a title.
+ {
+ Line_details const &old = ret.back ();
+ Line_details compressed = orig[i];
+ /*
+ We must account for the padding between the lines that we are compressing.
+ The padding values come from "old," which is the upper system here. Note
+ the meaning of tight-spacing: if a system has tight-spacing, then the padding
+ _before_ it is ignored.
+ */
+ Real padding = 0;
+ if (!orig[i].tight_spacing_)
+ padding = orig[i].title_ ? old.title_padding_ : old.padding_;
+
+ // FIXME: double check these. Doesn't foo.piggyback (bar) mean
+ // that foo goes on top?
+ // TODO: break out a Line_details::piggyback from here?
+ compressed.shape_ = old.shape_.piggyback (orig[i].shape_, padding);
+ compressed.refpoint_extent_[UP] = old.refpoint_extent_[UP];
+ compressed.refpoint_extent_[DOWN] += compressed.shape_.rest_[UP] - old.shape_.rest_[UP];
+ compressed.space_ += old.space_;
+ compressed.inverse_hooke_ += old.inverse_hooke_;
+
+ compressed.compressed_lines_count_ = old.compressed_lines_count_ + 1;
+ compressed.compressed_nontitle_lines_count_
+ = old.compressed_nontitle_lines_count_ + (compressed.title_ ? 0 : 1);
+
+ // compressed.title_ is true if and only if the first of its
+ // compressed lines was a title.
compressed.title_ = old.title_;
// adds footnotes of one line to the footnotes of another
compressed.footnotes_.insert (compressed.footnotes_.begin (),
- old.footnotes_.begin (), old.footnotes_.end ());
-
- ret.back () = compressed;
- }
+ old.footnotes_.begin (), old.footnotes_.end ());
+
+ ret.back () = compressed;
+ }
else
- {
- ret.push_back (orig[i]);
- ret.back ().force_ = 0;
- }
+ {
+ ret.push_back (orig[i]);
+ ret.back ().force_ = 0;
+ }
}
return ret;
}
*/
static vector<vsize>
uncompress_solution (vector<vsize> const &systems_per_page,
- vector<Line_details> const &compressed)
+ vector<Line_details> const &compressed)
{
vector<vsize> ret;
vsize start_sys = 0;
{
int compressed_count = 0;
for (vsize j = start_sys; j < start_sys + systems_per_page[i]; j++)
- compressed_count += compressed[j].compressed_lines_count_ - 1;
+ compressed_count += compressed[j].compressed_lines_count_ - 1;
ret.push_back (systems_per_page[i] + compressed_count);
start_sys += systems_per_page[i];
footnote_number_raise_ = (to_boolean (pb->paper_->c_variable ("footnote-auto-numbering"))
? robust_scm2double (pb->paper_->c_variable ("footnote-number-raise"), 0.0)
: 0.0);
-
+
if (systems_per_page_ && (max_systems_per_page_ || min_systems_per_page_))
{
warning (_f ("ignoring min-systems-per-page and max-systems-per-page because systems-per-page was set"));
/* translate indices into breaks_ into start-end parameters for the line breaker */
void
Page_breaking::line_breaker_args (vsize sys,
- Break_position const &start,
- Break_position const &end,
- vsize *line_breaker_start,
- vsize *line_breaker_end)
+ Break_position const &start,
+ Break_position const &end,
+ vsize *line_breaker_start,
+ vsize *line_breaker_end)
{
assert (system_specs_[sys].pscore_);
assert (next_system (start) <= sys && sys <= end.system_spec_index_);
void
Page_breaking::break_into_pieces (vsize start_break, vsize end_break,
- Line_division const &div)
+ Line_division const &div)
{
vector<Break_position> chunks = chunk_list (start_break, end_break);
bool ignore_div = false;
{
vsize sys = next_system (chunks[i]);
if (system_specs_[sys].pscore_)
- {
- vsize start;
- vsize end;
- line_breaker_args (sys, chunks[i], chunks[i+1], &start, &end);
-
- vector<Column_x_positions> pos = ignore_div
- ? line_breaking_[sys].best_solution (start, end)
- : line_breaking_[sys].solve (start, end, div[i]);
- system_specs_[sys].pscore_->root_system ()->break_into_pieces (pos);
- }
+ {
+ vsize start;
+ vsize end;
+ line_breaker_args (sys, chunks[i], chunks[i + 1], &start, &end);
+
+ vector<Column_x_positions> pos = ignore_div
+ ? line_breaking_[sys].best_solution (start, end)
+ : line_breaking_[sys].solve (start, end, div[i]);
+ system_specs_[sys].pscore_->root_system ()->break_into_pieces (pos);
+ }
}
}
for (vsize sys = 0; sys < system_specs_.size (); sys++)
{
if (system_specs_[sys].pscore_)
- {
- system_specs_[sys].pscore_->root_system ()
- ->do_break_substitution_and_fixup_refpoints ();
- SCM lines = system_specs_[sys].pscore_->root_system ()
- ->get_broken_system_grobs ();
- ret = scm_cons (lines, ret);
- }
+ {
+ system_specs_[sys].pscore_->root_system ()
+ ->do_break_substitution_and_fixup_refpoints ();
+ SCM lines = system_specs_[sys].pscore_->root_system ()
+ ->get_broken_system_grobs ();
+ ret = scm_cons (lines, ret);
+ }
else if (Prob *pb = system_specs_[sys].prob_)
- {
- ret = scm_cons (scm_list_1 (pb->self_scm ()), ret);
- pb->unprotect ();
- }
+ {
+ ret = scm_cons (scm_list_1 (pb->self_scm ()), ret);
+ pb->unprotect ();
+ }
}
return scm_append (scm_reverse (ret));
}
make_page_scm = scm_variable_ref (make_page_scm);
return scm_apply_0 (make_page_scm,
- scm_list_n (book_->self_scm (),
- ly_symbol2scm ("page-number"), scm_from_int (page_num),
- ly_symbol2scm ("is-last-bookpart"), scm_from_bool (last_part),
- ly_symbol2scm ("is-bookpart-last-page"), scm_from_bool (last),
- SCM_UNDEFINED));
+ scm_list_n (book_->self_scm (),
+ ly_symbol2scm ("page-number"), scm_from_int (page_num),
+ ly_symbol2scm ("is-last-bookpart"), scm_from_bool (last_part),
+ ly_symbol2scm ("is-bookpart-last-page"), scm_from_bool (last),
+ SCM_UNDEFINED));
}
// Returns the total height of the paper, including margins and
Real height = scm_to_double (height_scm);
if (page_num >= 0)
- {
- if ((int) cache.size () <= page_num)
- cache.resize (page_num + 1, -1);
- cache[page_num] = height;
- }
+ {
+ if ((int) cache.size () <= page_num)
+ cache.resize (page_num + 1, -1);
+ cache[page_num] = height;
+ }
return height;
}
}
{
SCM paper_system = scm_car (s);
if (Grob *g = unsmob_grob (scm_car (s)))
- {
- System *sys = dynamic_cast<System*> (g);
- paper_system = sys->get_paper_system ();
- }
+ {
+ System *sys = dynamic_cast<System *> (g);
+ paper_system = sys->get_paper_system ();
+ }
paper_systems = scm_cons (paper_system, paper_systems);
}
: footnote_num);
SCM footnotes = Page_layout_problem::get_footnotes_from_lines (systems,
- footnote_num,
- book_);
+ footnote_num,
+ book_);
Page_layout_problem::add_footnotes_to_footer (footnotes, foot, book_);
// Align_interface::align_to_ideal_distances might be called).
SCM systems_configs_fncounts = SCM_EOL;
vsize footnote_count = 0;
-
+
for (vsize i = 0; i < lines_per_page.size (); i++)
{
int page_num = i + first_page_number;
SCM lines = scm_list_head (systems, line_count);
int fn_lines = Page_layout_problem::get_footnote_count (lines);
SCM config = get_page_configuration (lines, page_num, footnote_count, rag, bookpart_last_page);
-
+
systems_configs_fncounts = scm_cons (scm_list_3 (lines, config, scm_from_int ((int)footnote_count)), systems_configs_fncounts);
footnote_count += fn_lines;
systems = scm_list_tail (systems, line_count);
SCM page = draw_page (lines, config, page_num, footnote_num, bookpart_last_page);
/* collect labels */
SCM page_num_scm = scm_from_int (page_num);
- for (SCM l = lines ; scm_is_pair (l) ; l = scm_cdr (l))
- {
- SCM labels = SCM_EOL;
- if (Grob * line = unsmob_grob (scm_car (l)))
- {
- System *system = dynamic_cast<System*> (line);
- labels = system->get_property ("labels");
- }
- else if (Prob *prob = unsmob_prob (scm_car (l)))
- labels = prob->get_property ("labels");
-
- for (SCM lbls = labels ; scm_is_pair (lbls) ; lbls = scm_cdr (lbls))
- label_page_table = scm_cons (scm_cons (scm_car (lbls), page_num_scm),
- label_page_table);
- }
+ for (SCM l = lines; scm_is_pair (l); l = scm_cdr (l))
+ {
+ SCM labels = SCM_EOL;
+ if (Grob *line = unsmob_grob (scm_car (l)))
+ {
+ System *system = dynamic_cast<System *> (line);
+ labels = system->get_property ("labels");
+ }
+ else if (Prob *prob = unsmob_prob (scm_car (l)))
+ labels = prob->get_property ("labels");
+
+ for (SCM lbls = labels; scm_is_pair (lbls); lbls = scm_cdr (lbls))
+ label_page_table = scm_cons (scm_cons (scm_car (lbls), page_num_scm),
+ label_page_table);
+ }
ret = scm_cons (page, ret);
--page_num;
SCM specs = book_->get_system_specs ();
for (SCM s = specs; scm_is_pair (s); s = scm_cdr (s))
{
- if (Paper_score *ps = dynamic_cast<Paper_score*> (unsmob_music_output (scm_car (s))))
- {
- system_specs_.push_back (System_spec (ps));
- }
+ if (Paper_score *ps = dynamic_cast<Paper_score *> (unsmob_music_output (scm_car (s))))
+ {
+ system_specs_.push_back (System_spec (ps));
+ }
else
{
Prob *pb = unsmob_prob (scm_car (s));
for (vsize i = 0; i < system_specs_.size (); i++)
{
if (system_specs_[i].pscore_)
- {
- vector<Grob*> cols = system_specs_[i].pscore_->root_system ()->used_columns ();
- vector<Grob*> forced_line_break_cols;
-
- SCM system_count = system_specs_[i].pscore_->layout ()->c_variable ("system-count");
- if (scm_is_number (system_count))
- {
- // With system-count given, the line configuration for
- // this score is fixed. We need to ensure that chunk
- // boundaries only occur at line breaks.
- Constrained_breaking breaking (system_specs_[i].pscore_);
- vector<Line_details> details = breaking.line_details (0, VPOS, scm_to_int (system_count));
-
- for (vsize j = 0; j < details.size (); j++)
- forced_line_break_cols.push_back (details[j].last_column_);
- }
-
- int last_forced_line_break_idx = 0;
- vsize forced_line_break_idx = 0;
- vector<vsize> line_breaker_columns;
- line_breaker_columns.push_back (0);
-
- for (vsize j = 1; j < cols.size (); j++)
- {
- if (forced_line_break_cols.size ())
- {
- if (forced_line_break_idx >= forced_line_break_cols.size ()
- || forced_line_break_cols[forced_line_break_idx] != cols[j])
- continue;
- else
- forced_line_break_idx++;
- }
-
- bool last = (j == cols.size () - 1);
- bool break_point = is_break && is_break (cols[j]);
- bool chunk_end = cols[j]->get_property ("page-break-permission") == force_sym;
- Break_position cur_pos = Break_position (i,
- line_breaker_columns.size (),
- cols[j],
- last);
-
- // NOTE: even in the breaks_ list, forced_line_count_
- // refers to the number of lines between a
- // Break_position and the start of that /chunk/. This
- // is needed for system_count_bounds to work correctly,
- // since it mixes Break_positions from breaks_ and
- // chunks_.
- if (scm_is_number (system_count))
- cur_pos.forced_line_count_ = forced_line_break_idx - last_forced_line_break_idx;
-
- if (break_point || (i == system_specs_.size () - 1 && last))
- breaks_.push_back (cur_pos);
- if (chunk_end || last)
- {
- chunks_.push_back (cur_pos);
- last_forced_line_break_idx = forced_line_break_idx;
- }
-
- if ((break_point || chunk_end) && !last)
- line_breaker_columns.push_back (j);
- }
- line_breaking_.push_back (Constrained_breaking (system_specs_[i].pscore_, line_breaker_columns));
- }
+ {
+ vector<Grob *> cols = system_specs_[i].pscore_->root_system ()->used_columns ();
+ vector<Grob *> forced_line_break_cols;
+
+ SCM system_count = system_specs_[i].pscore_->layout ()->c_variable ("system-count");
+ if (scm_is_number (system_count))
+ {
+ // With system-count given, the line configuration for
+ // this score is fixed. We need to ensure that chunk
+ // boundaries only occur at line breaks.
+ Constrained_breaking breaking (system_specs_[i].pscore_);
+ vector<Line_details> details = breaking.line_details (0, VPOS, scm_to_int (system_count));
+
+ for (vsize j = 0; j < details.size (); j++)
+ forced_line_break_cols.push_back (details[j].last_column_);
+ }
+
+ int last_forced_line_break_idx = 0;
+ vsize forced_line_break_idx = 0;
+ vector<vsize> line_breaker_columns;
+ line_breaker_columns.push_back (0);
+
+ for (vsize j = 1; j < cols.size (); j++)
+ {
+ if (forced_line_break_cols.size ())
+ {
+ if (forced_line_break_idx >= forced_line_break_cols.size ()
+ || forced_line_break_cols[forced_line_break_idx] != cols[j])
+ continue;
+ else
+ forced_line_break_idx++;
+ }
+
+ bool last = (j == cols.size () - 1);
+ bool break_point = is_break && is_break (cols[j]);
+ bool chunk_end = cols[j]->get_property ("page-break-permission") == force_sym;
+ Break_position cur_pos = Break_position (i,
+ line_breaker_columns.size (),
+ cols[j],
+ last);
+
+ // NOTE: even in the breaks_ list, forced_line_count_
+ // refers to the number of lines between a
+ // Break_position and the start of that /chunk/. This
+ // is needed for system_count_bounds to work correctly,
+ // since it mixes Break_positions from breaks_ and
+ // chunks_.
+ if (scm_is_number (system_count))
+ cur_pos.forced_line_count_ = forced_line_break_idx - last_forced_line_break_idx;
+
+ if (break_point || (i == system_specs_.size () - 1 && last))
+ breaks_.push_back (cur_pos);
+ if (chunk_end || last)
+ {
+ chunks_.push_back (cur_pos);
+ last_forced_line_break_idx = forced_line_break_idx;
+ }
+
+ if ((break_point || chunk_end) && !last)
+ line_breaker_columns.push_back (j);
+ }
+ line_breaking_.push_back (Constrained_breaking (system_specs_[i].pscore_, line_breaker_columns));
+ }
else if (system_specs_[i].prob_)
- {
- bool break_point = prob_is_break && prob_is_break (system_specs_[i].prob_);
- if (break_point || i == system_specs_.size () - 1)
- breaks_.push_back (Break_position (i));
+ {
+ bool break_point = prob_is_break && prob_is_break (system_specs_[i].prob_);
+ if (break_point || i == system_specs_.size () - 1)
+ breaks_.push_back (Break_position (i));
- chunks_.push_back (Break_position (i));
+ chunks_.push_back (Break_position (i));
- /* FIXME: shouldn't we push a Null_breaker or similar dummy
- class? --hwn */
- line_breaking_.push_back (Constrained_breaking (NULL));
- }
+ /* FIXME: shouldn't we push a Null_breaker or similar dummy
+ class? --hwn */
+ line_breaking_.push_back (Constrained_breaking (NULL));
+ }
}
}
// per chunk.
Page_breaking::Line_division
Page_breaking::system_count_bounds (vector<Break_position> const &chunks,
- bool min)
+ bool min)
{
assert (chunks.size () >= 2);
{
vsize sys = next_system (chunks[i]);
- if (chunks[i+1].forced_line_count_)
- ret[i] = chunks[i+1].forced_line_count_;
+ if (chunks[i + 1].forced_line_count_)
+ ret[i] = chunks[i + 1].forced_line_count_;
else if (system_specs_[sys].pscore_)
- {
- vsize start;
- vsize end;
- line_breaker_args (sys, chunks[i], chunks[i+1], &start, &end);
- ret[i] = min
- ? line_breaking_[sys].min_system_count (start, end)
- : line_breaking_[sys].max_system_count (start, end);
- }
+ {
+ vsize start;
+ vsize end;
+ line_breaker_args (sys, chunks[i], chunks[i + 1], &start, &end);
+ ret[i] = min
+ ? line_breaking_[sys].min_system_count (start, end)
+ : line_breaking_[sys].max_system_count (start, end);
+ }
}
return ret;
void
Page_breaking::set_current_breakpoints (vsize start,
- vsize end,
- vsize system_count,
- Line_division lower_bound,
- Line_division upper_bound)
+ vsize end,
+ vsize system_count,
+ Line_division lower_bound,
+ Line_division upper_bound)
{
system_count_ = system_count;
current_chunks_ = chunk_list (start, end);
Line_division work_in_progress;
current_configurations_.clear ();
line_divisions_rec (system_count,
- lower_bound,
- upper_bound,
- &work_in_progress);
+ lower_bound,
+ upper_bound,
+ &work_in_progress);
/* we only consider a constant number of configurations. Otherwise,
this becomes slow when there are many small scores. The constant
5 is somewhat arbitrary. */
if (current_configurations_.size () > 5)
{
- vector<pair<Real,vsize> > dems_and_indices;
+ vector<pair<Real, vsize> > dems_and_indices;
for (vsize i = 0; i < current_configurations_.size (); i++)
- {
- cache_line_details (i);
- Real dem = 0;
- for (vsize j = 0; j < cached_line_details_.size (); j++)
- dem += cached_line_details_[j].force_ * cached_line_details_[j].force_
- + cached_line_details_[j].break_penalty_;
+ {
+ cache_line_details (i);
+ Real dem = 0;
+ for (vsize j = 0; j < cached_line_details_.size (); j++)
+ dem += cached_line_details_[j].force_ * cached_line_details_[j].force_
+ + cached_line_details_[j].break_penalty_;
- dems_and_indices.push_back (pair<Real,vsize> (dem, i));
- }
- vector_sort (dems_and_indices, less<pair<Real,vsize> > ());
+ dems_and_indices.push_back (pair<Real, vsize> (dem, i));
+ }
+ vector_sort (dems_and_indices, less<pair<Real, vsize> > ());
vector<Line_division> best_5_configurations;
for (vsize i = 0; i < 5; i++)
- best_5_configurations.push_back (current_configurations_[dems_and_indices[i].second]);
+ best_5_configurations.push_back (current_configurations_[dems_and_indices[i].second]);
clear_line_details_cache ();
current_configurations_ = best_5_configurations;
system_count_ = 0;
Line_division div;
- for (vsize i = 0; i+1 < current_chunks_.size (); i++)
+ for (vsize i = 0; i + 1 < current_chunks_.size (); i++)
{
vsize sys = next_system (current_chunks_[i]);
- if (current_chunks_[i+1].forced_line_count_)
- div.push_back (current_chunks_[i+1].forced_line_count_);
+ if (current_chunks_[i + 1].forced_line_count_)
+ div.push_back (current_chunks_[i + 1].forced_line_count_);
else if (system_specs_[sys].pscore_)
- {
- line_breaker_args (sys, current_chunks_[i], current_chunks_[i+1], &start, &end);
- div.push_back (line_breaking_[sys].best_solution (start, end).size ());
- }
+ {
+ line_breaker_args (sys, current_chunks_[i], current_chunks_[i + 1], &start, &end);
+ div.push_back (line_breaking_[sys].best_solution (start, end).size ());
+ }
else
- div.push_back (0);
+ div.push_back (0);
system_count_ += div.back ();
}
Line_division &div = current_configurations_[configuration_index];
uncompressed_line_details_.clear ();
for (vsize i = 0; i + 1 < current_chunks_.size (); i++)
- {
- vsize sys = next_system (current_chunks_[i]);
- if (system_specs_[sys].pscore_)
- {
- vsize start;
- vsize end;
- line_breaker_args (sys, current_chunks_[i], current_chunks_[i+1], &start, &end);
-
- vector<Line_details> details = line_breaking_[sys].line_details (start, end, div[i]);
- uncompressed_line_details_.insert (uncompressed_line_details_.end (), details.begin (), details.end ());
- }
- else
- {
- assert (div[i] == 0);
- uncompressed_line_details_.push_back (system_specs_[sys].prob_
- ? Line_details (system_specs_[sys].prob_, book_->paper_)
- : Line_details ());
- }
- }
+ {
+ vsize sys = next_system (current_chunks_[i]);
+ if (system_specs_[sys].pscore_)
+ {
+ vsize start;
+ vsize end;
+ line_breaker_args (sys, current_chunks_[i], current_chunks_[i + 1], &start, &end);
+
+ vector<Line_details> details = line_breaking_[sys].line_details (start, end, div[i]);
+ uncompressed_line_details_.insert (uncompressed_line_details_.end (), details.begin (), details.end ());
+ }
+ else
+ {
+ assert (div[i] == 0);
+ uncompressed_line_details_.push_back (system_specs_[sys].prob_
+ ? Line_details (system_specs_[sys].prob_, book_->paper_)
+ : Line_details ());
+ }
+ }
cached_line_details_ = compress_lines (uncompressed_line_details_);
compute_line_heights ();
}
void
Page_breaking::line_divisions_rec (vsize system_count,
- Line_division const &min_sys,
- Line_division const &max_sys,
- Line_division *cur_division)
+ Line_division const &min_sys,
+ Line_division const &max_sys,
+ Line_division *cur_division)
{
vsize my_index = cur_division->size ();
int others_min = 0;
if (real_min > real_max || real_min < 0)
{
/* this should never happen within a recursive call. If it happens
- at all, it means that we were called with an unsolvable problem
- and we should return an empty result */
+ at all, it means that we were called with an unsolvable problem
+ and we should return an empty result */
assert (my_index == 0);
return;
}
{
cur_division->push_back (i);
if (my_index == min_sys.size () - 1)
- current_configurations_.push_back (*cur_division);
+ current_configurations_.push_back (*cur_division);
else
line_divisions_rec (system_count - i, min_sys, max_sys, cur_division);
cur_division->pop_back ();
Real prev_refpoint_hanging = 0;
for (vsize i = 0; i < cached_line_details_.size (); i++)
{
- Line_details& cur = cached_line_details_[i];
+ Line_details &cur = cached_line_details_[i];
Line_shape shape = cur.shape_;
Real a = shape.begin_[UP];
Real b = shape.rest_[UP];
Real refpoint_hanging = max (prev_hanging_begin + a, prev_hanging_rest + b);
if (i > 0)
- {
- Real padding = 0;
- Line_details const& prev = cached_line_details_[i-1];
- if (!cur.tight_spacing_)
- padding = title
- ? prev.title_padding_
- : prev.padding_;
- Real min_dist = title
- ? prev.title_min_distance_
- : prev.min_distance_;
- refpoint_hanging = max (refpoint_hanging + padding,
- prev_refpoint_hanging - prev.refpoint_extent_[DOWN]
- + cur.refpoint_extent_[UP] + min_dist);
- }
+ {
+ Real padding = 0;
+ Line_details const &prev = cached_line_details_[i - 1];
+ if (!cur.tight_spacing_)
+ padding = title
+ ? prev.title_padding_
+ : prev.padding_;
+ Real min_dist = title
+ ? prev.title_min_distance_
+ : prev.min_distance_;
+ refpoint_hanging = max (refpoint_hanging + padding,
+ prev_refpoint_hanging - prev.refpoint_extent_[DOWN]
+ + cur.refpoint_extent_[UP] + min_dist);
+ }
Real hanging_begin = refpoint_hanging - shape.begin_[DOWN];
Real hanging_rest = refpoint_hanging - shape.rest_[DOWN];
for (vsize i = 0; i < cached_line_details_.size (); i++)
{
Line_details const &cur = cached_line_details_[i];
- Line_details const *const prev = (i > 0) ? &cached_line_details_[i-1] : 0;
+ Line_details const *const prev = (i > 0) ? &cached_line_details_[i - 1] : 0;
Real ext_len;
if (cur_rod_height > 0)
- ext_len = cur.tallness_;
+ ext_len = cur.tallness_;
else
- ext_len = cur.full_height();
+ ext_len = cur.full_height ();
Real spring_len = (i > 0) ? prev->spring_length (cur) : 0;
Real next_rod_height = cur_rod_height + ext_len;
Real next_spring_height = cur_spring_height + spring_len;
Real next_height = next_rod_height + (ragged () ? next_spring_height : 0)
- + min_whitespace_at_bottom_of_page (cur);
+ + min_whitespace_at_bottom_of_page (cur);
int next_line_count = line_count + cur.compressed_nontitle_lines_count_;
if ((!too_few_lines (line_count) && (next_height > cur_page_height && cur_rod_height > 0))
- || too_many_lines (next_line_count)
- || (prev && prev->page_permission_ == ly_symbol2scm ("force")))
- {
- line_count = cur.compressed_nontitle_lines_count_;
- cur_rod_height = cur.full_height();
- cur_spring_height = 0;
- page_starter = i;
-
- cur_page_height = page_height (first_page_num + ret, false);
- cur_page_height -= min_whitespace_at_top_of_page (cur);
-
- ret++;
- }
+ || too_many_lines (next_line_count)
+ || (prev && prev->page_permission_ == ly_symbol2scm ("force")))
+ {
+ line_count = cur.compressed_nontitle_lines_count_;
+ cur_rod_height = cur.full_height ();
+ cur_spring_height = 0;
+ page_starter = i;
+
+ cur_page_height = page_height (first_page_num + ret, false);
+ cur_page_height -= min_whitespace_at_top_of_page (cur);
+
+ ret++;
+ }
else
- {
- cur_rod_height = next_rod_height;
- cur_spring_height = next_spring_height;
- line_count = next_line_count;
- }
+ {
+ cur_rod_height = next_rod_height;
+ cur_spring_height = next_spring_height;
+ line_count = next_line_count;
+ }
}
/* there are two potential problems with the last page (because we didn't know
Real cur_height = cur_rod_height + ((ragged_last () || ragged ()) ? cur_spring_height : 0);
if (!too_few_lines (line_count - cached_line_details_.back ().compressed_nontitle_lines_count_)
- && cur_height > cur_page_height
- /* don't increase the page count if the last page had only one system */
- && cur_rod_height > cached_line_details_.back ().full_height ())
- ret++;
+ && cur_height > cur_page_height
+ /* don't increase the page count if the last page had only one system */
+ && cur_rod_height > cached_line_details_.back ().full_height ())
+ ret++;
assert (ret <= cached_line_details_.size ());
}
cache_line_details (configuration);
bool valid_n = (n >= min_page_count (configuration, first_page_num)
- && n <= cached_line_details_.size ());
+ && n <= cached_line_details_.size ());
if (!valid_n)
programming_error ("number of pages is out of bounds");
if (n == 1 && valid_n)
ret = space_systems_on_1_page (cached_line_details_,
- page_height (first_page_num, is_last ()),
- ragged () || (is_last () && ragged_last ()));
+ page_height (first_page_num, is_last ()),
+ ragged () || (is_last () && ragged_last ()));
else if (n == 2 && valid_n)
ret = space_systems_on_2_pages (configuration, first_page_num);
else
// or N+1 pages; see the comment to space_systems_on_n_pages.
Page_spacing_result
Page_breaking::space_systems_on_n_or_one_more_pages (vsize configuration, vsize n, vsize first_page_num,
- Real penalty_for_fewer_pages)
+ Real penalty_for_fewer_pages)
{
Page_spacing_result n_res;
Page_spacing_result m_res;
if (systems_per_page_ > 0)
{
Page_spacing_result ret = space_systems_with_fixed_number_per_page (configuration, first_page_num);
- ret.demerits_ += (ret.force_.size () == n || ret.force_.size () == (n-1)) ? 0 : BAD_SPACING_PENALTY;
+ ret.demerits_ += (ret.force_.size () == n || ret.force_.size () == (n - 1)) ? 0 : BAD_SPACING_PENALTY;
return ret;
}
Real height = page_height (first_page_num, is_last ());
if (1 >= min_p_count)
- n_res = space_systems_on_1_page (cached_line_details_, height, rag);
+ n_res = space_systems_on_1_page (cached_line_details_, height, rag);
if (1 < cached_line_details_.size ())
- m_res = space_systems_on_2_pages (configuration, first_page_num);
+ m_res = space_systems_on_2_pages (configuration, first_page_num);
}
else
{
Page_spacer ps (cached_line_details_, first_page_num, this);
-
+
if (n >= min_p_count || !valid_n)
- n_res = ps.solve (n);
+ n_res = ps.solve (n);
if (n < cached_line_details_.size () || !valid_n)
- m_res = ps.solve (n+1);
+ m_res = ps.solve (n + 1);
}
m_res = finalize_spacing_result (configuration, m_res);
Page_spacing_result
Page_breaking::space_systems_with_fixed_number_per_page (vsize configuration,
- vsize first_page_num)
+ vsize first_page_num)
{
Page_spacing_result res;
Page_spacing space (page_height (first_page_num, false), this);
int system_count_on_this_page = 0;
while (system_count_on_this_page < systems_per_page_
- && line < cached_line_details_.size ())
- {
- Line_details const &cur_line = cached_line_details_[line];
- space.append_system (cur_line);
- system_count_on_this_page += cur_line.compressed_nontitle_lines_count_;
- line++;
+ && line < cached_line_details_.size ())
+ {
+ Line_details const &cur_line = cached_line_details_[line];
+ space.append_system (cur_line);
+ system_count_on_this_page += cur_line.compressed_nontitle_lines_count_;
+ line++;
- if (cur_line.page_permission_ == ly_symbol2scm ("force"))
- break;
- }
+ if (cur_line.page_permission_ == ly_symbol2scm ("force"))
+ break;
+ }
res.systems_per_page_.push_back (line - page_first_line);
res.force_.push_back (space.force_);
- res.penalty_ += cached_line_details_[line-1].page_penalty_;
+ res.penalty_ += cached_line_details_[line - 1].page_penalty_;
if (system_count_on_this_page != systems_per_page_)
- {
- res.penalty_ += abs (system_count_on_this_page - systems_per_page_) * TERRIBLE_SPACING_PENALTY;
- res.system_count_status_ |= ((system_count_on_this_page < systems_per_page_))
- ? SYSTEM_COUNT_TOO_FEW : SYSTEM_COUNT_TOO_MANY;
- }
+ {
+ res.penalty_ += abs (system_count_on_this_page - systems_per_page_) * TERRIBLE_SPACING_PENALTY;
+ res.system_count_status_ |= ((system_count_on_this_page < systems_per_page_))
+ ? SYSTEM_COUNT_TOO_FEW : SYSTEM_COUNT_TOO_MANY;
+ }
page_first_line = line;
}
Real prev_force = space.force_;
space.append_system (cached_line_details_[line]);
if ((line > page_first_line)
- && (isinf (space.force_)
- || ((line > 0)
- && (cached_line_details_[line-1].page_permission_ == ly_symbol2scm ("force")))))
- {
- res.systems_per_page_.push_back (line - page_first_line);
- res.force_.push_back (prev_force);
- res.penalty_ += cached_line_details_[line-1].page_penalty_;
- page++;
- space.resize (page_height (first_page_num + page, false));
- space.clear ();
+ && (isinf (space.force_)
+ || ((line > 0)
+ && (cached_line_details_[line - 1].page_permission_ == ly_symbol2scm ("force")))))
+ {
+ res.systems_per_page_.push_back (line - page_first_line);
+ res.force_.push_back (prev_force);
+ res.penalty_ += cached_line_details_[line - 1].page_penalty_;
+ page++;
+ space.resize (page_height (first_page_num + page, false));
+ space.clear ();
space.append_system (cached_line_details_[line]);
- page_first_line = line;
- }
+ page_first_line = line;
+ }
if (line == cached_line_details_.size () - 1)
- {
- /* This is the last line */
- /* When the last page height was computed, we did not know yet that it
- * was the last one. If the systems put on it don't fit anymore, the last
- * system is moved to a new page */
- space.resize (page_height (first_page_num + page, true));
- if ((line > page_first_line) && (isinf (space.force_)))
- {
- res.systems_per_page_.push_back (line - page_first_line);
- res.force_.push_back (prev_force);
- /* the last page containing the last line */
- space.resize (page_height (first_page_num + page + 1, true));
- space.clear ();
- space.append_system (cached_line_details_[line]);
- res.systems_per_page_.push_back (1);
- res.force_.push_back (space.force_);
- res.penalty_ += cached_line_details_[line-1].page_penalty_;
+ {
+ /* This is the last line */
+ /* When the last page height was computed, we did not know yet that it
+ * was the last one. If the systems put on it don't fit anymore, the last
+ * system is moved to a new page */
+ space.resize (page_height (first_page_num + page, true));
+ if ((line > page_first_line) && (isinf (space.force_)))
+ {
+ res.systems_per_page_.push_back (line - page_first_line);
+ res.force_.push_back (prev_force);
+ /* the last page containing the last line */
+ space.resize (page_height (first_page_num + page + 1, true));
+ space.clear ();
+ space.append_system (cached_line_details_[line]);
+ res.systems_per_page_.push_back (1);
+ res.force_.push_back (space.force_);
+ res.penalty_ += cached_line_details_[line - 1].page_penalty_;
res.penalty_ += cached_line_details_[line].page_penalty_;
- }
- else
- {
- res.systems_per_page_.push_back (line + 1 - page_first_line);
- res.force_.push_back (space.force_);
+ }
+ else
+ {
+ res.systems_per_page_.push_back (line + 1 - page_first_line);
+ res.force_.push_back (space.force_);
res.penalty_ += cached_line_details_[line].page_penalty_;
- }
- }
+ }
+ }
}
return finalize_spacing_result (configuration, res);
}
{
Real f = res.force_[i];
- page_demerits += min(f*f, BAD_SPACING_PENALTY);
+ page_demerits += min (f * f, BAD_SPACING_PENALTY);
}
/* for a while we tried averaging page and line forces across pages instead
for (vsize i = 0; i + 1 < cached_line_details_.size (); i++)
if (cached_line_details_[i].page_permission_ == ly_symbol2scm ("force"))
{
- vector<Line_details> lines1 (cached_line_details_.begin (), cached_line_details_.begin () + i + 1);
- vector<Line_details> lines2 (cached_line_details_.begin () + i + 1, cached_line_details_.end ());
- Page_spacing_result p1 = space_systems_on_1_page (lines1, page1_height, ragged1);
- Page_spacing_result p2 = space_systems_on_1_page (lines2, page2_height, ragged2);
-
- p1.systems_per_page_.push_back (p2.systems_per_page_[0]);
- p1.force_.push_back (p2.force_[0]);
- p1.penalty_ += p2.penalty_ - cached_line_details_[i].turn_penalty_;
- p1.system_count_status_ |= p2.system_count_status_;
- return p1;
+ vector<Line_details> lines1 (cached_line_details_.begin (), cached_line_details_.begin () + i + 1);
+ vector<Line_details> lines2 (cached_line_details_.begin () + i + 1, cached_line_details_.end ());
+ Page_spacing_result p1 = space_systems_on_1_page (lines1, page1_height, ragged1);
+ Page_spacing_result p2 = space_systems_on_1_page (lines2, page2_height, ragged2);
+
+ p1.systems_per_page_.push_back (p2.systems_per_page_[0]);
+ p1.force_.push_back (p2.force_[0]);
+ p1.penalty_ += p2.penalty_ - cached_line_details_[i].turn_penalty_;
+ p1.system_count_status_ |= p2.system_count_status_;
+ return p1;
}
vector<Real> page1_force;
page1_status[i] = line_count_status (page1_line_count);
if (ragged2)
- page2_force[page2_force.size () - 1 - i] =
- (page2.force_ < 0 && i + 1 < page1_force.size ()) ? infinity_f : 0;
+ page2_force[page2_force.size () - 1 - i]
+ = (page2.force_ < 0 && i + 1 < page1_force.size ()) ? infinity_f : 0;
else
- page2_force[page2_force.size () - 1 - i] = page2.force_;
+ page2_force[page2_force.size () - 1 - i] = page2.force_;
page2_penalty[page2_penalty.size () - 1 - i] = line_count_penalty (page2_line_count);
page2_status[page2_penalty.size () - 1 - i] = line_count_status (page2_line_count);
}
// constraints. That is, we penalize harshly when they don't happen
// but we don't completely reject.
Real dem = f
- + page1_penalty[i] + page2_penalty[i]
- + cached_line_details_[i+1].page_penalty_
- + cached_line_details_.back ().page_penalty_ + cached_line_details_.back ().turn_penalty_;
+ + page1_penalty[i] + page2_penalty[i]
+ + cached_line_details_[i + 1].page_penalty_
+ + cached_line_details_.back ().page_penalty_ + cached_line_details_.back ().turn_penalty_;
if (dem < best_demerits)
- {
- best_demerits = dem;
- best_sys_count = i+1;
- }
+ {
+ best_demerits = dem;
+ best_sys_count = i + 1;
+ }
}
Page_spacing_result ret;
ret.systems_per_page_.push_back (best_sys_count);
ret.systems_per_page_.push_back (cached_line_details_.size () - best_sys_count);
- ret.force_.push_back (page1_force[best_sys_count-1]);
- ret.force_.push_back (page2_force[best_sys_count-1]);
- ret.system_count_status_ = page1_status[best_sys_count-1] | page2_status[best_sys_count-1];
- ret.penalty_ = cached_line_details_[best_sys_count-1].page_penalty_
- + cached_line_details_.back ().page_penalty_
- + cached_line_details_.back ().turn_penalty_
- + page1_penalty[best_sys_count-1] + page2_penalty[best_sys_count-1];
+ ret.force_.push_back (page1_force[best_sys_count - 1]);
+ ret.force_.push_back (page2_force[best_sys_count - 1]);
+ ret.system_count_status_ = page1_status[best_sys_count - 1] | page2_status[best_sys_count - 1];
+ ret.penalty_ = cached_line_details_[best_sys_count - 1].page_penalty_
+ + cached_line_details_.back ().page_penalty_
+ + cached_line_details_.back ().turn_penalty_
+ + page1_penalty[best_sys_count - 1] + page2_penalty[best_sys_count - 1];
/* don't do finalize_spacing_result () because we are only an internal function */
return ret;
vsize
Page_breaking::last_break_position () const
{
- return breaks_.size () - 1;
+ return breaks_.size () - 1;
}
// This gives the minimum distance between the top of the
Real padding = 0;
Page_layout_problem::read_spacing_spec (first_system_spacing,
- &min_distance,
- ly_symbol2scm ("minimum-distance"));
+ &min_distance,
+ ly_symbol2scm ("minimum-distance"));
Page_layout_problem::read_spacing_spec (first_system_spacing,
- &padding,
- ly_symbol2scm ("padding"));
+ &padding,
+ ly_symbol2scm ("padding"));
// FIXME: take into account the height of the header
Real translate = max (line.shape_.begin_[UP], line.shape_.rest_[UP]);
Real padding = 0;
Page_layout_problem::read_spacing_spec (last_system_spacing,
- &min_distance,
- ly_symbol2scm ("minimum-distance"));
+ &min_distance,
+ ly_symbol2scm ("minimum-distance"));
Page_layout_problem::read_spacing_spec (last_system_spacing,
- &padding,
- ly_symbol2scm ("padding"));
+ &padding,
+ ly_symbol2scm ("padding"));
// FIXME: take into account the height of the footer
Real translate = min (line.shape_.begin_[DOWN], line.shape_.rest_[DOWN]);
for (SCM s = lines; scm_is_pair (s); s = scm_cdr (s))
{
if (Grob *g = unsmob_grob (scm_car (s)))
- {
- System *sys = dynamic_cast<System *> (g);
- if (!sys)
+ {
+ System *sys = dynamic_cast<System *> (g);
+ if (!sys)
{
programming_error ("got a grob for footnotes that wasn't a System");
continue;
TODO: This recalculates numbering every time this function is called, including once
after the balloon prints are called. Although it is not a huge computational drain,
it'd be more elegant to turn this calculation off when it is no longer needed.
-
+
In a separate commit, it'd be nice to streamline the way that page layout property
is handled so that the process of building `config's in page-breaking does result
in duplicated work, either by making this process less complicated or (preferably)
{
programming_error ("Your numbering function needs to return a stencil.");
markup = SCM_EOL;
- s = new Stencil (Box (Interval (0,0), Interval (0,0)), SCM_EOL);
+ s = new Stencil (Box (Interval (0, 0), Interval (0, 0)), SCM_EOL);
}
footnote_number_markups.push_back (markup);
footnote_number_stencils.push_back (s);
{
// Take care of musical systems.
if (Grob *g = unsmob_grob (scm_car (s)))
- {
- System *sys = dynamic_cast<System *> (g);
- if (!sys)
+ {
+ System *sys = dynamic_cast<System *> (g);
+ if (!sys)
{
programming_error ("got a grob for footnotes that wasn't a System");
continue;
}
- Stencil mol;
-
- for (vsize i = 0; i < sys->footnote_grobs ()->size (); i++)
- {
- Grob *footnote = sys->footnote_grobs ()->at (i);
- SCM footnote_markup = footnote->get_property ("footnote-text");
- if (Spanner *orig = dynamic_cast<Spanner *>(footnote))
- if (orig->is_broken ())
- footnote_markup = orig->broken_intos_[0]->get_property ("footnote-text");
-
- if (!Text_interface::is_markup (footnote_markup))
- continue;
-
- SCM props = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
- paper->self_scm ());
-
- SCM footnote_stl = Text_interface::interpret_markup (paper->self_scm (),
- props, footnote_markup);
-
- Stencil *footnote_stencil = unsmob_stencil (footnote_stl);
- if (do_numbering)
- {
- SCM annotation_scm = scm_car (in_text_numbers);
- footnote->set_property ("text", annotation_scm);
- if (Spanner *orig = dynamic_cast<Spanner *>(footnote))
- {
- orig->set_property ("text", annotation_scm);
- if (orig->is_broken ())
- for (vsize i = 0; i < orig->broken_intos_.size (); i++)
- orig->broken_intos_[i]->set_property ("text", annotation_scm);
- }
-
- Stencil *annotation = unsmob_stencil (scm_car (numbers));
- annotation->translate_axis (footnote_stencil->extent (Y_AXIS)[UP] + number_raise - annotation->extent(Y_AXIS)[UP], Y_AXIS);
- footnote_stencil->add_at_edge (X_AXIS, LEFT, *annotation, 0.0);
- numbers = scm_cdr (numbers);
- in_text_numbers = scm_cdr (in_text_numbers);
- }
- mol.add_at_edge (Y_AXIS, DOWN, *footnote_stencil, padding);
- }
- footnotes = scm_cons (mol.smobbed_copy (), footnotes);
+ Stencil mol;
+
+ for (vsize i = 0; i < sys->footnote_grobs ()->size (); i++)
+ {
+ Grob *footnote = sys->footnote_grobs ()->at (i);
+ SCM footnote_markup = footnote->get_property ("footnote-text");
+ if (Spanner *orig = dynamic_cast<Spanner *>(footnote))
+ if (orig->is_broken ())
+ footnote_markup = orig->broken_intos_[0]->get_property ("footnote-text");
+
+ if (!Text_interface::is_markup (footnote_markup))
+ continue;
+
+ SCM props = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
+ paper->self_scm ());
+
+ SCM footnote_stl = Text_interface::interpret_markup (paper->self_scm (),
+ props, footnote_markup);
+
+ Stencil *footnote_stencil = unsmob_stencil (footnote_stl);
+ if (do_numbering)
+ {
+ SCM annotation_scm = scm_car (in_text_numbers);
+ footnote->set_property ("text", annotation_scm);
+ if (Spanner *orig = dynamic_cast<Spanner *>(footnote))
+ {
+ orig->set_property ("text", annotation_scm);
+ if (orig->is_broken ())
+ for (vsize i = 0; i < orig->broken_intos_.size (); i++)
+ orig->broken_intos_[i]->set_property ("text", annotation_scm);
+ }
+
+ Stencil *annotation = unsmob_stencil (scm_car (numbers));
+ annotation->translate_axis (footnote_stencil->extent (Y_AXIS)[UP] + number_raise - annotation->extent (Y_AXIS)[UP], Y_AXIS);
+ footnote_stencil->add_at_edge (X_AXIS, LEFT, *annotation, 0.0);
+ numbers = scm_cdr (numbers);
+ in_text_numbers = scm_cdr (in_text_numbers);
+ }
+ mol.add_at_edge (Y_AXIS, DOWN, *footnote_stencil, padding);
+ }
+ footnotes = scm_cons (mol.smobbed_copy (), footnotes);
}
// Take care of top-level markups
else if (Prob *p = unsmob_prob (scm_car (s)))
if (!unsmob_stencil (in_text_stencil))
in_text_stencil = SCM_EOL;
number_footnote_table = scm_cons (scm_cons (scm_caar (st), in_text_stencil), number_footnote_table);
- annotation->translate_axis (mol.extent (Y_AXIS)[UP] + number_raise - annotation->extent(Y_AXIS)[UP], Y_AXIS);
+ annotation->translate_axis (mol.extent (Y_AXIS)[UP] + number_raise - annotation->extent (Y_AXIS)[UP], Y_AXIS);
mol.add_at_edge (X_AXIS, LEFT, *annotation, 0.0);
numbers = scm_cdr (numbers);
in_text_numbers = scm_cdr (in_text_numbers);
return scm_reverse (footnotes);
}
-Stencil*
+Stencil *
Page_layout_problem::get_footnote_separator_stencil (Output_def *paper)
{
SCM props = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
bool footnotes_found = false;
Real footnote_padding = robust_scm2double (pb->paper_->c_variable ("footnote-padding"), 0.0);
Real footnote_footer_padding = robust_scm2double (pb->paper_->c_variable ("footnote-footer-padding"), 0.0);
-
+
footnotes = scm_reverse (footnotes);
for (SCM s = footnotes; scm_is_pair (s); s = scm_cdr (s))
last_bottom_spacing = paper->c_variable ("last-bottom-spacing");
top_system_spacing = paper->c_variable ("top-system-spacing");
if (scm_is_pair (systems) && unsmob_prob (scm_car (systems)))
- top_system_spacing = paper->c_variable ("top-markup-spacing");
+ top_system_spacing = paper->c_variable ("top-markup-spacing");
// Note: the page height here does _not_ reserve space for headers and
// footers. This is because we want to anchor the top-system-spacing
// spring at the _top_ of the header.
page_height_ -= robust_scm2double (paper->c_variable ("top-margin"), 0)
- + robust_scm2double (paper->c_variable ("bottom-margin"), 0);
+ + robust_scm2double (paper->c_variable ("bottom-margin"), 0);
read_spacing_spec (top_system_spacing, &header_padding_, ly_symbol2scm ("padding"));
read_spacing_spec (last_bottom_spacing, &footer_padding_, ly_symbol2scm ("padding"));
}
bool last_system_was_title = false;
-
for (SCM s = systems; scm_is_pair (s); s = scm_cdr (s))
{
bool first = (s == systems);
if (Grob *g = unsmob_grob (scm_car (s)))
- {
- System *sys = dynamic_cast<System*> (g);
- if (!sys)
- {
- programming_error ("got a grob for vertical spacing that wasn't a System");
- continue;
- }
-
- SCM spec = system_system_spacing;
- if (first)
- spec = top_system_spacing;
- else if (last_system_was_title)
- spec = markup_system_spacing;
- else if (0 == Paper_column::get_rank (sys->get_bound (LEFT)))
- spec = score_system_spacing;
-
- Spring spring (0, 0);
- Real padding = 0.0;
- Real indent = line_dimensions_int (sys->paper_score ()->layout (), sys->get_rank ())[LEFT];
- alter_spring_from_spacing_spec (spec, &spring);
- read_spacing_spec (spec, &padding, ly_symbol2scm ("padding"));
-
- append_system (sys, spring, indent, padding);
- last_system_was_title = false;
- }
+ {
+ System *sys = dynamic_cast<System *> (g);
+ if (!sys)
+ {
+ programming_error ("got a grob for vertical spacing that wasn't a System");
+ continue;
+ }
+
+ SCM spec = system_system_spacing;
+ if (first)
+ spec = top_system_spacing;
+ else if (last_system_was_title)
+ spec = markup_system_spacing;
+ else if (0 == Paper_column::get_rank (sys->get_bound (LEFT)))
+ spec = score_system_spacing;
+
+ Spring spring (0, 0);
+ Real padding = 0.0;
+ Real indent = line_dimensions_int (sys->paper_score ()->layout (), sys->get_rank ())[LEFT];
+ alter_spring_from_spacing_spec (spec, &spring);
+ read_spacing_spec (spec, &padding, ly_symbol2scm ("padding"));
+
+ append_system (sys, spring, indent, padding);
+ last_system_was_title = false;
+ }
else if (Prob *p = unsmob_prob (scm_car (s)))
- {
- SCM spec = first ? top_system_spacing
- : (last_system_was_title ? markup_markup_spacing : score_markup_spacing);
- Spring spring (0, 0);
- Real padding = 0.0;
- alter_spring_from_spacing_spec (spec, &spring);
- read_spacing_spec (spec, &padding, ly_symbol2scm ("padding"));
-
- append_prob (p, spring, padding);
- last_system_was_title = true;
- }
+ {
+ SCM spec = first ? top_system_spacing
+ : (last_system_was_title ? markup_markup_spacing : score_markup_spacing);
+ Spring spring (0, 0);
+ Real padding = 0.0;
+ alter_spring_from_spacing_spec (spec, &spring);
+ read_spacing_spec (spec, &padding, ly_symbol2scm ("padding"));
+
+ append_prob (p, spring, padding);
+ last_system_was_title = true;
+ }
else
- programming_error ("got a system that was neither a Grob nor a Prob");
+ programming_error ("got a system that was neither a Grob nor a Prob");
}
Spring last_spring (0, 0);
// bottom-space has the flexibility that one can do it per-system.
// NOTE: bottom-space is misnamed since it is not stretchable space.
if (Prob *p = elements_.back ().prob)
- bottom_padding = robust_scm2double (p->get_property ("bottom-space"), 0);
+ bottom_padding = robust_scm2double (p->get_property ("bottom-space"), 0);
else if (elements_.back ().staves.size ())
- {
- SCM details = get_details (elements_.back ());
- bottom_padding = robust_scm2double (ly_assoc_get (ly_symbol2scm ("bottom-space"),
- details,
- SCM_BOOL_F),
- 0.0);
- }
+ {
+ SCM details = get_details (elements_.back ());
+ bottom_padding = robust_scm2double (ly_assoc_get (ly_symbol2scm ("bottom-space"),
+ details,
+ SCM_BOOL_F),
+ 0.0);
+ }
page_height_ -= bottom_padding;
}
}
}
void
-Page_layout_problem::append_system (System *sys, Spring const& spring, Real indent, Real padding)
+Page_layout_problem::append_system (System *sys, Spring const &spring, Real indent, Real padding)
{
Grob *align = sys->get_vertical_alignment ();
if (!align)
align->set_property ("positioning-done", SCM_BOOL_T);
extract_grob_set (align, "elements", all_elts);
- vector<Grob*> elts = filter_dead_elements (all_elts);
+ vector<Grob *> elts = filter_dead_elements (all_elts);
vector<Real> minimum_offsets = Align_interface::get_minimum_translations_without_min_dist (align, elts, Y_AXIS);
vector<Real> minimum_offsets_with_min_dist = Align_interface::get_minimum_translations (align, elts, Y_AXIS);
for (vsize i = 0; i < elts.size (); ++i)
{
if (is_spaceable (elts[i]))
- {
- // We don't add a spring for the first staff, since
- // we are only adding springs _between_ staves here.
- if (!found_spaceable_staff)
- {
- found_spaceable_staff = true;
- last_spaceable_staff = i;
- continue;
- }
-
- Spring spring (0.5, 0.0);
- SCM spec = elts[last_spaceable_staff]->get_property ("staff-staff-spacing");
- alter_spring_from_spacing_spec (spec, &spring);
-
- springs_.push_back (spring);
- Real min_distance = (found_spaceable_staff ? minimum_offsets_with_min_dist[last_spaceable_staff] : 0) - minimum_offsets_with_min_dist[i];
- springs_.back ().ensure_min_distance (min_distance);
-
- if (scm_is_pair (manual_dists))
- {
- if (scm_is_number (scm_car (manual_dists)))
- {
- Real dy = scm_to_double (scm_car (manual_dists));
-
- springs_.back ().set_distance (dy);
- springs_.back ().set_min_distance (dy);
- springs_.back ().set_inverse_stretch_strength (0);
- }
- manual_dists = scm_cdr (manual_dists);
- }
- last_spaceable_staff = i;
- }
+ {
+ // We don't add a spring for the first staff, since
+ // we are only adding springs _between_ staves here.
+ if (!found_spaceable_staff)
+ {
+ found_spaceable_staff = true;
+ last_spaceable_staff = i;
+ continue;
+ }
+
+ Spring spring (0.5, 0.0);
+ SCM spec = elts[last_spaceable_staff]->get_property ("staff-staff-spacing");
+ alter_spring_from_spacing_spec (spec, &spring);
+
+ springs_.push_back (spring);
+ Real min_distance = (found_spaceable_staff ? minimum_offsets_with_min_dist[last_spaceable_staff] : 0) - minimum_offsets_with_min_dist[i];
+ springs_.back ().ensure_min_distance (min_distance);
+
+ if (scm_is_pair (manual_dists))
+ {
+ if (scm_is_number (scm_car (manual_dists)))
+ {
+ Real dy = scm_to_double (scm_car (manual_dists));
+
+ springs_.back ().set_distance (dy);
+ springs_.back ().set_min_distance (dy);
+ springs_.back ().set_inverse_stretch_strength (0);
+ }
+ manual_dists = scm_cdr (manual_dists);
+ }
+ last_spaceable_staff = i;
+ }
}
// Corner case: there was only one staff, and it wasn't spaceable.
}
void
-Page_layout_problem::append_prob (Prob *prob, Spring const& spring, Real padding)
+Page_layout_problem::append_prob (Prob *prob, Spring const &spring, Real padding)
{
Skyline_pair *sky = Skyline_pair::unsmob (prob->get_property ("vertical-skylines"));
Real minimum_distance = 0;
if (!spacer.fits ())
{
Real overflow = spacer.configuration_length (spacer.force ())
- - page_height_;
+ - page_height_;
if (ragged && overflow < 1e-6)
- warning (_ ("cannot fit music on page: ragged-spacing was requested, but page was compressed"));
+ warning (_ ("cannot fit music on page: ragged-spacing was requested, but page was compressed"));
else
- {
- warning (_f ("cannot fit music on page: overflow is %f",
- overflow));
- warning (_ ("compressing music to fit"));
- vsize space_count = solution_.size ();
- Real spacing_increment = overflow / (space_count - 2);
- for (vsize i = 2; i < space_count; i++)
- solution_[i] -= (i-1) * spacing_increment;
- }
+ {
+ warning (_f ("cannot fit music on page: overflow is %f",
+ overflow));
+ warning (_ ("compressing music to fit"));
+ vsize space_count = solution_.size ();
+ Real spacing_increment = overflow / (space_count - 2);
+ for (vsize i = 2; i < space_count; i++)
+ solution_[i] -= (i - 1) * spacing_increment;
+ }
}
}
// spring_idx 0 is the top of the page. Interesting values start from 1.
vsize spring_idx = 1;
- vector<Grob*> loose_lines;
+ vector<Grob *> loose_lines;
vector<Real> loose_line_min_distances;
Grob *last_spaceable_line = 0;
Real last_spaceable_line_translation = 0;
for (vsize i = 0; i < elements_.size (); ++i)
{
if (elements_[i].prob)
- {
- *tail = scm_cons (scm_from_double (solution_[spring_idx]), SCM_EOL);
- tail = SCM_CDRLOC (*tail);
- Interval prob_extent = unsmob_stencil (elements_[i].prob->get_property ("stencil"))->extent (Y_AXIS);
-
- // Lay out any non-spaceable lines between this line and
- // the last one.
- if (loose_lines.size ())
- {
- Interval loose_extent = loose_lines.back ()->extent (loose_lines.back (), Y_AXIS);
- Real min_distance = (-loose_extent[DOWN] + prob_extent[UP]
- + elements_[i].padding);
-
- loose_line_min_distances.push_back (min_distance);
- loose_lines.push_back (0);
-
- distribute_loose_lines (loose_lines, loose_line_min_distances,
- last_spaceable_line_translation, -solution_[spring_idx]);
- loose_lines.clear ();
- loose_line_min_distances.clear ();
- }
-
- last_spaceable_line = 0;
- last_spaceable_line_translation = -solution_[spring_idx];
- last_title_extent = prob_extent;
- spring_idx++;
- }
+ {
+ *tail = scm_cons (scm_from_double (solution_[spring_idx]), SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ Interval prob_extent = unsmob_stencil (elements_[i].prob->get_property ("stencil"))->extent (Y_AXIS);
+
+ // Lay out any non-spaceable lines between this line and
+ // the last one.
+ if (loose_lines.size ())
+ {
+ Interval loose_extent = loose_lines.back ()->extent (loose_lines.back (), Y_AXIS);
+ Real min_distance = (-loose_extent[DOWN] + prob_extent[UP]
+ + elements_[i].padding);
+
+ loose_line_min_distances.push_back (min_distance);
+ loose_lines.push_back (0);
+
+ distribute_loose_lines (loose_lines, loose_line_min_distances,
+ last_spaceable_line_translation, -solution_[spring_idx]);
+ loose_lines.clear ();
+ loose_line_min_distances.clear ();
+ }
+
+ last_spaceable_line = 0;
+ last_spaceable_line_translation = -solution_[spring_idx];
+ last_title_extent = prob_extent;
+ spring_idx++;
+ }
else
- {
- // Getting this signs right here is a little tricky. The configuration
- // we return has zero at the top of the page and positive numbers further
- // down, as does the solution_ vector. Within a staff, however, positive
- // numbers are up.
- // TODO: perhaps change the way the page 'configuration variable works so
- // that it is consistent with the usual up/down sign conventions in
- // Lilypond. Then this would be less confusing.
-
- // These two positions are relative to the page (with positive numbers being
- // down).
- Real first_staff_position = solution_[spring_idx];
- Real first_staff_min_translation = elements_[i].min_offsets.size () ? elements_[i].min_offsets[0] : 0;
- Real system_position = first_staff_position + first_staff_min_translation;
-
- // Position the staves within this system.
- vector<Real> const& min_offsets = elements_[i].min_offsets;
- bool found_spaceable_staff = false;
- for (vsize staff_idx = 0; staff_idx < elements_[i].staves.size (); ++staff_idx)
- {
- Grob *staff = elements_[i].staves[staff_idx];
- staff->set_property ("system-Y-offset", scm_from_double (-system_position));
-
- if (is_spaceable (staff))
- {
- // this is relative to the system: negative numbers are down.
- staff->translate_axis (system_position - solution_[spring_idx], Y_AXIS);
-
- // Lay out any non-spaceable lines between this line and
- // the last one.
- if (loose_lines.size ())
- {
- if (staff_idx)
- loose_line_min_distances.push_back (min_offsets[staff_idx-1] - min_offsets[staff_idx]);
- else
- loose_line_min_distances.push_back (elements_[i].padding - min_offsets[staff_idx]);
- loose_lines.push_back (staff);
-
- distribute_loose_lines (loose_lines, loose_line_min_distances,
- last_spaceable_line_translation, -solution_[spring_idx]);
- loose_lines.clear ();
- loose_line_min_distances.clear ();
- }
- last_spaceable_line = staff;
- last_spaceable_line_translation = -solution_[spring_idx];
- found_spaceable_staff = true;
- spring_idx++;
- }
- else
- {
- if (loose_lines.empty ())
- loose_lines.push_back (last_spaceable_line);
-
- if (staff_idx)
- // NOTE: the way we do distances between loose lines (and other lines too, actually)
- // is not the most accurate way possible: we only insert rods between adjacent
- // lines. To be more accurate, we could insert rods between non-adjacent lines
- // using a scheme similar to the one in set_column_rods.
- loose_line_min_distances.push_back (min_offsets[staff_idx-1] - min_offsets[staff_idx]);
- else
- { // this is the first line in a system
- Real min_dist = 0;
- if (loose_lines.back ())
- // distance to the final line in the preceding system,
- // including 'system-system-spacing 'padding
- min_dist = (Axis_group_interface::minimum_distance (loose_lines.back (),
- staff,
- Y_AXIS)
- + elements_[i].padding);
- else if (!last_title_extent.is_empty ())
- // distance to the preceding title,
- // including 'markup-system-spacing 'padding
- min_dist = (staff->extent (staff, Y_AXIS)[UP] - last_title_extent[DOWN]
- + elements_[i].padding);
- else // distance to the top margin
- min_dist = header_padding_ + header_height_ + staff->extent (staff, Y_AXIS)[UP];
-
- loose_line_min_distances.push_back (min_dist);
- }
- loose_lines.push_back (staff);
- }
- }
-
- // Corner case: even if a system has no live staves, it still takes up
- // one spring (a system with one live staff also takes up one spring),
- // which we need to increment past.
- if (!found_spaceable_staff)
- spring_idx++;
-
- *tail = scm_cons (scm_from_double (system_position), SCM_EOL);
- tail = SCM_CDRLOC (*tail);
- }
+ {
+ // Getting this signs right here is a little tricky. The configuration
+ // we return has zero at the top of the page and positive numbers further
+ // down, as does the solution_ vector. Within a staff, however, positive
+ // numbers are up.
+ // TODO: perhaps change the way the page 'configuration variable works so
+ // that it is consistent with the usual up/down sign conventions in
+ // Lilypond. Then this would be less confusing.
+
+ // These two positions are relative to the page (with positive numbers being
+ // down).
+ Real first_staff_position = solution_[spring_idx];
+ Real first_staff_min_translation = elements_[i].min_offsets.size () ? elements_[i].min_offsets[0] : 0;
+ Real system_position = first_staff_position + first_staff_min_translation;
+
+ // Position the staves within this system.
+ vector<Real> const &min_offsets = elements_[i].min_offsets;
+ bool found_spaceable_staff = false;
+ for (vsize staff_idx = 0; staff_idx < elements_[i].staves.size (); ++staff_idx)
+ {
+ Grob *staff = elements_[i].staves[staff_idx];
+ staff->set_property ("system-Y-offset", scm_from_double (-system_position));
+
+ if (is_spaceable (staff))
+ {
+ // this is relative to the system: negative numbers are down.
+ staff->translate_axis (system_position - solution_[spring_idx], Y_AXIS);
+
+ // Lay out any non-spaceable lines between this line and
+ // the last one.
+ if (loose_lines.size ())
+ {
+ if (staff_idx)
+ loose_line_min_distances.push_back (min_offsets[staff_idx - 1] - min_offsets[staff_idx]);
+ else
+ loose_line_min_distances.push_back (elements_[i].padding - min_offsets[staff_idx]);
+ loose_lines.push_back (staff);
+
+ distribute_loose_lines (loose_lines, loose_line_min_distances,
+ last_spaceable_line_translation, -solution_[spring_idx]);
+ loose_lines.clear ();
+ loose_line_min_distances.clear ();
+ }
+ last_spaceable_line = staff;
+ last_spaceable_line_translation = -solution_[spring_idx];
+ found_spaceable_staff = true;
+ spring_idx++;
+ }
+ else
+ {
+ if (loose_lines.empty ())
+ loose_lines.push_back (last_spaceable_line);
+
+ if (staff_idx)
+ // NOTE: the way we do distances between loose lines (and other lines too, actually)
+ // is not the most accurate way possible: we only insert rods between adjacent
+ // lines. To be more accurate, we could insert rods between non-adjacent lines
+ // using a scheme similar to the one in set_column_rods.
+ loose_line_min_distances.push_back (min_offsets[staff_idx - 1] - min_offsets[staff_idx]);
+ else
+ {
+ // this is the first line in a system
+ Real min_dist = 0;
+ if (loose_lines.back ())
+ // distance to the final line in the preceding system,
+ // including 'system-system-spacing 'padding
+ min_dist = (Axis_group_interface::minimum_distance (loose_lines.back (),
+ staff,
+ Y_AXIS)
+ + elements_[i].padding);
+ else if (!last_title_extent.is_empty ())
+ // distance to the preceding title,
+ // including 'markup-system-spacing 'padding
+ min_dist = (staff->extent (staff, Y_AXIS)[UP] - last_title_extent[DOWN]
+ + elements_[i].padding);
+ else // distance to the top margin
+ min_dist = header_padding_ + header_height_ + staff->extent (staff, Y_AXIS)[UP];
+
+ loose_line_min_distances.push_back (min_dist);
+ }
+ loose_lines.push_back (staff);
+ }
+ }
+
+ // Corner case: even if a system has no live staves, it still takes up
+ // one spring (a system with one live staff also takes up one spring),
+ // which we need to increment past.
+ if (!found_spaceable_staff)
+ spring_idx++;
+
+ *tail = scm_cons (scm_from_double (system_position), SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ }
}
if (loose_lines.size ())
loose_lines.push_back (0);
distribute_loose_lines (loose_lines, loose_line_min_distances,
- last_spaceable_line_translation, -page_height_);
+ last_spaceable_line_translation, -page_height_);
}
// them.
// first_translation and last_translation are relative to the page.
void
-Page_layout_problem::distribute_loose_lines (vector<Grob*> const &loose_lines,
- vector<Real> const &min_distances,
- Real first_translation, Real last_translation)
+Page_layout_problem::distribute_loose_lines (vector<Grob *> const &loose_lines,
+ vector<Real> const &min_distances,
+ Real first_translation, Real last_translation)
{
Simple_spacer spacer;
for (vsize i = 0; i + 1 < loose_lines.size (); ++i)
{
- SCM spec = get_spacing_spec (loose_lines[i], loose_lines[i+1], false, 0, INT_MAX);
+ SCM spec = get_spacing_spec (loose_lines[i], loose_lines[i + 1], false, 0, INT_MAX);
Spring spring (1.0, 0.0);
alter_spring_from_spacing_spec (spec, &spring);
spring.ensure_min_distance (min_distances[i]);
// The upper skyline is relative to the top staff; the lower skyline is relative to
// the bottom staff.
void
-Page_layout_problem::build_system_skyline (vector<Grob*> const& staves,
- vector<Real> const& minimum_translations,
- Skyline *up,
- Skyline *down)
+Page_layout_problem::build_system_skyline (vector<Grob *> const &staves,
+ vector<Real> const &minimum_translations,
+ Skyline *up,
+ Skyline *down)
{
if (minimum_translations.empty ())
return;
Grob *g = staves[i];
Skyline_pair *sky = Skyline_pair::unsmob (g->get_property ("vertical-skylines"));
if (sky)
- {
- up->raise (-dy);
- up->merge ((*sky)[UP]);
- up->raise (dy);
-
- down->raise (-dy);
- down->merge ((*sky)[DOWN]);
- down->raise (dy);
- }
+ {
+ up->raise (-dy);
+ up->merge ((*sky)[UP]);
+ up->raise (dy);
+
+ down->raise (-dy);
+ down->merge ((*sky)[DOWN]);
+ down->raise (dy);
+ }
if (is_spaceable (staves[i]))
- {
- if (!found_spaceable_staff)
- {
- found_spaceable_staff = true;
- first_spaceable_dy = dy;
- }
- last_spaceable_dy = dy;
- }
+ {
+ if (!found_spaceable_staff)
+ {
+ found_spaceable_staff = true;
+ first_spaceable_dy = dy;
+ }
+ last_spaceable_dy = dy;
+ }
}
// Leave the up skyline at a position relative
}
Interval
-Page_layout_problem::first_staff_extent (Element const& e)
+Page_layout_problem::first_staff_extent (Element const &e)
{
if (e.prob)
return prob_extent (e.prob);
}
Interval
-Page_layout_problem::last_staff_extent (Element const& e)
+Page_layout_problem::last_staff_extent (Element const &e)
{
if (e.prob)
return prob_extent (e.prob);
}
SCM
-Page_layout_problem::get_details (Element const& elt)
+Page_layout_problem::get_details (Element const &elt)
{
if (elt.staves.empty ())
return SCM_EOL;
SCM
Page_layout_problem::get_details (Grob *g)
{
- Grob *left_bound = dynamic_cast<Spanner*> (g)->get_bound (LEFT);
+ Grob *left_bound = dynamic_cast<Spanner *> (g)->get_bound (LEFT);
return left_bound->get_property ("line-break-system-details");
}
}
bool
-Page_layout_problem::read_spacing_spec (SCM spec, Real* dest, SCM sym)
+Page_layout_problem::read_spacing_spec (SCM spec, Real *dest, SCM sym)
{
SCM pair = scm_sloppy_assq (sym, spec);
if (scm_is_pair (pair) && scm_is_number (scm_cdr (pair)))
Real
Page_layout_problem::get_fixed_spacing (Grob *before, Grob *after, int spaceable_index, bool pure, int start, int end)
{
- Spanner *after_sp = dynamic_cast<Spanner*> (after);
+ Spanner *after_sp = dynamic_cast<Spanner *> (after);
SCM cache_symbol = (is_spaceable (before) && is_spaceable (after))
- ? ly_symbol2scm ("spaceable-fixed-spacing")
- : ly_symbol2scm ("loose-fixed-spacing");
+ ? ly_symbol2scm ("spaceable-fixed-spacing")
+ : ly_symbol2scm ("loose-fixed-spacing");
if (pure)
{
// The result of this function doesn't depend on "end," so we can reduce the
// size of the cache by ignoring it.
SCM cached = after_sp->get_cached_pure_property (cache_symbol, start, 0);
if (scm_is_number (cached))
- return robust_scm2double (cached, 0.0);
+ return robust_scm2double (cached, 0.0);
}
Real ret = -infinity_f;
SCM details = left_bound->get_property ("line-break-system-details");
SCM manual_dists = ly_assoc_get (ly_symbol2scm ("alignment-distances"), details, SCM_EOL);
if (scm_is_pair (manual_dists))
- {
- SCM forced = robust_list_ref (spaceable_index - 1, manual_dists);
- if (scm_is_number (forced))
- ret = max (ret, scm_to_double (forced));
- }
+ {
+ SCM forced = robust_list_ref (spaceable_index - 1, manual_dists);
+ if (scm_is_number (forced))
+ ret = max (ret, scm_to_double (forced));
+ }
}
// Cache the result. As above, we ignore "end."
if (is_spaceable (before))
{
if (is_spaceable (after))
- return before->get_maybe_pure_property ("staff-staff-spacing", pure, start, end);
+ return before->get_maybe_pure_property ("staff-staff-spacing", pure, start, end);
else
- {
- Direction affinity = to_dir (after->get_maybe_pure_property ("staff-affinity", pure, start, end));
- return (affinity == DOWN)
- ? add_stretchability (after->get_maybe_pure_property ("nonstaff-unrelatedstaff-spacing", pure, start, end),
- LARGE_STRETCH)
- : after->get_maybe_pure_property ("nonstaff-relatedstaff-spacing", pure, start, end);
- }
+ {
+ Direction affinity = to_dir (after->get_maybe_pure_property ("staff-affinity", pure, start, end));
+ return (affinity == DOWN)
+ ? add_stretchability (after->get_maybe_pure_property ("nonstaff-unrelatedstaff-spacing", pure, start, end),
+ LARGE_STRETCH)
+ : after->get_maybe_pure_property ("nonstaff-relatedstaff-spacing", pure, start, end);
+ }
}
else
{
if (is_spaceable (after))
- {
- Direction affinity = to_dir (before->get_maybe_pure_property ("staff-affinity", pure, start, end));
- return (affinity == UP)
- ? add_stretchability (before->get_maybe_pure_property ("nonstaff-unrelatedstaff-spacing", pure, start, end),
- LARGE_STRETCH)
- : before->get_maybe_pure_property ("nonstaff-relatedstaff-spacing", pure, start, end);
- }
+ {
+ Direction affinity = to_dir (before->get_maybe_pure_property ("staff-affinity", pure, start, end));
+ return (affinity == UP)
+ ? add_stretchability (before->get_maybe_pure_property ("nonstaff-unrelatedstaff-spacing", pure, start, end),
+ LARGE_STRETCH)
+ : before->get_maybe_pure_property ("nonstaff-relatedstaff-spacing", pure, start, end);
+ }
else
- {
- Direction before_affinity = to_dir (before->get_maybe_pure_property ("staff-affinity", pure, start, end));
- Direction after_affinity = to_dir (after->get_maybe_pure_property ("staff-affinity", pure, start, end));
- static bool warned = false;
- if (after_affinity > before_affinity
- && !warned && !pure)
- {
- warning (_ ("staff-affinities should only decrease"));
- warned = true;
- }
- if (before_affinity != UP)
- return before->get_maybe_pure_property ("nonstaff-nonstaff-spacing", pure, start, end);
- else if (after_affinity != DOWN)
- return before->get_maybe_pure_property ("nonstaff-nonstaff-spacing", pure, start, end);
- return add_stretchability (before->get_maybe_pure_property ("nonstaff-unrelatedstaff-spacing", pure, start, end),
- LARGE_STRETCH);
- }
+ {
+ Direction before_affinity = to_dir (before->get_maybe_pure_property ("staff-affinity", pure, start, end));
+ Direction after_affinity = to_dir (after->get_maybe_pure_property ("staff-affinity", pure, start, end));
+ static bool warned = false;
+ if (after_affinity > before_affinity
+ && !warned && !pure)
+ {
+ warning (_ ("staff-affinities should only decrease"));
+ warned = true;
+ }
+ if (before_affinity != UP)
+ return before->get_maybe_pure_property ("nonstaff-nonstaff-spacing", pure, start, end);
+ else if (after_affinity != DOWN)
+ return before->get_maybe_pure_property ("nonstaff-nonstaff-spacing", pure, start, end);
+ return add_stretchability (before->get_maybe_pure_property ("nonstaff-unrelatedstaff-spacing", pure, start, end),
+ LARGE_STRETCH);
+ }
}
assert (0);
}
void
-Page_layout_problem::alter_spring_from_spacing_spec (SCM spec, Spring* spring)
+Page_layout_problem::alter_spring_from_spacing_spec (SCM spec, Spring *spring)
{
Real space;
Real stretch;
spring->set_inverse_stretch_strength (stretch);
}
-vector<Grob*>
-Page_layout_problem::filter_dead_elements (vector<Grob*> const& input)
+vector<Grob *>
+Page_layout_problem::filter_dead_elements (vector<Grob *> const &input)
{
- vector<Grob*> output;
+ vector<Grob *> output;
for (vsize i = 0; i < input.size (); ++i)
{
if (Hara_kiri_group_spanner::has_interface (input[i]))
- Hara_kiri_group_spanner::consider_suicide (input[i]);
+ Hara_kiri_group_spanner::consider_suicide (input[i]);
if (input[i]->is_live ())
- output.push_back (input[i]);
+ output.push_back (input[i]);
}
return output;
#include "page-marker.hh"
LY_DEFINE (ly_make_page_permission_marker, "ly:make-page-permission-marker",
- 2, 0, 0,
- (SCM symbol, SCM permission),
- "Return page marker with page breaking and turning permissions.")
+ 2, 0, 0,
+ (SCM symbol, SCM permission),
+ "Return page marker with page breaking and turning permissions.")
{
LY_ASSERT_TYPE (ly_is_symbol, symbol, 1);
Page_marker *page_marker = new Page_marker ();
}
LY_DEFINE (ly_make_page_label_marker, "ly:make-page-label-marker",
- 1, 0, 0,
- (SCM label),
- "Return page marker with label @var{label}.")
+ 1, 0, 0,
+ (SCM label),
+ "Return page marker with label @var{label}.")
{
LY_ASSERT_TYPE (ly_is_symbol, label, 1);
Page_marker *page_marker = new Page_marker ();
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2007--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
vsize
Page_spacing_result::page_count () const
{
- return systems_per_page_.size();
+ return systems_per_page_.size ();
}
Real
void
Page_spacing_result::print () const
{
- printf ("penalty %lf, demerits %lf\n" , penalty_, demerits_);
+ printf ("penalty %lf, demerits %lf\n", penalty_, demerits_);
for (vsize i = 0; i < page_count (); i++)
printf (" %d: #sys=%d, force=%lf\n", int (i), int (systems_per_page_[i]),
- force_[i]);
+ force_[i]);
}
Page_spacing::calc_force ()
{
Real height = page_height_
- - breaker_->min_whitespace_at_top_of_page (first_line_)
- - breaker_->min_whitespace_at_bottom_of_page (last_line_);
+ - breaker_->min_whitespace_at_top_of_page (first_line_)
+ - breaker_->min_whitespace_at_bottom_of_page (last_line_);
if (rod_height_ + last_line_.bottom_padding_ >= height)
force_ = -infinity_f;
else
force_ = (height - rod_height_ - last_line_.bottom_padding_ - spring_len_)
- / max (0.1, inverse_spring_k_);
+ / max (0.1, inverse_spring_k_);
}
void
}
return (footnote_height
- - (has_footnotes_
- ? breaker_->footnote_padding () + breaker_->footnote_footer_padding ()
- : 0.0));
+ - (has_footnotes_
+ ? breaker_->footnote_padding () + breaker_->footnote_footer_padding ()
+ : 0.0));
}
void
rod_height_ -= first_line_.full_height ();
rod_height_ += first_line_.tallness_;
- rod_height_ += line.full_height();
+ rod_height_ += line.full_height ();
rod_height_ += account_for_footnotes (line);
inverse_spring_k_ += line.inverse_hooke_;
has_footnotes_ = false;
}
-
Page_spacer::Page_spacer (vector<Line_details> const &lines, vsize first_page_num, Page_breaking const *breaker)
: lines_ (lines)
{
{
simple_state_.resize (lines_.size ());
for (vsize i = 0; i < lines_.size (); ++i)
- calc_subproblem (VPOS, i);
+ calc_subproblem (VPOS, i);
}
Page_spacing_result ret;
ret.penalty_ = simple_state_.back ().penalty_
- + lines_.back ().page_penalty_ + lines_.back ().turn_penalty_;
+ + lines_.back ().page_penalty_ + lines_.back ().turn_penalty_;
ret.system_count_status_ = simple_state_.back ().system_count_status_;
vsize system = lines_.size () - 1;
while (system != VPOS)
{
- Page_spacing_node const& cur = simple_state_[system];
+ Page_spacing_node const &cur = simple_state_[system];
vsize system_count = (cur.prev_ == VPOS) ? system + 1 : system - cur.prev_;
ret.force_.push_back (cur.force_);
vsize extra_systems = 0;
vsize extra_pages = 0;
- if (isinf (state_.at (system, page_count-1).demerits_))
+ if (isinf (state_.at (system, page_count - 1).demerits_))
{
programming_error ("tried to space systems on a bad number of pages");
/* Usually, this means that we tried to cram too many systems into
- to few pages. To avoid crashing, we look for the largest number of
- systems that we can fit properly onto the right number of pages.
- All the systems that don't fit get tacked onto the last page.
+ to few pages. To avoid crashing, we look for the largest number of
+ systems that we can fit properly onto the right number of pages.
+ All the systems that don't fit get tacked onto the last page.
*/
vsize i;
- for (i = system; isinf (state_.at (i, page_count-1).demerits_) && i; i--)
- ;
+ for (i = system; isinf (state_.at (i, page_count - 1).demerits_) && i; i--)
+ ;
if (i)
- {
- extra_systems = system - i;
- system = i;
- }
+ {
+ extra_systems = system - i;
+ system = i;
+ }
else
- {
- /* try chopping off pages from the end */
- vsize j;
- for (j = page_count; j && isinf (state_.at (system, j-1).demerits_); j--)
- ;
-
- if (j)
- {
- extra_pages = page_count - j;
- page_count = j;
- }
- else
- return Page_spacing_result (); /* couldn't salvage it -- probably going to crash */
- }
+ {
+ /* try chopping off pages from the end */
+ vsize j;
+ for (j = page_count; j && isinf (state_.at (system, j - 1).demerits_); j--)
+ ;
+
+ if (j)
+ {
+ extra_pages = page_count - j;
+ page_count = j;
+ }
+ else
+ return Page_spacing_result (); /* couldn't salvage it -- probably going to crash */
+ }
}
ret.force_.resize (page_count);
ret.systems_per_page_.resize (page_count);
- ret.system_count_status_ = state_.at (system, page_count-1).system_count_status_;
- ret.penalty_ = state_.at (system, page_count-1).penalty_
- + lines_.back ().page_penalty_ + lines_.back ().turn_penalty_;
+ ret.system_count_status_ = state_.at (system, page_count - 1).system_count_status_;
+ ret.penalty_ = state_.at (system, page_count - 1).penalty_
+ + lines_.back ().page_penalty_ + lines_.back ().turn_penalty_;
ret.demerits_ = 0;
for (vsize p = page_count; p--;)
ret.force_[p] = ps.force_;
ret.demerits_ += ps.force_ * ps.force_;
if (p == 0)
- ret.systems_per_page_[p] = system + 1;
+ ret.systems_per_page_[p] = system + 1;
else
- ret.systems_per_page_[p] = system - ps.prev_;
+ ret.systems_per_page_[p] = system - ps.prev_;
system = ps.prev_;
}
for (vsize page = max_page_count_; page < page_count; page++)
for (vsize line = page; line < lines_.size (); line++)
if (!calc_subproblem (page, line))
- break;
+ break;
max_page_count_ = page_count;
}
vsize page_num = page == VPOS ? 0 : page;
Real paper_height = breaker_->paper_height ();
Page_spacing space (breaker_->page_height (page_num + first_page_num_, last),
- breaker_);
+ breaker_);
Page_spacing_node &cur = page == VPOS ? simple_state_[line] : state_.at (line, page);
bool ragged = ragged_ || (ragged_last_ && last);
int line_count = 0;
- for (vsize page_start = line+1; page_start > page_num && page_start--;)
+ for (vsize page_start = line + 1; page_start > page_num && page_start--;)
{
Page_spacing_node const *prev = 0;
if (page == VPOS)
- {
- if (page_start > 0)
- {
- prev = &simple_state_[page_start-1];
- space.resize (breaker_->page_height (prev->page_ + 1, last));
- }
- else
- space.resize (breaker_->page_height (first_page_num_, last));
- }
+ {
+ if (page_start > 0)
+ {
+ prev = &simple_state_[page_start - 1];
+ space.resize (breaker_->page_height (prev->page_ + 1, last));
+ }
+ else
+ space.resize (breaker_->page_height (first_page_num_, last));
+ }
else if (page > 0)
- prev = &state_.at (page_start-1, page-1);
+ prev = &state_.at (page_start - 1, page - 1);
space.prepend_system (lines_[page_start]);
bool overfull = (space.rod_height_ > paper_height
- || (ragged
- && (space.rod_height_ + space.spring_len_ > paper_height)));
+ || (ragged
+ && (space.rod_height_ + space.spring_len_ > paper_height)));
// This 'if' statement is a little hard to parse. It won't consider this configuration
// if it is overfull unless the current configuration is the first one with this start
// point. We also make an exception (and consider this configuration) if the previous
// configuration we tried had fewer lines than min-systems-per-page.
if (!breaker_->too_few_lines (line_count)
- && page_start < line
- && overfull)
- break;
+ && page_start < line
+ && overfull)
+ break;
line_count += lines_[page_start].compressed_nontitle_lines_count_;
if (page > 0 || page_start == 0)
- {
- // If the last page is ragged, set its force to zero. This way, we will leave
- // the last page half-empty rather than trying to balance things out
- // (which only makes sense in non-ragged situations).
- if (line == lines_.size () - 1 && ragged && last && space.force_ > 0)
- space.force_ = 0;
-
- Real demerits = space.force_ * space.force_;
-
- // Clamp the demerits at BAD_SPACING_PENALTY, even if the page
- // is overfull. This ensures that TERRIBLE_SPACING_PENALTY takes
- // precedence over overfull pages.
- demerits = min (demerits, BAD_SPACING_PENALTY);
- demerits += (prev ? prev->demerits_ : 0);
-
- Real penalty = breaker_->line_count_penalty (line_count);
- if (page_start > 0)
- penalty += lines_[page_start-1].page_penalty_
- + (page % 2 == 0) ? lines_[page_start-1].turn_penalty_ : 0;
-
- /* Deal with widow/orphan lines */
- /* Last line of paragraph is first line on the new page */
- if ((page_start > 0) &&
- (page_start < lines_.size ()) &&
- (lines_[page_start].last_markup_line_))
- penalty += breaker_->orphan_penalty ();
- /* First line of paragraph is last line on the previous page */
- if ((page_start > 0) &&
- (page_start < lines_.size ()) &&
- (lines_[page_start-1].first_markup_line_))
- penalty += breaker_->orphan_penalty ();
-
- demerits += penalty;
- if (demerits < cur.demerits_ || page_start == line)
- {
- cur.demerits_ = demerits;
- cur.force_ = space.force_;
- cur.penalty_ = penalty + (prev ? prev->penalty_ : 0);
- cur.system_count_status_ = breaker_->line_count_status (line_count)
- | (prev ? prev->system_count_status_ : 0);
- cur.prev_ = page_start - 1;
- cur.page_ = prev ? prev->page_ + 1 : first_page_num_;
- }
- }
+ {
+ // If the last page is ragged, set its force to zero. This way, we will leave
+ // the last page half-empty rather than trying to balance things out
+ // (which only makes sense in non-ragged situations).
+ if (line == lines_.size () - 1 && ragged && last && space.force_ > 0)
+ space.force_ = 0;
+
+ Real demerits = space.force_ * space.force_;
+
+ // Clamp the demerits at BAD_SPACING_PENALTY, even if the page
+ // is overfull. This ensures that TERRIBLE_SPACING_PENALTY takes
+ // precedence over overfull pages.
+ demerits = min (demerits, BAD_SPACING_PENALTY);
+ demerits += (prev ? prev->demerits_ : 0);
+
+ Real penalty = breaker_->line_count_penalty (line_count);
+ if (page_start > 0)
+ penalty += lines_[page_start - 1].page_penalty_
+ + (page % 2 == 0) ? lines_[page_start - 1].turn_penalty_ : 0;
+
+ /* Deal with widow/orphan lines */
+ /* Last line of paragraph is first line on the new page */
+ if ((page_start > 0)
+ && (page_start < lines_.size ())
+ && (lines_[page_start].last_markup_line_))
+ penalty += breaker_->orphan_penalty ();
+ /* First line of paragraph is last line on the previous page */
+ if ((page_start > 0)
+ && (page_start < lines_.size ())
+ && (lines_[page_start - 1].first_markup_line_))
+ penalty += breaker_->orphan_penalty ();
+
+ demerits += penalty;
+ if (demerits < cur.demerits_ || page_start == line)
+ {
+ cur.demerits_ = demerits;
+ cur.force_ = space.force_;
+ cur.penalty_ = penalty + (prev ? prev->penalty_ : 0);
+ cur.system_count_status_ = breaker_->line_count_status (line_count)
+ | (prev ? prev->system_count_status_ : 0);
+ cur.prev_ = page_start - 1;
+ cur.page_ = prev ? prev->page_ + 1 : first_page_num_;
+ }
+ }
if (page_start > 0
- && lines_[page_start-1].page_permission_ == ly_symbol2scm ("force"))
- break;
+ && lines_[page_start - 1].page_permission_ == ly_symbol2scm ("force"))
+ break;
}
return !isinf (cur.demerits_);
}
#include "translator.icc"
-class Page_turn_event {
+class Page_turn_event
+{
public:
SCM permission_;
Real penalty_;
if (intersect.is_empty ())
{
- ret.push_back (*this);
- return ret;
+ ret.push_back (*this);
+ return ret;
}
Real new_pen = max (penalty_, penalty.penalty_);
/* the next 3 are in sync (ie. same number of elements, etc.) */
vector<Rational> breakable_moments_;
- vector<Grob*> breakable_columns_;
+ vector<Grob *> breakable_columns_;
vector<bool> special_barlines_;
SCM max_permission (SCM perm1, SCM perm2);
note_end_ = 0;
}
-Grob*
+Grob *
Page_turn_engraver::breakable_column (Page_turn_event const &brk)
{
vsize start = lower_bound (breakable_moments_, brk.duration_[LEFT], less<Rational> ());
Stream_event *cause = gi.event_cause ();
Duration *dur_ptr = cause
- ? unsmob_duration (cause->get_property ("duration"))
- : 0;
-
+ ? unsmob_duration (cause->get_property ("duration"))
+ : 0;
+
if (!dur_ptr)
return;
{
Real pen = penalty ((now_mom () - rest_begin_).main_part_);
if (!isinf (pen))
- automatic_breaks_.push_back (Page_turn_event (rest_begin_.main_part_,
- now_mom ().main_part_,
- ly_symbol2scm ("allow"), 0));
+ automatic_breaks_.push_back (Page_turn_event (rest_begin_.main_part_,
+ now_mom ().main_part_,
+ ly_symbol2scm ("allow"), 0));
}
if (rest_begin_ <= repeat_begin_)
{
SCM command = scm_car (cs);
if (command == ly_symbol2scm ("start-repeat"))
- start = true;
+ start = true;
else if (command == ly_symbol2scm ("end-repeat"))
- end = true;
+ end = true;
}
if (end && repeat_begin_.main_part_ >= Moment (0))
Real pen = penalty ((now_mom () - rest_begin_).main_part_ + repeat_begin_rest_length_);
Moment *m = unsmob_moment (get_property ("minimumRepeatLengthForPageTurn"));
if (m && *m > (now_mom () - repeat_begin_))
- pen = infinity_f;
+ pen = infinity_f;
if (pen == infinity_f)
- repeat_penalties_.push_back (Page_turn_event (repeat_begin_.main_part_, now, SCM_EOL, -infinity_f));
+ repeat_penalties_.push_back (Page_turn_event (repeat_begin_.main_part_, now, SCM_EOL, -infinity_f));
else
- repeat_penalties_.push_back (Page_turn_event (repeat_begin_.main_part_, now, ly_symbol2scm ("allow"), pen));
+ repeat_penalties_.push_back (Page_turn_event (repeat_begin_.main_part_, now, ly_symbol2scm ("allow"), pen));
repeat_begin_ = Moment (-1);
}
/* find the next applicable repeat penalty */
for (;
- rep_index < repeat_penalties_.size ()
- && repeat_penalties_[rep_index].duration_[RIGHT] <= brk.duration_[LEFT];
- rep_index++)
- ;
+ rep_index < repeat_penalties_.size ()
+ && repeat_penalties_[rep_index].duration_[RIGHT] <= brk.duration_[LEFT];
+ rep_index++)
+ ;
if (rep_index >= repeat_penalties_.size ()
- || brk.duration_[RIGHT] <= repeat_penalties_[rep_index].duration_[LEFT])
- auto_breaks.push_back (brk);
+ || brk.duration_[RIGHT] <= repeat_penalties_[rep_index].duration_[LEFT])
+ auto_breaks.push_back (brk);
else
- {
- vector<Page_turn_event> split = brk.penalize (repeat_penalties_[rep_index]);
-
- /* it's possible that the last of my newly-split events overlaps the next repeat_penalty,
- in which case we need to refilter that event */
- if (rep_index + 1 < repeat_penalties_.size ()
- && split.size ()
- && split.back ().duration_[RIGHT] > repeat_penalties_[rep_index+1].duration_[LEFT])
- {
- automatic_breaks_[i] = split.back ();
- split.pop_back ();
- i--;
- }
- auto_breaks.insert (auto_breaks.end (), split.begin (), split.end ());
- }
+ {
+ vector<Page_turn_event> split = brk.penalize (repeat_penalties_[rep_index]);
+
+ /* it's possible that the last of my newly-split events overlaps the next repeat_penalty,
+ in which case we need to refilter that event */
+ if (rep_index + 1 < repeat_penalties_.size ()
+ && split.size ()
+ && split.back ().duration_[RIGHT] > repeat_penalties_[rep_index + 1].duration_[LEFT])
+ {
+ automatic_breaks_[i] = split.back ();
+ split.pop_back ();
+ i--;
+ }
+ auto_breaks.insert (auto_breaks.end (), split.begin (), split.end ());
+ }
}
/* apply the automatic breaks */
Page_turn_event const &brk = auto_breaks[i];
Grob *pc = breakable_column (auto_breaks[i]);
if (pc)
- {
- SCM perm = max_permission (pc->get_property ("page-turn-permission"), brk.permission_);
- Real pen = min (robust_scm2double (pc->get_property ("page-turn-penalty"), infinity_f), brk.penalty_);
- pc->set_property ("page-turn-permission", perm);
- pc->set_property ("page-turn-penalty", scm_from_double (pen));
- }
+ {
+ SCM perm = max_permission (pc->get_property ("page-turn-permission"), brk.permission_);
+ Real pen = min (robust_scm2double (pc->get_property ("page-turn-penalty"), infinity_f), brk.penalty_);
+ pc->set_property ("page-turn-permission", perm);
+ pc->set_property ("page-turn-penalty", scm_from_double (pen));
+ }
}
/* unless a manual break overrides it, allow a page turn at the end of the piece */
Page_turn_event const &brk = forced_breaks_[i];
Grob *pc = breakable_column (forced_breaks_[i]);
if (pc)
- {
- pc->set_property ("page-turn-permission", brk.permission_);
- pc->set_property ("page-turn-penalty", scm_from_double (brk.penalty_));
- }
+ {
+ pc->set_property ("page-turn-permission", brk.permission_);
+ pc->set_property ("page-turn-penalty", scm_from_double (brk.penalty_));
+ }
}
}
"",
/* read */
- "minimumPageTurnLength "
- "minimumRepeatLengthForPageTurn ",
+ "minimumPageTurnLength "
+ "minimumRepeatLengthForPageTurn ",
/* write */
""
- );
+ );
{
bool turnable = scm_is_symbol (g->get_property ("page-turn-permission"));
- if (turnable &&
- (!scm_is_symbol (g->get_property ("page-break-permission"))
- || !scm_is_symbol (g->get_property ("line-break-permission"))))
+ if (turnable
+ && (!scm_is_symbol (g->get_property ("page-break-permission"))
+ || !scm_is_symbol (g->get_property ("line-break-permission"))))
{
programming_error ("found a page-turnable place which was not breakable");
turnable = false;
Page_turn_page_breaking::Break_node
Page_turn_page_breaking::put_systems_on_pages (vsize start,
- vsize end,
- vsize configuration,
- vsize page_number)
+ vsize end,
+ vsize configuration,
+ vsize page_number)
{
vsize min_p_count = min_page_count (configuration, page_number);
bool auto_first = to_boolean (book_->paper_->c_variable ("auto-first-page-number"));
if (start == 0 && auto_first)
{
if (min_p_count % 2)
- result = space_systems_on_n_or_one_more_pages (configuration, min_p_count, page_number, 0);
+ result = space_systems_on_n_or_one_more_pages (configuration, min_p_count, page_number, 0);
else
- result = space_systems_on_n_pages (configuration, min_p_count, page_number);
+ result = space_systems_on_n_pages (configuration, min_p_count, page_number);
}
else if (page_number % 2 == min_p_count % 2)
result = space_systems_on_n_pages (configuration, min_p_count, page_number);
ret.too_many_lines_ = all_lines_stretched (configuration);
ret.demerits_ = result.demerits_;
if (start > 0)
- ret.demerits_ += state_[start-1].demerits_;
+ ret.demerits_ += state_[start - 1].demerits_;
return ret;
}
for (vsize start = end; start--;)
{
- if (start < end-1
- && breakpoint_property (start+1, "page-turn-permission") == ly_symbol2scm ("force"))
- break;
+ if (start < end - 1
+ && breakpoint_property (start + 1, "page-turn-permission") == ly_symbol2scm ("force"))
+ break;
- if (start > 0 && best.demerits_ < state_[start-1].demerits_)
+ if (start > 0 && best.demerits_ < state_[start - 1].demerits_)
continue;
int p_num = robust_scm2int (book_->paper_->c_variable ("first-page-number"), 1);
if (start > 0)
{
- /* except possibly for the first page, enforce the fact that first_page_number_
- should always be even (left hand page).
- TODO: are there different conventions in right-to-left languages?
- */
- p_num = state_[start-1].first_page_number_ + state_[start-1].page_count_;
- p_num += p_num % 2;
+ /* except possibly for the first page, enforce the fact that first_page_number_
+ should always be even (left hand page).
+ TODO: are there different conventions in right-to-left languages?
+ */
+ p_num = state_[start - 1].first_page_number_ + state_[start - 1].page_count_;
+ p_num += p_num % 2;
}
Line_division min_division;
bool ok_page = true;
if (debug_page_breaking_scoring)
- message (_f ("page-turn-page-breaking: breaking from %d to %d", (int) start, (int) end));
+ message (_f ("page-turn-page-breaking: breaking from %d to %d", (int) start, (int) end));
/* heuristic: we've just added a breakpoint, we'll need at least as
many systems as before */
min_sys_count = max (min_sys_count, prev_best_system_count);
for (vsize sys_count = min_sys_count; sys_count <= max_sys_count && ok_page; sys_count++)
{
- set_current_breakpoints (start, end, sys_count, min_division, max_division);
+ set_current_breakpoints (start, end, sys_count, min_division, max_division);
bool found = false;
for (vsize i = 0; i < current_configuration_count (); i++)
cur = put_systems_on_pages (start, end, i, p_num);
if (isinf (cur.demerits_)
- || (cur.page_count_ + (p_num % 2) > 2
- && (!isinf (this_start_best.demerits_))
- && total_page_count (cur) > total_page_count (this_start_best)))
+ || (cur.page_count_ + (p_num % 2) > 2
+ && (!isinf (this_start_best.demerits_))
+ && total_page_count (cur) > total_page_count (this_start_best)))
{
ok_page = false;
break;
if (cur.demerits_ < this_start_best.demerits_)
{
- if (debug_page_breaking_scoring)
- print_break_node (cur);
+ if (debug_page_breaking_scoring)
+ print_break_node (cur);
found = true;
this_start_best = cur;
prev_best_system_count = sys_count;
- /* heuristic: if we increase the number of systems, we can bound the
- division from below by our current best division */
- min_division = current_configuration (i);
+ /* heuristic: if we increase the number of systems, we can bound the
+ division from below by our current best division */
+ min_division = current_configuration (i);
}
}
if (!found && this_start_best.too_many_lines_)
}
if (start == 0 && end == 1
- && this_start_best.first_page_number_ == 1
- && this_start_best.page_count_ > 1)
- warning (_ ("cannot fit the first page turn onto a single page."
- " Consider setting first-page-number to an even number."));
+ && this_start_best.first_page_number_ == 1
+ && this_start_best.page_count_ > 1)
+ warning (_ ("cannot fit the first page turn onto a single page."
+ " Consider setting first-page-number to an even number."));
if (this_start_best.demerits_ < best.demerits_)
- best = this_start_best;
+ best = this_start_best;
}
state_.push_back (best);
}
vector<Break_node> &soln = *psoln;
for (vsize n = 0; n < soln.size (); n++)
{
- vsize start = n > 0 ? soln[n-1].break_pos_ : 0;
+ vsize start = n > 0 ? soln[n - 1].break_pos_ : 0;
vsize end = soln[n].break_pos_;
break_into_pieces (start, end, soln[n].div_);
for (vsize i = 0; i < soln.size (); i++)
{
for (vsize j = 0; j < soln[i].page_count_; j++)
- lines_per_page.push_back (soln[i].system_count_[j]);
+ lines_per_page.push_back (soln[i].system_count_[j]);
if (i + 1 < soln.size () && (soln[i].first_page_number_ + soln[i].page_count_) % 2)
- /* add a blank page */
- lines_per_page.push_back (0);
+ /* add a blank page */
+ lines_per_page.push_back (0);
}
/* this should only actually modify first-page-number if
auto-first-page-number was true. */
book_->paper_->set_variable (ly_symbol2scm ("first-page-number"),
- scm_from_int (soln[0].first_page_number_));
+ scm_from_int (soln[0].first_page_number_));
return Page_breaking::make_pages (lines_per_page, systems);
}
#include "stencil.hh"
LY_DEFINE (ly_pango_font_p, "ly:pango-font?",
- 1, 0, 0,
- (SCM f),
- "Is @var{f} a pango font?")
+ 1, 0, 0,
+ (SCM f),
+ "Is @var{f} a pango font?")
{
return scm_from_bool (dynamic_cast<Pango_font *> (unsmob_metrics (f)));
}
LY_DEFINE (ly_pango_font_physical_fonts, "ly:pango-font-physical-fonts",
- 1, 0, 0,
- (SCM f),
- "Return alist of @code{(ps-name file-name font-index)} lists"
- " for Pango font@tie{}@var{f}.")
+ 1, 0, 0,
+ (SCM f),
+ "Return alist of @code{(ps-name file-name font-index)} lists"
+ " for Pango font@tie{}@var{f}.")
{
Pango_font *pf = dynamic_cast<Pango_font *> (unsmob_metrics (f));
#include "dimensions.hh"
#include "file-name.hh"
#include "international.hh"
-#include "lookup.hh" // debugging
+#include "lookup.hh" // debugging
#include "main.hh"
#include "string-convert.hh"
#include "warn.hh"
#include "stencil.hh"
Pango_font::Pango_font (PangoFT2FontMap *fontmap,
- PangoFontDescription const *description,
- Real output_scale)
+ PangoFontDescription const *description,
+ Real output_scale)
{
// This line looks stupid, but if we don't initialize physical_font_tab_ before
// we allocate memory in scm_c_make_hash_table, then that could trigger a garbage
// --hwn
output_scale_ = output_scale;
scale_ = INCH_TO_BP
- / (Real (PANGO_SCALE) * Real (PANGO_RESOLUTION) * output_scale);
+ / (Real (PANGO_SCALE) * Real (PANGO_RESOLUTION) * output_scale);
// ugh. Should make this configurable.
pango_context_set_language (context_, pango_language_from_string ("en_US"));
void
Pango_font::register_font_file (string filename,
- string ps_name,
- int face_index)
+ string ps_name,
+ int face_index)
{
scm_hash_set_x (physical_font_tab_,
- ly_string2scm (ps_name),
- scm_list_2 (ly_string2scm (filename),
- scm_from_int (face_index)));
+ ly_string2scm (ps_name),
+ scm_list_2 (ly_string2scm (filename),
+ scm_from_int (face_index)));
}
void
void
get_glyph_index_name (char *s,
- FT_ULong code)
+ FT_ULong code)
{
sprintf (s, "glyphIndex%lX", code);
}
void
get_unicode_name (char *s,
- FT_ULong code)
+ FT_ULong code)
{
if (code > 0xFFFF)
sprintf (s, "u%lX", code);
FT_Face ftface = pango_fc_font_lock_face (fcfont);
Box b (Interval (PANGO_LBEARING (logical_rect),
- PANGO_RBEARING (logical_rect)),
- Interval (-PANGO_DESCENT (ink_rect),
- PANGO_ASCENT (ink_rect)));
+ PANGO_RBEARING (logical_rect)),
+ Interval (-PANGO_DESCENT (ink_rect),
+ PANGO_ASCENT (ink_rect)));
b.scale (scale_);
Index_to_charcode_map const *cmap = 0;
bool has_glyph_names = ftface->face_flags & FT_FACE_FLAG_GLYPH_NAMES;
if (!has_glyph_names)
- cmap = all_fonts_global->get_index_to_charcode_map (
- file_name, face_index, ftface);
+ cmap = all_fonts_global->get_index_to_charcode_map (file_name, face_index, ftface);
bool is_ttf = string (FT_Get_X11_Font_Format (ftface)) == "TrueType";
bool cid_keyed = false;
PangoGlyphGeometry ggeo = pgi->geometry;
/*
- Zero-width characters are valid Unicode characters,
- but glyph lookups need to be skipped.
+ Zero-width characters are valid Unicode characters,
+ but glyph lookups need to be skipped.
*/
if (!(pg ^ PANGO_GLYPH_EMPTY))
- continue;
+ continue;
glyph_name[0] = '\0';
if (has_glyph_names)
- {
- FT_Error errorcode = FT_Get_Glyph_Name (ftface, pg, glyph_name,
- GLYPH_NAME_LEN);
- if (errorcode)
- programming_error (
- _f ("FT_Get_Glyph_Name () error: %s",
- freetype_error_string (errorcode).c_str ()));
- }
+ {
+ FT_Error errorcode = FT_Get_Glyph_Name (ftface, pg, glyph_name,
+ GLYPH_NAME_LEN);
+ if (errorcode)
+ programming_error (_f ("FT_Get_Glyph_Name () error: %s",
+ freetype_error_string (errorcode).c_str ()));
+ }
SCM char_id = SCM_EOL;
if (glyph_name[0] == '\0'
- && cmap
- && is_ttf
- && cmap->find (pg) != cmap->end ())
- {
- FT_ULong char_code = cmap->find (pg)->second;
- get_unicode_name (glyph_name, char_code);
- }
+ && cmap
+ && is_ttf
+ && cmap->find (pg) != cmap->end ())
+ {
+ FT_ULong char_code = cmap->find (pg)->second;
+ get_unicode_name (glyph_name, char_code);
+ }
if (glyph_name[0] == '\0' && has_glyph_names)
- {
- programming_error (
- _f ("Glyph has no name, but font supports glyph naming.\n"
- "Skipping glyph U+%0X, file %s",
- pg, file_name.c_str ()));
- continue;
- }
+ {
+ programming_error (_f ("Glyph has no name, but font supports glyph naming.\n"
+ "Skipping glyph U+%0X, file %s",
+ pg, file_name.c_str ()));
+ continue;
+ }
if (glyph_name == string (".notdef") && is_ttf)
- glyph_name[0] = '\0';
+ glyph_name[0] = '\0';
if (glyph_name[0] == '\0' && is_ttf)
- // Access by glyph index directly.
- get_glyph_index_name (glyph_name, pg);
+ // Access by glyph index directly.
+ get_glyph_index_name (glyph_name, pg);
if (glyph_name[0] == '\0')
- {
- // CID entry
- cid_keyed = true;
- char_id = scm_from_uint32 (pg);
- }
+ {
+ // CID entry
+ cid_keyed = true;
+ char_id = scm_from_uint32 (pg);
+ }
else
- char_id = scm_from_locale_string (glyph_name);
+ char_id = scm_from_locale_string (glyph_name);
*tail = scm_cons (scm_list_4 (scm_from_double (ggeo.width * scale_),
- scm_from_double (ggeo.x_offset * scale_),
- scm_from_double (- ggeo.y_offset * scale_),
- char_id),
- SCM_EOL);
+ scm_from_double (ggeo.x_offset * scale_),
+ scm_from_double (- ggeo.y_offset * scale_),
+ char_id),
+ SCM_EOL);
tail = SCM_CDRLOC (*tail);
}
pgs = 0;
PangoFontDescription *descr = pango_font_describe (pa->font);
Real size = pango_font_description_get_size (descr)
- / (Real (PANGO_SCALE));
+ / (Real (PANGO_SCALE));
if (!ps_name_str0)
warning (_f ("no PostScript font name for font `%s'", file_name));
if (!ps_name_str0
&& file_name != ""
&& (file_name.find (".otf") != NPOS
- || file_name.find (".cff") != NPOS))
+ || file_name.find (".cff") != NPOS))
{
// UGH: kludge a PS name for OTF/CFF fonts.
string name = file_name;
ssize idx = file_name.find (".otf");
if (idx == NPOS)
- idx = file_name.find (".cff");
+ idx = file_name.find (".cff");
name = name.substr (0, idx);
ssize slash_idx = name.rfind ('/');
if (slash_idx != NPOS)
- {
- slash_idx ++;
- name = name.substr (slash_idx,
- name.length () - slash_idx);
- }
+ {
+ slash_idx++;
+ name = name.substr (slash_idx,
+ name.length () - slash_idx);
+ }
string initial = name.substr (0, 1);
initial = String_convert::to_upper (initial);
if (ps_name.length ())
{
((Pango_font *) this)->register_font_file (file_name,
- ps_name,
- face_index);
+ ps_name,
+ face_index);
pango_fc_font_unlock_face (fcfont);
SCM expr = scm_list_5 (ly_symbol2scm ("glyph-string"),
- ly_string2scm (ps_name),
- scm_from_double (size),
- scm_from_bool (cid_keyed),
- ly_quote_scm (glyph_exprs));
+ ly_string2scm (ps_name),
+ scm_from_double (size),
+ scm_from_bool (cid_keyed),
+ ly_quote_scm (glyph_exprs));
return Stencil (b, expr);
}
Stencil
Pango_font::text_stencil (Output_def * /* state */,
- string str, bool music_string) const
+ string str, bool music_string) const
{
/*
The text assigned to a PangoLayout is automatically divided
GSList *layout_runs = line->runs;
for (GSList *p = layout_runs; p; p = p->next)
- {
- PangoGlyphItem *item = (PangoGlyphItem *) p->data;
- Stencil item_stencil = pango_item_string_stencil (item);
+ {
+ PangoGlyphItem *item = (PangoGlyphItem *) p->data;
+ Stencil item_stencil = pango_item_string_stencil (item);
- item_stencil.translate_axis (last_x, X_AXIS);
- last_x = item_stencil.extent (X_AXIS)[RIGHT];
+ item_stencil.translate_axis (last_x, X_AXIS);
+ last_x = item_stencil.extent (X_AXIS)[RIGHT];
#if 0 // Check extents.
- if (!item_stencil.extent_box ()[X_AXIS].is_empty ())
- {
- Stencil frame = Lookup::frame (item_stencil.extent_box (), 0.1, 0.1);
- Box empty;
- empty.set_empty ();
- Stencil dimless_frame (empty, frame.expr ());
- dest.add_stencil (frame);
- }
+ if (!item_stencil.extent_box ()[X_AXIS].is_empty ())
+ {
+ Stencil frame = Lookup::frame (item_stencil.extent_box (), 0.1, 0.1);
+ Box empty;
+ empty.set_empty ();
+ Stencil dimless_frame (empty, frame.expr ());
+ dest.add_stencil (frame);
+ }
#endif
- dest.add_stencil (item_stencil);
- }
+ dest.add_stencil (item_stencil);
+ }
}
string name = get_output_backend_name ();
{
SCM utf8_string = ly_module_lookup (mod, ly_symbol2scm ("utf-8-string"));
/*
- has_utf8_string should only be true when utf8_string is a
- variable that is bound to a *named* procedure, i.e. not a
- lambda expression.
+ has_utf8_string should only be true when utf8_string is a
+ variable that is bound to a *named* procedure, i.e. not a
+ lambda expression.
*/
if (utf8_string != SCM_BOOL_F
- && scm_procedure_name (SCM_VARIABLE_REF (utf8_string)) != SCM_BOOL_F)
- has_utf8_string = true;
+ && scm_procedure_name (SCM_VARIABLE_REF (utf8_string)) != SCM_BOOL_F)
+ has_utf8_string = true;
}
bool to_paths = music_strings_to_paths;
{
// For Pango based backends, we take a shortcut.
SCM exp = scm_list_3 (ly_symbol2scm ("utf-8-string"),
- ly_string2scm (description_string ()),
- ly_string2scm (str));
+ ly_string2scm (description_string ()),
+ ly_string2scm (str));
Box b (Interval (0, 0), Interval (0, 0));
b.unite (dest.extent_box ());
#include "pango-font.hh"
LY_DEFINE (ly_make_pango_description_string, "ly:make-pango-description-string",
- 2, 0, 0, (SCM chain, SCM size),
- "Make a @code{PangoFontDescription} string for the property"
- " alist @var{chain} at size @var{size}.")
+ 2, 0, 0, (SCM chain, SCM size),
+ "Make a @code{PangoFontDescription} string for the property"
+ " alist @var{chain} at size @var{size}.")
{
LY_ASSERT_TYPE (scm_is_number, size, 1);
PangoFontDescription *pfd = properties_to_pango_description (chain, scm_to_double (size));
else
{
SCM family = ly_chain_assoc_get (ly_symbol2scm ("font-family"), chain,
- SCM_BOOL_F);
+ SCM_BOOL_F);
SCM variant = ly_chain_assoc_get (ly_symbol2scm ("font-shape"), chain,
- SCM_BOOL_F);
+ SCM_BOOL_F);
SCM style = ly_chain_assoc_get (ly_symbol2scm ("font-shape"), chain,
- SCM_BOOL_F);
+ SCM_BOOL_F);
SCM weight = ly_chain_assoc_get (ly_symbol2scm ("font-series"), chain,
- SCM_BOOL_F);
+ SCM_BOOL_F);
description
- = symbols_to_pango_font_description (family, style, variant, weight,
- SCM_BOOL_F);
+ = symbols_to_pango_font_description (family, style, variant, weight,
+ SCM_BOOL_F);
}
Real step = robust_scm2double (ly_chain_assoc_get (ly_symbol2scm ("font-size"), chain, SCM_BOOL_F),
- 0.0);
+ 0.0);
Real size = text_size * pow (2.0, step / 6.0);
pango_font_description_set_size (description, gint (size * PANGO_SCALE));
{
PangoFontDescription *pfd
= properties_to_pango_description (chain,
- point_constant
- * layout->get_dimension (ly_symbol2scm ("text-font-size")));
+ point_constant
+ * layout->get_dimension (ly_symbol2scm ("text-font-size")));
char *str = pango_font_description_to_string (pfd);
SCM scm_str = scm_from_locale_string (str);
g_free (str);
pango_font_description_free (pfd);
-
+
return find_pango_font (layout, scm_str, 1.0);
}
if (style == ly_symbol2scm ("italic"))
pstyle = PANGO_STYLE_ITALIC;
else if (style == ly_symbol2scm ("oblique")
- || style == ly_symbol2scm ("slanted"))
+ || style == ly_symbol2scm ("slanted"))
pstyle = PANGO_STYLE_OBLIQUE;
return pstyle;
PangoFontDescription *
symbols_to_pango_font_description (SCM family,
- SCM style,
- SCM variant,
- SCM weight,
- SCM stretch)
+ SCM style,
+ SCM variant,
+ SCM weight,
+ SCM stretch)
{
PangoFontDescription *description = pango_font_description_new ();
family_str = ly_scm2string (family);
pango_font_description_set_family (description,
- family_str.c_str ());
+ family_str.c_str ());
pango_font_description_set_style (description,
- symbol_to_pango_style (style));
+ symbol_to_pango_style (style));
pango_font_description_set_variant (description,
- symbol_to_pango_variant (variant));
+ symbol_to_pango_variant (variant));
pango_font_description_set_weight (description,
- symbol_to_pango_weight (weight));
+ symbol_to_pango_weight (weight));
pango_font_description_set_stretch (description,
- symbol_to_pango_stretch (stretch));
+ symbol_to_pango_stretch (stretch));
return description;
}
#include "output-def.hh"
LY_DEFINE (ly_paper_book_pages, "ly:paper-book-pages",
- 1, 0, 0, (SCM pb),
- "Return pages in @code{Paper_book} object @var{pb}.")
+ 1, 0, 0, (SCM pb),
+ "Return pages in @code{Paper_book} object @var{pb}.")
{
LY_ASSERT_SMOB (Paper_book, pb, 1);
return unsmob_paper_book (pb)->pages ();
}
LY_DEFINE (ly_paper_book_scopes, "ly:paper-book-scopes",
- 1, 0, 0, (SCM pb),
- "Return scopes in @code{Paper_book} object @var{pb}.")
+ 1, 0, 0, (SCM pb),
+ "Return scopes in @code{Paper_book} object @var{pb}.")
{
LY_ASSERT_SMOB (Paper_book, pb, 1);
Paper_book *book = unsmob_paper_book (pb);
}
LY_DEFINE (ly_paper_book_performances, "ly:paper-book-performances",
- 1, 0, 0, (SCM pb),
- "Return performances in @code{Paper_book} object @var{pb}.")
+ 1, 0, 0, (SCM pb),
+ "Return performances in @code{Paper_book} object @var{pb}.")
{
LY_ASSERT_SMOB (Paper_book, pb, 1);
return unsmob_paper_book (pb)->performances ();
}
LY_DEFINE (ly_paper_book_systems, "ly:paper-book-systems",
- 1, 0, 0, (SCM pb),
- "Return systems in @code{Paper_book} object @var{pb}.")
+ 1, 0, 0, (SCM pb),
+ "Return systems in @code{Paper_book} object @var{pb}.")
{
LY_ASSERT_SMOB (Paper_book, pb, 1);
return unsmob_paper_book (pb)->systems ();
}
LY_DEFINE (ly_paper_book_paper, "ly:paper-book-paper",
- 1, 0, 0, (SCM pb),
- "Return the paper output definition (@code{\\paper})"
- " in @code{Paper_book} object @var{pb}.")
+ 1, 0, 0, (SCM pb),
+ "Return the paper output definition (@code{\\paper})"
+ " in @code{Paper_book} object @var{pb}.")
{
LY_ASSERT_SMOB (Paper_book, pb, 1);
Paper_book *pbook = unsmob_paper_book (pb);
}
LY_DEFINE (ly_paper_book_header, "ly:paper-book-header",
- 1, 0, 0, (SCM pb),
- "Return the header definition (@code{\\header})"
- " in @code{Paper_book} object @var{pb}.")
+ 1, 0, 0, (SCM pb),
+ "Return the header definition (@code{\\header})"
+ " in @code{Paper_book} object @var{pb}.")
{
LY_ASSERT_SMOB (Paper_book, pb, 1);
Paper_book *pbook = unsmob_paper_book (pb);
for (vsize i = dump_header_fieldnames_global.size (); i--;)
fields
= scm_cons (ly_symbol2scm (dump_header_fieldnames_global[i].c_str ()),
- fields);
+ fields);
return fields;
}
int
Paper_book::output_aux (SCM output_channel,
- bool is_last,
- int *first_page_number,
- int *first_performance_number)
+ bool is_last,
+ int *first_page_number,
+ int *first_performance_number)
{
int page_nb = 0;
if (scm_is_pair (performances_))
{
SCM proc = ly_lily_module_constant ("write-performances-midis");
-
+
scm_call_3 (proc,
- performances (),
- output_channel,
- scm_from_long (*first_performance_number));
+ performances (),
+ output_channel,
+ scm_from_long (*first_performance_number));
*first_performance_number += scm_ilength (performances_);
}
if (scm_is_pair (bookparts_))
{
for (SCM p = bookparts_; scm_is_pair (p); p = scm_cdr (p))
- if (Paper_book *pbookpart = unsmob_paper_book (scm_car (p)))
- {
- bool is_last_part = (is_last && !scm_is_pair (scm_cdr (p)));
- page_nb += pbookpart->output_aux (output_channel,
- is_last_part,
- first_page_number,
- first_performance_number);
- }
+ if (Paper_book *pbookpart = unsmob_paper_book (scm_car (p)))
+ {
+ bool is_last_part = (is_last && !scm_is_pair (scm_cdr (p)));
+ page_nb += pbookpart->output_aux (output_channel,
+ is_last_part,
+ first_page_number,
+ first_performance_number);
+ }
}
else
{
if (scores_ == SCM_EOL)
- return 0;
+ return 0;
paper_->set_variable (ly_symbol2scm ("first-page-number"),
- scm_from_long (*first_page_number));
+ scm_from_long (*first_page_number));
paper_->set_variable (ly_symbol2scm ("is-last-bookpart"),
- ly_bool2scm (is_last));
+ ly_bool2scm (is_last));
/* Generate all stencils to trigger font loads. */
page_nb = scm_ilength (pages ());
*first_page_number += page_nb;
if (paper_->c_variable ("line-width") == SCM_UNDEFINED)
paper_->set_variable (ly_symbol2scm ("line-width"),
- paper_->c_variable ("paper-width"));
-
+ paper_->c_variable ("paper-width"));
+
if (!output_aux (output_channel,
- true,
- &first_page_number,
- &first_performance_number))
+ true,
+ &first_page_number,
+ &first_performance_number))
return;
SCM scopes = SCM_EOL;
if (get_program_option ("print-pages"))
{
SCM framework = ly_module_lookup (mod,
- ly_symbol2scm ("output-framework"));
+ ly_symbol2scm ("output-framework"));
if (framework != SCM_BOOL_F)
- {
- SCM func = scm_variable_ref (framework);
- scm_apply_0 (func, scm_list_n (output_channel,
- self_scm (),
- scopes,
- dump_fields (),
- SCM_UNDEFINED));
- }
+ {
+ SCM func = scm_variable_ref (framework);
+ scm_apply_0 (func, scm_list_n (output_channel,
+ self_scm (),
+ scopes,
+ dump_fields (),
+ SCM_UNDEFINED));
+ }
else
- warning (_f ("program option -dprint-pages not supported by backend `%s'",
- get_output_backend_name ()));
+ warning (_f ("program option -dprint-pages not supported by backend `%s'",
+ get_output_backend_name ()));
}
if (get_program_option ("preview"))
{
SCM framework
- = ly_module_lookup (mod, ly_symbol2scm ("output-preview-framework"));
+ = ly_module_lookup (mod, ly_symbol2scm ("output-preview-framework"));
if (framework != SCM_BOOL_F)
- {
- SCM func = scm_variable_ref (framework);
- scm_apply_0 (func, scm_list_n (output_channel,
- self_scm (),
- scopes,
- dump_fields (),
- SCM_UNDEFINED));
- }
+ {
+ SCM func = scm_variable_ref (framework);
+ scm_apply_0 (func, scm_list_n (output_channel,
+ self_scm (),
+ scopes,
+ dump_fields (),
+ SCM_UNDEFINED));
+ }
else
- warning (_f ("program option -dpreview not supported by backend `%s'",
- get_output_backend_name ()));
+ warning (_f ("program option -dpreview not supported by backend `%s'",
+ get_output_backend_name ()));
}
}
void
Paper_book::classic_output_aux (SCM output,
- int *first_performance_number)
+ int *first_performance_number)
{
if (scm_is_pair (performances_))
{
SCM proc = ly_lily_module_constant ("write-performances-midis");
scm_call_3 (proc,
- performances (),
- output,
- scm_from_long (*first_performance_number));
+ performances (),
+ output,
+ scm_from_long (*first_performance_number));
*first_performance_number += scm_ilength (performances_);
}
-
+
/* Generate all stencils to trigger font loads. */
systems ();
}
func = scm_variable_ref (func);
scm_apply_0 (func, scm_list_n (output,
- self_scm (),
- scopes,
- dump_fields (),
- SCM_UNDEFINED));
+ self_scm (),
+ scopes,
+ dump_fields (),
+ SCM_UNDEFINED));
progress_indication ("\n");
}
SCM tit = SCM_EOL;
if (ly_is_procedure (title_func))
tit = scm_call_2 (title_func,
- paper_->self_scm (),
- scopes);
+ paper_->self_scm (),
+ scopes);
if (unsmob_stencil (tit))
title = *unsmob_stencil (tit);
SCM tit = SCM_EOL;
if (ly_is_procedure (title_func))
tit = scm_call_2 (title_func,
- paper_->self_scm (),
- scopes);
+ paper_->self_scm (),
+ scopes);
if (unsmob_stencil (tit))
title = *unsmob_stencil (tit);
{
vector<Grob *> cols = ps->get_columns ();
if (cols.size ())
- {
- Paper_column *col = dynamic_cast<Paper_column *> (cols.back ());
- col->set_property (symbol, permission);
- col->find_prebroken_piece (LEFT)->set_property (symbol, permission);
- }
+ {
+ Paper_column *col = dynamic_cast<Paper_column *> (cols.back ());
+ col->set_property (symbol, permission);
+ col->find_prebroken_piece (LEFT)->set_property (symbol, permission);
+ }
}
else if (Prob *pb = unsmob_prob (sys))
pb->set_property (symbol, permission);
{
SCM force = ly_module_lookup (header, ly_symbol2scm ("breakbefore"));
if (SCM_VARIABLEP (force)
- && scm_is_bool (SCM_VARIABLE_REF (force)))
- {
- if (to_boolean (SCM_VARIABLE_REF (force)))
- {
- set_page_permission (sys, ly_symbol2scm ("page-break-permission"),
- ly_symbol2scm ("force"));
- set_page_permission (sys, ly_symbol2scm ("line-break-permission"),
- ly_symbol2scm ("force"));
- }
- else
- set_page_permission (sys, ly_symbol2scm ("page-break-permission"),
- SCM_EOL);
- }
+ && scm_is_bool (SCM_VARIABLE_REF (force)))
+ {
+ if (to_boolean (SCM_VARIABLE_REF (force)))
+ {
+ set_page_permission (sys, ly_symbol2scm ("page-break-permission"),
+ ly_symbol2scm ("force"));
+ set_page_permission (sys, ly_symbol2scm ("line-break-permission"),
+ ly_symbol2scm ("force"));
+ }
+ else
+ set_page_permission (sys, ly_symbol2scm ("page-break-permission"),
+ SCM_EOL);
+ }
}
}
{
if (Paper_score *ps = dynamic_cast<Paper_score *> (unsmob_music_output (sys)))
{
- vector<Grob*> cols = ps->get_columns ();
+ vector<Grob *> cols = ps->get_columns ();
if (cols.size ())
- {
- Paper_column *col = dynamic_cast<Paper_column *> (cols[0]);
- col->set_property ("labels",
- scm_append_x (scm_list_2 (col->get_property ("labels"),
- labels)));
- Paper_column *col_right
- = dynamic_cast<Paper_column *> (col->find_prebroken_piece (RIGHT));
- col_right->set_property ("labels",
- scm_append_x (scm_list_2 (col_right->get_property ("labels"),
- labels)));
- }
+ {
+ Paper_column *col = dynamic_cast<Paper_column *> (cols[0]);
+ col->set_property ("labels",
+ scm_append_x (scm_list_2 (col->get_property ("labels"),
+ labels)));
+ Paper_column *col_right
+ = dynamic_cast<Paper_column *> (col->find_prebroken_piece (RIGHT));
+ col_right->set_property ("labels",
+ scm_append_x (scm_list_2 (col_right->get_property ("labels"),
+ labels)));
+ }
}
else if (Prob *pb = unsmob_prob (sys))
- pb->set_property ("labels",
- scm_append_x (scm_list_2 (pb->get_property ("labels"),
- labels)));
+ pb->set_property ("labels",
+ scm_append_x (scm_list_2 (pb->get_property ("labels"),
+ labels)));
}
SCM
if (!title.is_empty ())
{
/*
- TODO: this should come from the \layout {} block, which should
- override settings from \paper {}
+ TODO: this should come from the \layout {} block, which should
+ override settings from \paper {}
*/
SCM props
- = paper_->lookup_variable (ly_symbol2scm ("score-title-properties"));
+ = paper_->lookup_variable (ly_symbol2scm ("score-title-properties"));
Prob *ps = make_paper_system (props);
paper_system_set_stencil (ps, title);
return SCM_BOOL_F;
}
-
SCM
Paper_book::get_system_specs ()
{
if (!title.is_empty ())
{
SCM props
- = paper_->lookup_variable (ly_symbol2scm ("book-title-properties"));
+ = paper_->lookup_variable (ly_symbol2scm ("book-title-properties"));
Prob *ps = make_paper_system (props);
paper_system_set_stencil (ps, title);
SCM page_properties
= scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
- paper_->self_scm ());
+ paper_->self_scm ());
SCM interpret_markup_list = ly_lily_module_constant ("interpret-markup-list");
SCM header = SCM_EOL;
for (SCM s = scm_reverse (scores_); scm_is_pair (s); s = scm_cdr (s))
{
if (ly_is_module (scm_car (s)))
- {
- header = scm_car (s);
- if (header_0_ == SCM_EOL)
- header_0_ = header;
- }
+ {
+ header = scm_car (s);
+ if (header_0_ == SCM_EOL)
+ header_0_ = header;
+ }
else if (Page_marker *page_marker = unsmob_page_marker (scm_car (s)))
- {
- /* page markers are used to set page breaking/turning permission,
- or to place bookmarking labels */
- if (scm_is_symbol (page_marker->permission_symbol ()))
- {
- /* set previous element page break or turn permission */
- if (scm_is_pair (system_specs))
- set_page_permission (scm_car (system_specs),
- page_marker->permission_symbol (),
- page_marker->permission_value ());
- }
- if (scm_is_symbol (page_marker->label ()))
- {
- /* The next element label is to be set */
- labels = scm_cons (page_marker->label (), labels);
- }
- }
+ {
+ /* page markers are used to set page breaking/turning permission,
+ or to place bookmarking labels */
+ if (scm_is_symbol (page_marker->permission_symbol ()))
+ {
+ /* set previous element page break or turn permission */
+ if (scm_is_pair (system_specs))
+ set_page_permission (scm_car (system_specs),
+ page_marker->permission_symbol (),
+ page_marker->permission_value ());
+ }
+ if (scm_is_symbol (page_marker->label ()))
+ {
+ /* The next element label is to be set */
+ labels = scm_cons (page_marker->label (), labels);
+ }
+ }
else if (Music_output *mop = unsmob_music_output (scm_car (s)))
- {
- if (Paper_score *pscore = dynamic_cast<Paper_score *> (mop))
- {
- SCM title = get_score_title (header);
-
- if (scm_is_pair (system_specs))
- set_system_penalty (scm_car (system_specs), header);
-
- if (unsmob_prob (title))
- {
- system_specs = scm_cons (title, system_specs);
- unsmob_prob (title)->unprotect ();
- }
-
- header = SCM_EOL;
- system_specs = scm_cons (pscore->self_scm (), system_specs);
- if (scm_is_pair (labels))
- {
- set_labels (scm_car (system_specs), labels);
- labels = SCM_EOL;
- }
- }
- else
- {
- /*
- Ignore MIDI
- */
- }
- }
+ {
+ if (Paper_score *pscore = dynamic_cast<Paper_score *> (mop))
+ {
+ SCM title = get_score_title (header);
+
+ if (scm_is_pair (system_specs))
+ set_system_penalty (scm_car (system_specs), header);
+
+ if (unsmob_prob (title))
+ {
+ system_specs = scm_cons (title, system_specs);
+ unsmob_prob (title)->unprotect ();
+ }
+
+ header = SCM_EOL;
+ system_specs = scm_cons (pscore->self_scm (), system_specs);
+ if (scm_is_pair (labels))
+ {
+ set_labels (scm_car (system_specs), labels);
+ labels = SCM_EOL;
+ }
+ }
+ else
+ {
+ /*
+ Ignore MIDI
+ */
+ }
+ }
else if (Text_interface::is_markup_list (scm_car (s)))
- {
- SCM texts = scm_call_3 (interpret_markup_list,
- paper_->self_scm (),
- page_properties,
- scm_car (s));
- Prob *first = 0;
- Prob *last = 0;
- for (SCM list = texts; scm_is_pair (list); list = scm_cdr (list))
- {
- SCM t = scm_car (list);
- // TODO: init props
- Prob *ps = make_paper_system (SCM_EOL);
- ps->set_property ("page-break-permission",
- ly_symbol2scm ("allow"));
- ps->set_property ("page-turn-permission",
- ly_symbol2scm ("allow"));
- ps->set_property ("last-markup-line", SCM_BOOL_F);
- ps->set_property ("first-markup-line", SCM_BOOL_F);
-
- paper_system_set_stencil (ps, *unsmob_stencil (t));
-
- SCM footnotes = get_footnotes (unsmob_stencil (t)->expr ());
- ps->set_property ("footnotes", footnotes);
- ps->set_property ("is-title", SCM_BOOL_T);
- if (list == texts)
- first = ps;
- else
- {
- // last line so far, in a multi-line paragraph
- last = ps;
- //Place closely to previous line, no stretching.
- ps->set_property ("tight-spacing", SCM_BOOL_T);
- }
- system_specs = scm_cons (ps->self_scm (), system_specs);
- ps->unprotect ();
-
- if (scm_is_pair (labels))
- {
- set_labels (scm_car (system_specs), labels);
- labels = SCM_EOL;
- }
- // FIXME: figure out penalty.
- //set_system_penalty (ps, scores_[i].header_);
- }
- /* Set properties to avoid widowed/orphaned lines.
- Single-line markup_lists are excluded, but in future
- we may want to add the case of a very short, single line. */
- if (first && last)
- {
- last->set_property ("last-markup-line", SCM_BOOL_T);
- first->set_property ("first-markup-line", SCM_BOOL_T);
- }
- }
+ {
+ SCM texts = scm_call_3 (interpret_markup_list,
+ paper_->self_scm (),
+ page_properties,
+ scm_car (s));
+ Prob *first = 0;
+ Prob *last = 0;
+ for (SCM list = texts; scm_is_pair (list); list = scm_cdr (list))
+ {
+ SCM t = scm_car (list);
+ // TODO: init props
+ Prob *ps = make_paper_system (SCM_EOL);
+ ps->set_property ("page-break-permission",
+ ly_symbol2scm ("allow"));
+ ps->set_property ("page-turn-permission",
+ ly_symbol2scm ("allow"));
+ ps->set_property ("last-markup-line", SCM_BOOL_F);
+ ps->set_property ("first-markup-line", SCM_BOOL_F);
+
+ paper_system_set_stencil (ps, *unsmob_stencil (t));
+
+ SCM footnotes = get_footnotes (unsmob_stencil (t)->expr ());
+ ps->set_property ("footnotes", footnotes);
+ ps->set_property ("is-title", SCM_BOOL_T);
+ if (list == texts)
+ first = ps;
+ else
+ {
+ // last line so far, in a multi-line paragraph
+ last = ps;
+ //Place closely to previous line, no stretching.
+ ps->set_property ("tight-spacing", SCM_BOOL_T);
+ }
+ system_specs = scm_cons (ps->self_scm (), system_specs);
+ ps->unprotect ();
+
+ if (scm_is_pair (labels))
+ {
+ set_labels (scm_car (system_specs), labels);
+ labels = SCM_EOL;
+ }
+ // FIXME: figure out penalty.
+ //set_system_penalty (ps, scores_[i].header_);
+ }
+ /* Set properties to avoid widowed/orphaned lines.
+ Single-line markup_lists are excluded, but in future
+ we may want to add the case of a very short, single line. */
+ if (first && last)
+ {
+ last->set_property ("last-markup-line", SCM_BOOL_T);
+ first->set_property ("first-markup-line", SCM_BOOL_T);
+ }
+ }
else
- assert (0);
+ assert (0);
}
system_specs = scm_reverse_x (system_specs, SCM_EOL);
if (scm_is_pair (bookparts_))
{
for (SCM p = bookparts_; scm_is_pair (p); p = scm_cdr (p))
- if (Paper_book *pbookpart = unsmob_paper_book (scm_car (p)))
- systems_ = scm_append_x (scm_list_2 (systems_,
- pbookpart->systems ()));
+ if (Paper_book *pbookpart = unsmob_paper_book (scm_car (p)))
+ systems_ = scm_append_x (scm_list_2 (systems_,
+ pbookpart->systems ()));
}
else
{
SCM specs = get_system_specs ();
for (SCM s = specs; scm_is_pair (s); s = scm_cdr (s))
- {
- if (Paper_score *pscore
- = dynamic_cast<Paper_score *> (unsmob_music_output (scm_car (s))))
- {
- SCM system_list
- = scm_vector_to_list (pscore->get_paper_systems ());
-
- system_list = scm_reverse (system_list);
- systems_ = scm_append (scm_list_2 (system_list, systems_));
- }
- else
- {
- systems_ = scm_cons (scm_car (s), systems_);
- }
- }
+ {
+ if (Paper_score * pscore
+ = dynamic_cast<Paper_score *> (unsmob_music_output (scm_car (s))))
+ {
+ SCM system_list
+ = scm_vector_to_list (pscore->get_paper_systems ());
+
+ system_list = scm_reverse (system_list);
+ systems_ = scm_append (scm_list_2 (system_list, systems_));
+ }
+ else
+ {
+ systems_ = scm_cons (scm_car (s), systems_);
+ }
+ }
systems_ = scm_reverse (systems_);
/* backwards compatibility for the old page breaker */
int i = 0;
Prob *last = 0;
for (SCM s = systems_; scm_is_pair (s); s = scm_cdr (s))
- {
- Prob *ps = unsmob_prob (scm_car (s));
- ps->set_property ("number", scm_from_int (++i));
-
- if (last
- && to_boolean (last->get_property ("is-title"))
- && !scm_is_number (ps->get_property ("penalty")))
- ps->set_property ("penalty", scm_from_int (10000));
- last = ps;
-
- if (scm_is_pair (scm_cdr (s)))
- {
- SCM perm = ps->get_property ("page-break-permission");
- Prob *next = unsmob_prob (scm_cadr (s));
- if (perm == SCM_EOL)
- next->set_property ("penalty", scm_from_int (10001));
- else if (perm == ly_symbol2scm ("force"))
- next->set_property ("penalty", scm_from_int (-10001));
- }
- }
+ {
+ Prob *ps = unsmob_prob (scm_car (s));
+ ps->set_property ("number", scm_from_int (++i));
+
+ if (last
+ && to_boolean (last->get_property ("is-title"))
+ && !scm_is_number (ps->get_property ("penalty")))
+ ps->set_property ("penalty", scm_from_int (10000));
+ last = ps;
+
+ if (scm_is_pair (scm_cdr (s)))
+ {
+ SCM perm = ps->get_property ("page-break-permission");
+ Prob *next = unsmob_prob (scm_cadr (s));
+ if (perm == SCM_EOL)
+ next->set_property ("penalty", scm_from_int (10001));
+ else if (perm == ly_symbol2scm ("force"))
+ next->set_property ("penalty", scm_from_int (-10001));
+ }
+ }
}
return systems_;
if (scm_is_pair (bookparts_))
{
for (SCM p = bookparts_; scm_is_pair (p); p = scm_cdr (p))
- if (Paper_book *pbookpart = unsmob_paper_book (scm_car (p)))
- pages_ = scm_append_x (scm_list_2 (pages_, pbookpart->pages ()));
+ if (Paper_book *pbookpart = unsmob_paper_book (scm_car (p)))
+ pages_ = scm_append_x (scm_list_2 (pages_, pbookpart->pages ()));
}
else if (scm_is_pair (scores_))
{
pages_ = scm_apply_0 (page_breaking, scm_list_1 (self_scm ()));
SCM post_process = paper_->c_variable ("page-post-process");
if (ly_is_procedure (post_process))
- scm_apply_2 (post_process, paper_->self_scm (), pages_, SCM_EOL);
+ scm_apply_2 (post_process, paper_->self_scm (), pages_, SCM_EOL);
/* set systems_ from the pages */
if (systems_ == SCM_BOOL_F)
- {
- systems_ = SCM_EOL;
- for (SCM p = pages_; scm_is_pair (p); p = scm_cdr (p))
- {
- Prob *page = unsmob_prob (scm_car (p));
- SCM systems = page->get_property ("lines");
- systems_ = scm_append (scm_list_2 (systems_, systems));
- }
- }
+ {
+ systems_ = SCM_EOL;
+ for (SCM p = pages_; scm_is_pair (p); p = scm_cdr (p))
+ {
+ Prob *page = unsmob_prob (scm_car (p));
+ SCM systems = page->get_property ("lines");
+ systems_ = scm_append (scm_list_2 (systems_, systems));
+ }
+ }
}
return pages_;
}
Paper_column_engraver::Paper_column_engraver ()
{
- last_moment_.main_part_ = Rational (-1,1);
+ last_moment_.main_part_ = Rational (-1, 1);
command_column_ = 0;
musical_column_ = 0;
breaks_ = 0;
if (command_column_)
{
if (!scm_is_symbol (command_column_->get_property ("line-break-permission")))
- command_column_->set_property ("line-break-permission", ly_symbol2scm ("allow"));
+ command_column_->set_property ("line-break-permission", ly_symbol2scm ("allow"));
system_->set_bound (RIGHT, command_column_);
}
}
*/
Paper_column *p1 = make_paper_column ("NonMusicalPaperColumn");
Paper_column *p2 = make_paper_column ("PaperColumn");
- /*
+ /*
The columns are timestamped with now_mom () in
stop_translation_timestep. Cannot happen now, because the
first column is sometimes created before now_mom is initialised.
Paper_column_engraver::acknowledge_staff_spacing (Grob_info gi)
{
Pointer_group_interface::add_grob (command_column_,
- ly_symbol2scm ("spacing-wishes"),
- gi.grob ());
+ ly_symbol2scm ("spacing-wishes"),
+ gi.grob ());
}
void
Paper_column_engraver::acknowledge_note_spacing (Grob_info gi)
{
Pointer_group_interface::add_grob (musical_column_,
- ly_symbol2scm ("spacing-wishes"),
- gi.grob ());
+ ly_symbol2scm ("spacing-wishes"),
+ gi.grob ());
}
void
Paper_column_engraver::set_columns (Paper_column *new_command,
- Paper_column *new_musical)
+ Paper_column *new_musical)
{
command_column_ = new_command;
musical_column_ = new_musical;
string name = ly_scm2string (scm_symbol_to_string (name_sym));
size_t end = name.rfind ("-event");
if (end)
- prefix = name.substr (0, end);
+ prefix = name.substr (0, end);
else
- {
- programming_error ("Paper_column_engraver doesn't know about this break-event");
- return;
- }
+ {
+ programming_error ("Paper_column_engraver doesn't know about this break-event");
+ return;
+ }
string perm_str = prefix + "-permission";
string pen_str = prefix + "-penalty";
SCM perm = break_events_[i]->get_property ("break-permission");
if (scm_is_number (pen))
- {
- Real new_pen = robust_scm2double (cur_pen, 0.0) + scm_to_double (pen);
- command_column_->set_property (pen_str.c_str (), scm_from_double (new_pen));
- command_column_->set_property (perm_str.c_str (), ly_symbol2scm ("allow"));
- }
+ {
+ Real new_pen = robust_scm2double (cur_pen, 0.0) + scm_to_double (pen);
+ command_column_->set_property (pen_str.c_str (), scm_from_double (new_pen));
+ command_column_->set_property (perm_str.c_str (), ly_symbol2scm ("allow"));
+ }
else
- command_column_->set_property (perm_str.c_str (), perm);
+ command_column_->set_property (perm_str.c_str (), perm);
}
- for (vsize i = 0 ; i < label_events_.size () ; i ++)
+ for (vsize i = 0; i < label_events_.size (); i++)
{
SCM label = label_events_[i]->get_property ("page-label");
SCM labels = command_column_->get_property ("labels");
}
bool start_of_measure = (last_moment_.main_part_ != now_mom ().main_part_
- && !measure_position (context ()).main_part_);
+ && !measure_position (context ()).main_part_);
/*
We can't do this in start_translation_timestep (), since time sig
Moment mlen = Moment (measure_length (context ()));
Grob *column = unsmob_grob (get_property ("currentCommandColumn"));
if (column)
- column->set_property ("measure-length", mlen.smobbed_copy ());
+ column->set_property ("measure-length", mlen.smobbed_copy ());
else
- programming_error ("No command column?");
+ programming_error ("No command column?");
}
}
Grob *col = Item::is_non_musical (elem) ? command_column_ : musical_column_;
if (!elem->get_parent (X_AXIS))
- elem->set_parent (col, X_AXIS);
+ elem->set_parent (col, X_AXIS);
if (!unsmob_grob (elem->get_object ("axis-group-parent-X")))
- elem->set_object ("axis-group-parent-X", col->self_scm ());
+ elem->set_object ("axis-group-parent-X", col->self_scm ());
if (Accidental_placement::has_interface (elem))
- Separation_item::add_conditional_item (col, elem);
+ Separation_item::add_conditional_item (col, elem);
else if (!Accidental_interface::has_interface (elem))
- Separation_item::add_item (col, elem);
+ Separation_item::add_item (col, elem);
}
items_.clear ();
if (to_boolean (get_property ("forbidBreak"))
- && breaks_) /* don't honour forbidBreak if it occurs on the first moment of a score */
+ && breaks_) /* don't honour forbidBreak if it occurs on the first moment of a score */
{
command_column_->set_property ("page-turn-permission", SCM_EOL);
command_column_->set_property ("page-break-permission", SCM_EOL);
command_column_->set_property ("line-break-permission", SCM_EOL);
for (vsize i = 0; i < break_events_.size (); i++)
- {
- SCM perm = break_events_[i]->get_property ("break-permission");
- if (perm == ly_symbol2scm ("force") || perm == ly_symbol2scm ("allow"))
- warning (_ ("forced break was overridden by some other event, "
- "should you be using bar checks?"));
- }
+ {
+ SCM perm = break_events_[i]->get_property ("break-permission");
+ if (perm == ly_symbol2scm ("force") || perm == ly_symbol2scm ("allow"))
+ warning (_ ("forced break was overridden by some other event, "
+ "should you be using bar checks?"));
+ }
}
else if (Paper_column::is_breakable (command_column_))
{
breaks_++;
- if (! (breaks_%8))
- progress_indication ("[" + to_string (breaks_) + "]");
+ if (! (breaks_ % 8))
+ progress_indication ("[" + to_string (breaks_) + "]");
}
context ()->get_score_context ()->unset_property (ly_symbol2scm ("forbidBreak"));
&& scm_is_integer (barnum))
{
SCM where = scm_cons (barnum,
- mpos);
+ mpos);
command_column_->set_property ("rhythmic-location", where);
musical_column_->set_property ("rhythmic-location", where);
ADD_ACKNOWLEDGER (Paper_column_engraver, staff_spacing);
ADD_TRANSLATOR (Paper_column_engraver,
- /* doc */
- "Take care of generating columns.\n"
- "\n"
- "This engraver decides whether a column is breakable. The"
- " default is that a column is always breakable. However,"
- " every @code{Bar_engraver} that does not have a barline at a"
- " certain point will set @code{forbidBreaks} in the score"
- " context to stop line breaks. In practice, this means that"
- " you can make a break point by creating a bar line (assuming"
- " that there are no beams or notes that prevent a break"
- " point).",
-
- /* create */
- "PaperColumn "
- "NonMusicalPaperColumn ",
-
- /* read */
+ /* doc */
+ "Take care of generating columns.\n"
+ "\n"
+ "This engraver decides whether a column is breakable. The"
+ " default is that a column is always breakable. However,"
+ " every @code{Bar_engraver} that does not have a barline at a"
+ " certain point will set @code{forbidBreaks} in the score"
+ " context to stop line breaks. In practice, this means that"
+ " you can make a break point by creating a bar line (assuming"
+ " that there are no beams or notes that prevent a break"
+ " point).",
+
+ /* create */
+ "PaperColumn "
+ "NonMusicalPaperColumn ",
+
+ /* read */
"forbidBreak ",
- /* write */
+ /* write */
"forbidBreak "
- "currentCommandColumn "
- "currentMusicalColumn "
- );
+ "currentCommandColumn "
+ "currentMusicalColumn "
+ );
int
Paper_column::compare (Grob *const &a,
- Grob *const &b)
+ Grob *const &b)
{
return sign (dynamic_cast<Paper_column *> (a)->rank_
- - dynamic_cast<Paper_column *> (b)->rank_);
+ - dynamic_cast<Paper_column *> (b)->rank_);
}
bool
Paper_column::less_than (Grob *const &a,
- Grob *const &b)
+ Grob *const &b)
{
Paper_column *pa = dynamic_cast<Paper_column *> (a);
Paper_column *pb = dynamic_cast<Paper_column *> (b);
{
Skyline_pair *sp = Skyline_pair::unsmob (cols[d]->get_property ("horizontal-skylines"));
if (sp)
- skys[d] = (*sp)[-d];
+ skys[d] = (*sp)[-d];
}
while (flip (&d) != LEFT);
|| align_sym == ly_symbol2scm ("break-alignment"))
align
= Pointer_group_interface::find_grob (me, ly_symbol2scm ("elements"),
- (align_sym == ly_symbol2scm ("staff-bar")
- ? Bar_line::non_empty_barline
- : Break_alignment_interface::has_interface));
+ (align_sym == ly_symbol2scm ("staff-bar")
+ ? Bar_line::non_empty_barline
+ : Break_alignment_interface::has_interface));
else
{
extract_grob_set (me, "elements", elts);
for (vsize i = 0; i < elts.size (); i++)
- {
- if (elts[i]->get_property ("break-align-symbol") == align_sym)
- {
- align = elts[i];
- break;
- }
- }
+ {
+ if (elts[i]->get_property ("break-align-symbol") == align_sym)
+ {
+ align = elts[i];
+ break;
+ }
+ }
}
if (!align)
SCM properties = Font_interface::text_font_alist_chain (me);
SCM scm_mol = Text_interface::interpret_markup (me->layout ()->self_scm (),
- properties,
- ly_string2scm (r));
+ properties,
+ ly_string2scm (r));
SCM when_mol = Text_interface::interpret_markup (me->layout ()->self_scm (),
- properties,
- ly_string2scm (when));
+ properties,
+ ly_string2scm (when));
Stencil t = *unsmob_stencil (scm_mol);
t.add_at_edge (Y_AXIS, DOWN, *unsmob_stencil (when_mol), 0.1);
t.align_to (X_AXIS, CENTER);
t.align_to (Y_AXIS, DOWN);
Stencil l = Lookup::filled_box (Box (Interval (-0.01, 0.01),
- Interval (-2, -1)));
+ Interval (-2, -1)));
SCM small_letters = scm_cons (scm_acons (ly_symbol2scm ("font-size"),
- scm_from_int (-6), SCM_EOL),
- properties);
+ scm_from_int (-6), SCM_EOL),
+ properties);
int j = 0;
for (SCM s = me->get_object ("ideal-distances");
{
Spring *sp = unsmob_spring (scm_caar (s));
if (!unsmob_grob (scm_cdar (s))
- || !unsmob_grob (scm_cdar (s))->get_system ())
- continue;
+ || !unsmob_grob (scm_cdar (s))->get_system ())
+ continue;
j++;
- Real y = -j * 1 -3;
+ Real y = -j * 1 - 3;
vector<Offset> pts;
pts.push_back (Offset (0, y));
Stencil head (musfont->find_by_name ("arrowheads.open.01"));
SCM distance_stc = Text_interface::interpret_markup (me->layout ()->self_scm (),
- small_letters,
- ly_string2scm (String_convert::form_string ("%5.2lf", sp->distance ())));
+ small_letters,
+ ly_string2scm (String_convert::form_string ("%5.2lf", sp->distance ())));
id_stencil.add_stencil (unsmob_stencil (distance_stc)->translated (Offset (sp->distance () / 3, y + 1)));
id_stencil.add_stencil (head.translated (p2));
- id_stencil = id_stencil.in_color (0,0,1);
+ id_stencil = id_stencil.in_color (0, 0, 1);
l.add_stencil (id_stencil);
}
Real dist = scm_to_double (scm_cdar (s));
Grob *other = unsmob_grob (scm_caar (s));
if (!other || other->get_system () != me->get_system ())
- continue;
+ continue;
j++;
- Real y = -j * 1.0 -3.5;
+ Real y = -j * 1.0 - 3.5;
vector<Offset> pts;
pts.push_back (Offset (0, y));
id_stencil.add_stencil (head);
SCM distance_stc = Text_interface::interpret_markup (me->layout ()->self_scm (),
- small_letters,
- ly_string2scm (String_convert::form_string ("%5.2lf",
- dist)));
+ small_letters,
+ ly_string2scm (String_convert::form_string ("%5.2lf",
+ dist)));
id_stencil.add_stencil (unsmob_stencil (distance_stc)->translated (Offset (dist / 3, y - 1)));
- id_stencil = id_stencil.in_color (1,0,0);
+ id_stencil = id_stencil.in_color (1, 0, 0);
l.add_stencil (id_stencil);
}
t.add_stencil (l);
Grob *g = array[i];
if (!g || !g->is_live ())
- /* UGH . potentially quadratic. */
- array.erase (array.begin () + i);
+ /* UGH . potentially quadratic. */
+ array.erase (array.begin () + i);
}
return SCM_UNSPECIFIED;
for (vsize i = 0; i < elts.size (); i++)
{
if (Rhythmic_head::has_interface (elts[i]))
- {
- has_notehead = true;
- if (dynamic_cast<Item *> (elts[i])->get_column () == me)
- return false;
- }
+ {
+ has_notehead = true;
+ if (dynamic_cast<Item *> (elts[i])->get_column () == me)
+ return false;
+ }
}
return has_notehead;
}
ADD_INTERFACE (Paper_column,
- "@code{Paper_column} objects form the top-most X@tie{}parents"
- " for items. There are two types of columns: musical and"
- " non-musical, to which musical and non-musical objects are"
- " attached respectively. The spacing engine determines the"
- " X@tie{}positions of these objects.\n"
- "\n"
- "They are numbered, the first (leftmost) is column@tie{}0."
- " Numbering happens before line breaking, and columns are not"
- " renumbered after line breaking. Since many columns go"
- " unused, you should only use the rank field to get ordering"
- " information. Two adjacent columns may have non-adjacent"
- " numbers.",
-
- /* properties */
- "between-cols "
- "bounded-by-me "
- "full-measure-extra-space "
- "grace-spacing "
- "labels "
- "line-break-system-details "
- "line-break-penalty "
- "line-break-permission "
- "maybe-loose "
- "page-break-penalty "
- "page-break-permission "
- "page-turn-penalty "
- "page-turn-permission "
- "rhythmic-location "
- "shortest-playing-duration "
- "shortest-starter-duration "
- "spacing "
- "used "
- "when ");
+ "@code{Paper_column} objects form the top-most X@tie{}parents"
+ " for items. There are two types of columns: musical and"
+ " non-musical, to which musical and non-musical objects are"
+ " attached respectively. The spacing engine determines the"
+ " X@tie{}positions of these objects.\n"
+ "\n"
+ "They are numbered, the first (leftmost) is column@tie{}0."
+ " Numbering happens before line breaking, and columns are not"
+ " renumbered after line breaking. Since many columns go"
+ " unused, you should only use the rank field to get ordering"
+ " information. Two adjacent columns may have non-adjacent"
+ " numbers.",
+
+ /* properties */
+ "between-cols "
+ "bounded-by-me "
+ "full-measure-extra-space "
+ "grace-spacing "
+ "labels "
+ "line-break-system-details "
+ "line-break-penalty "
+ "line-break-permission "
+ "maybe-loose "
+ "page-break-penalty "
+ "page-break-permission "
+ "page-turn-penalty "
+ "page-turn-permission "
+ "rhythmic-location "
+ "shortest-playing-duration "
+ "shortest-starter-duration "
+ "spacing "
+ "used "
+ "when ");
= pango_font_description_from_string (scm_i_string_chars (descr));
pango_font_description_set_size (description,
- gint (factor *
- pango_font_description_get_size (description)));
+ gint (factor *
+ pango_font_description_get_size (description)));
-
Font_metric *fm = all_fonts_global->find_pango_font (description,
- output_scale (layout));
+ output_scale (layout));
pango_font_description_free (description);
-
+
sizes = scm_acons (size_key, fm->self_scm (), sizes);
scm_hash_set_x (table, descr, sizes);
#include "warn.hh"
LY_DEFINE (ly_make_paper_outputter, "ly:make-paper-outputter",
- 2, 0, 0, (SCM port, SCM format),
- "Create an outputter that evaluates within"
- " @code{output-}@var{format}, writing to @var{port}.")
+ 2, 0, 0, (SCM port, SCM format),
+ "Create an outputter that evaluates within"
+ " @code{output-}@var{format}, writing to @var{port}.")
{
LY_ASSERT_TYPE (ly_is_port, port, 1);
LY_ASSERT_TYPE (ly_is_symbol, format, 2);
output_name = ly_scm2string (port_name);
message (_f ("Layout output to `%s'...",
- output_name.c_str ()));
+ output_name.c_str ()));
progress_indication ("\n");
Paper_outputter *po = new Paper_outputter (port, f);
/* FIXME: why is output_* wrapper called dump? */
LY_DEFINE (ly_outputter_dump_stencil, "ly:outputter-dump-stencil",
- 2, 0, 0, (SCM outputter, SCM stencil),
- "Dump stencil @var{expr} onto @var{outputter}.")
+ 2, 0, 0, (SCM outputter, SCM stencil),
+ "Dump stencil @var{expr} onto @var{outputter}.")
{
-
+
LY_ASSERT_SMOB (Paper_outputter, outputter, 1);
LY_ASSERT_SMOB (Stencil, stencil, 2);
}
LY_DEFINE (ly_outputter_dump_string, "ly:outputter-dump-string",
- 2, 0, 0, (SCM outputter, SCM str),
- "Dump @var{str} onto @var{outputter}.")
+ 2, 0, 0, (SCM outputter, SCM str),
+ "Dump @var{str} onto @var{outputter}.")
{
LY_ASSERT_SMOB (Paper_outputter, outputter, 1);
LY_ASSERT_TYPE (scm_is_string, str, 2);
}
LY_DEFINE (ly_outputter_port, "ly:outputter-port",
- 1, 0, 0, (SCM outputter),
- "Return output port for @var{outputter}.")
+ 1, 0, 0, (SCM outputter),
+ "Return output port for @var{outputter}.")
{
LY_ASSERT_SMOB (Paper_outputter, outputter, 1);
Paper_outputter *po = unsmob_outputter (outputter);
}
LY_DEFINE (ly_outputter_close, "ly:outputter-close",
- 1, 0, 0, (SCM outputter),
- "Close port of @var{outputter}.")
+ 1, 0, 0, (SCM outputter),
+ "Close port of @var{outputter}.")
{
LY_ASSERT_SMOB (Paper_outputter, outputter, 1);
Paper_outputter *po = unsmob_outputter (outputter);
}
LY_DEFINE (ly_outputter_output_scheme, "ly:outputter-output-scheme",
- 2, 0, 0, (SCM outputter, SCM expr),
- "Eval @var{expr} in module of @var{outputter}.")
+ 2, 0, 0, (SCM outputter, SCM expr),
+ "Eval @var{expr} in module of @var{outputter}.")
{
LY_ASSERT_SMOB (Paper_outputter, outputter, 1);
Paper_outputter *po = unsmob_outputter (outputter);
}
LY_DEFINE (ly_outputter_module, "ly:outputter-module",
- 1, 0, 0, (SCM outputter),
- "Return output module of @var{outputter}.")
+ 1, 0, 0, (SCM outputter),
+ "Return output module of @var{outputter}.")
{
LY_ASSERT_SMOB (Paper_outputter, outputter, 1);
int
Paper_outputter::print_smob (SCM /* x */,
- SCM p,
- scm_print_state *)
+ SCM p,
+ scm_print_state *)
{
scm_puts ("#<Paper_outputter>", p);
return 1;
Paper_outputter::output_stencil (Stencil stil)
{
interpret_stencil_expression (stil.expr (), paper_outputter_dump,
- (void *) this, Offset (0, 0));
+ (void *) this, Offset (0, 0));
}
void
{
scm_close_port (file_);
/*
- Remove the "warning" definitions for missing stencil
- expressions so that we start fresh with the next \book
- block. --pmccarty
+ Remove the "warning" definitions for missing stencil
+ expressions so that we start fresh with the next \book
+ block. --pmccarty
*/
SCM proc = ly_lily_module_constant ("remove-stencil-warnings");
scm_call_1 (proc, output_module_);
#include "paper-score.hh"
LY_DEFINE (ly_paper_score_paper_systems, "ly:paper-score-paper-systems",
- 1, 0, 0,
- (SCM paper_score),
- "Return vector of @code{paper_system} objects from"
- " @var{paper-score}.")
+ 1, 0, 0,
+ (SCM paper_score),
+ "Return vector of @code{paper_system} objects from"
+ " @var{paper-score}.")
{
LY_ASSERT_TYPE (unsmob_paper_score, paper_score, 1);
for (vsize i = 0; i < cols_.size (); i++)
{
- Item *it = dynamic_cast<Item*> (cols_[i]);
+ Item *it = dynamic_cast<Item *> (cols_[i]);
if (Paper_column::is_breakable (cols_[i])
- && (i == 0 || it->find_prebroken_piece (LEFT))
- && (i == cols_.size () - 1 || it->find_prebroken_piece (RIGHT)))
- {
- break_indices_.push_back (i);
- break_ranks_.push_back (it->get_column ()->get_rank ());
- }
+ && (i == 0 || it->find_prebroken_piece (LEFT))
+ && (i == cols_.size () - 1 || it->find_prebroken_piece (RIGHT)))
+ {
+ break_indices_.push_back (i);
+ break_ranks_.push_back (it->get_column ()->get_rank ());
+ }
}
}
return break_indices_;
}
-vector<Grob*>
+vector<Grob *>
Paper_score::get_columns () const
{
if (cols_.empty ())
{
if (be_verbose_global)
message (_f ("Element count %d (spanners %d) ",
- system_->element_count (),
- system_->spanner_count ()));
+ system_->element_count (),
+ system_->spanner_count ()));
message (_ ("Preprocessing graphical objects..."));
return paper_systems_;
}
-
Paper_score *
unsmob_paper_score (SCM x)
{
- return dynamic_cast<Paper_score*> (unsmob_music_output (x));
+ return dynamic_cast<Paper_score *> (unsmob_music_output (x));
}
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2008--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "prob.hh"
#include "skyline-pair.hh"
-
+
LY_DEFINE (ly_paper_system_p, "ly:paper-system?",
- 1, 0, 0, (SCM obj),
- "Is @var{obj} a C++ @code{Prob} object of type"
- " @code{paper-system}?")
+ 1, 0, 0, (SCM obj),
+ "Is @var{obj} a C++ @code{Prob} object of type"
+ " @code{paper-system}?")
{
return ly_prob_type_p (obj, ly_symbol2scm ("paper-system"));
}
LY_DEFINE (ly_paper_system_minimum_distance, "ly:paper-system-minimum-distance",
- 2, 0, 0, (SCM sys1, SCM sys2),
- "Measure the minimum distance between these two paper-systems,"
- " using their stored skylines if possible and falling back to"
- " their extents otherwise.")
+ 2, 0, 0, (SCM sys1, SCM sys2),
+ "Measure the minimum distance between these two paper-systems,"
+ " using their stored skylines if possible and falling back to"
+ " their extents otherwise.")
{
Real ret = 0;
Prob *p1 = unsmob_prob (sys1);
/*
TODO
it might be interesting to split off the footnotes as well, ie.
-
- get_footnotes(SCM expr, SCM* footnotes, SCM* cleaned)
-
+
+ get_footnotes(SCM expr, SCM* footnotes, SCM* cleaned)
+
by doing it this way and overwriting the old expr in the caller,
you can make sure nobody tries to handle footnotes differently
downstream.
// we likely need to do something here...just don't know what...
return SCM_EOL;
}
-
+
if (head == ly_symbol2scm ("combine-stencil"))
{
SCM out = SCM_EOL;
return SCM_EOL;
}
-
void
paper_system_set_stencil (Prob *prob, Stencil s)
{
if (Stream_event *ev = info.event_cause ())
{
if (to_boolean (ev->get_property ("parenthesize")))
- {
- if (Item *victim = dynamic_cast<Item*> (info.grob ()))
- {
- Engraver *eng = dynamic_cast<Engraver*> (info.origin_translator ());
- Item *paren = eng->make_item ("ParenthesesItem", victim->self_scm ());
- Pointer_group_interface::add_grob (paren, ly_symbol2scm ("elements"), victim);
-
- paren->set_parent (victim, Y_AXIS);
-
- Real size = robust_scm2double (paren->get_property ("font-size"), 0.0)
- + robust_scm2double (victim->get_property ("font-size"), 0.0);
- paren->set_property ("font-size", scm_from_double (size));
-
- /*
- TODO?
-
- enlarge victim to allow for parentheses space?
- */
- }
- else
- {
- programming_error ("Don't know how to parenthesize spanners.");
- }
- }
+ {
+ if (Item *victim = dynamic_cast<Item *> (info.grob ()))
+ {
+ Engraver *eng = dynamic_cast<Engraver *> (info.origin_translator ());
+ Item *paren = eng->make_item ("ParenthesesItem", victim->self_scm ());
+ Pointer_group_interface::add_grob (paren, ly_symbol2scm ("elements"), victim);
+
+ paren->set_parent (victim, Y_AXIS);
+
+ Real size = robust_scm2double (paren->get_property ("font-size"), 0.0)
+ + robust_scm2double (victim->get_property ("font-size"), 0.0);
+ paren->set_property ("font-size", scm_from_double (size));
+
+ /*
+ TODO?
+
+ enlarge victim to allow for parentheses space?
+ */
+ }
+ else
+ {
+ programming_error ("Don't know how to parenthesize spanners.");
+ }
+ }
}
}
ADD_ACKNOWLEDGER (Parenthesis_engraver, grob);
ADD_TRANSLATOR (Parenthesis_engraver,
- /* doc */
- "Parenthesize objects whose music cause has the"
- " @code{parenthesize} property.",
-
- /* create */
- "ParenthesesItem ",
-
- /* read */
- "",
-
- /* write */
- ""
- );
+ /* doc */
+ "Parenthesize objects whose music cause has the"
+ " @code{parenthesize} property.",
+
+ /* create */
+ "ParenthesesItem ",
+
+ /* read */
+ "",
+
+ /* write */
+ ""
+ );
scm_seek (port, scm_from_long (off), scm_from_long (SEEK_SET));
SCM from = scm_ftell (port);
- scm_set_port_line_x (port, scm_from_int (ps->start_location_.line_number () -1));
- scm_set_port_column_x (port, scm_from_int (ps->start_location_.column_number () -1));
-
+ scm_set_port_line_x (port, scm_from_int (ps->start_location_.line_number () - 1));
+ scm_set_port_column_x (port, scm_from_int (ps->start_location_.column_number () - 1));
+
SCM answer = SCM_UNSPECIFIED;
SCM form = scm_read (port);
SCM to = scm_ftell (port);
ps->nchars = scm_to_int (to) - scm_to_int (from);
-
/* Read expression from port. */
if (!SCM_EOF_OBJECT_P (form))
{
if (ps->safe_)
- {
- static SCM module = SCM_BOOL_F;
- if (module == SCM_BOOL_F)
- {
- SCM function = ly_lily_module_constant ("make-safe-lilypond-module");
- module = scm_call_0 (function);
- }
-
- // We define the parser so trusted Scheme functions can
- // access the real namespace underlying the parser.
- if (ps->parser_)
- scm_module_define (module, ly_symbol2scm ("parser"),
- ps->parser_->self_scm());
- answer = scm_eval (form, module);
- }
+ {
+ static SCM module = SCM_BOOL_F;
+ if (module == SCM_BOOL_F)
+ {
+ SCM function = ly_lily_module_constant ("make-safe-lilypond-module");
+ module = scm_call_0 (function);
+ }
+
+ // We define the parser so trusted Scheme functions can
+ // access the real namespace underlying the parser.
+ if (ps->parser_)
+ scm_module_define (module, ly_symbol2scm ("parser"),
+ ps->parser_->self_scm ());
+ answer = scm_eval (form, module);
+ }
else
- answer = scm_primitive_eval (form);
+ answer = scm_primitive_eval (form);
}
/* Don't close the port here; if we re-enter this function via a
/*
Catch #t : catch all Scheme level errors.
*/
- return scm_internal_catch (SCM_BOOL_T,
- &catch_protected_parse_body,
- (void *) ps,
- &parse_handler, (void *) ps);
+ return scm_internal_catch (SCM_BOOL_T,
+ &catch_protected_parse_body,
+ (void *) ps,
+ &parse_handler, (void *) ps);
}
bool parse_protect_global = true;
ps.parser_ = parser;
SCM ans = parse_protect_global ? protected_ly_parse_scm (&ps)
- : internal_ly_parse_scm (&ps);
+ : internal_ly_parse_scm (&ps);
*n = ps.nchars;
return ans;
%type <scm> composite_music
%type <scm> grouped_music_list
%type <scm> closed_music
+%type <scm> open_music
%type <scm> music
%type <scm> prefix_composite_music
%type <scm> repeated_music
%type <scm> full_markup_list
%type <scm> function_scm_argument
%type <scm> function_arglist
-%type <scm> function_arglist_music_last
%type <scm> function_arglist_nonmusic_last
-%type <scm> function_arglist_nonmusic
+%type <scm> closed_function_arglist
+%type <scm> open_function_arglist
%type <scm> identifier_init
%type <scm> lilypond_header
%type <scm> lilypond_header_body
%type <scm> mode_changing_head
%type <scm> mode_changing_head_with_context
%type <scm> multiplied_duration
-%type <scm> music_function_identifier_musicless_prefix
%type <scm> music_function_event
+%type <scm> music_function_event_arglist
%type <scm> music_function_chord_body
+%type <scm> music_function_chord_body_arglist
%type <scm> new_chord
%type <scm> new_lyrics
%type <scm> number_expression
;
/*
-The representation of a list is the
-
- (LIST . LAST-CONS)
-
- to have efficient append. */
+The representation of a list is reversed to have efficient append. */
music_list:
/* empty */ {
- $$ = scm_cons (SCM_EOL, SCM_EOL);
+ $$ = SCM_EOL;
}
| music_list music {
- SCM s = $$;
- SCM c = scm_cons ($2, SCM_EOL);
-
- if (scm_is_pair (scm_cdr (s)))
- scm_set_cdr_x (scm_cdr (s), c); /* append */
- else
- scm_set_car_x (s, c); /* set first cons */
- scm_set_cdr_x (s, c); /* remember last cell */
+ $$ = scm_cons ($2, $1);
}
| music_list embedded_scm {
Music *m = MY_MAKE_MUSIC("Music", @$);
// ugh. code dup
m->set_property ("error-found", SCM_BOOL_T);
- SCM s = $$;
- SCM c = scm_cons (m->self_scm (), SCM_EOL);
+ $$ = scm_cons (m->self_scm (), $1);
m->unprotect (); /* UGH */
-
- if (scm_is_pair (scm_cdr (s)))
- scm_set_cdr_x (scm_cdr (s), c); /* append */
- else
- scm_set_car_x (s, c); /* set first cons */
- scm_set_cdr_x (s, c); /* remember last cell */
}
;
music:
simple_music
| composite_music
+ | MUSIC_IDENTIFIER
;
alternative_music:
$$ = SCM_EOL;
}
| ALTERNATIVE '{' music_list '}' {
- $$ = scm_car ($3);
+ $$ = scm_reverse_x ($3, SCM_EOL);
}
;
sequential_music:
SEQUENTIAL '{' music_list '}' {
- $$ = MAKE_SYNTAX ("sequential-music", @$, scm_car ($3));
+ $$ = MAKE_SYNTAX ("sequential-music", @$, scm_reverse_x ($3, SCM_EOL));
}
| '{' music_list '}' {
- $$ = MAKE_SYNTAX ("sequential-music", @$, scm_car ($2));
+ $$ = MAKE_SYNTAX ("sequential-music", @$, scm_reverse_x ($2, SCM_EOL));
}
;
simultaneous_music:
SIMULTANEOUS '{' music_list '}'{
- $$ = MAKE_SYNTAX ("simultaneous-music", @$, scm_car ($3));
+ $$ = MAKE_SYNTAX ("simultaneous-music", @$, scm_reverse_x ($3, SCM_EOL));
}
| DOUBLE_ANGLE_OPEN music_list DOUBLE_ANGLE_CLOSE {
- $$ = MAKE_SYNTAX ("simultaneous-music", @$, scm_car ($2));
+ $$ = MAKE_SYNTAX ("simultaneous-music", @$, scm_reverse_x ($2, SCM_EOL));
}
;
simple_music:
event_chord
- | MUSIC_IDENTIFIER
| music_property_def
| context_change
;
| grouped_music_list
;
+/* Music that potentially accepts additional events or durations */
+open_music:
+ simple_music
+ | prefix_composite_music
+ ;
+
grouped_music_list:
simultaneous_music { $$ = $1; }
| sequential_music { $$ = $1; }
MUSIC_FUNCTION EXPECT_MUSIC EXPECT_SCM EXPECT_SCM EXPECT_NO_MORE_ARGS
and this rule returns the reversed list of arguments. */
-function_arglist_music_last:
- EXPECT_MUSIC function_arglist music {
+
+function_arglist:
+ closed_function_arglist
+ | open_function_arglist
+ ;
+
+open_function_arglist:
+ EXPECT_MUSIC function_arglist open_music {
$$ = scm_cons ($3, $2);
}
;
+/* a closed argument list is one that does not end in a music
+ expression that could still take a duration or event */
+
+closed_function_arglist:
+ function_arglist_nonmusic_last
+ | EXPECT_MUSIC function_arglist closed_music {
+ $$ = scm_cons ($3, $2);
+ }
+ ;
+
function_arglist_nonmusic_last:
EXPECT_NO_MORE_ARGS {
/* This is for 0-ary functions, so they don't need to
| EXPECT_PITCH function_arglist pitch {
$$ = scm_cons ($3, $2);
}
- | EXPECT_DURATION function_arglist_nonmusic_last duration_length {
+ | EXPECT_DURATION closed_function_arglist duration_length {
$$ = scm_cons ($3, $2);
}
| EXPECT_SCM function_arglist function_scm_argument {
}
;
-function_arglist_nonmusic: EXPECT_NO_MORE_ARGS {
- $$ = SCM_EOL;
- }
- | EXPECT_MARKUP function_arglist_nonmusic full_markup {
- $$ = scm_cons ($3, $2);
- }
- | EXPECT_MARKUP function_arglist_nonmusic simple_string {
- $$ = scm_cons ($3, $2);
- }
- | EXPECT_PITCH function_arglist_nonmusic pitch {
- $$ = scm_cons ($3, $2);
- }
- | EXPECT_DURATION function_arglist_nonmusic duration_length {
- $$ = scm_cons ($3, $2);
- }
- | EXPECT_SCM function_arglist_nonmusic function_scm_argument {
- $$ = scm_cons ($3, $2);
- }
- ;
-
-function_arglist:
- function_arglist_music_last
- | function_arglist_nonmusic_last
- ;
-
generic_prefix_music_scm:
MUSIC_FUNCTION function_arglist {
- $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($2, SCM_EOL)));
+ $$ = scm_cons2 ($1, make_input (@$), scm_reverse_x ($2, SCM_EOL));
}
;
}
;
-music_function_identifier_musicless_prefix: MUSIC_FUNCTION {
- SCM sig = scm_object_property (yylval.scm, ly_symbol2scm ("music-function-signature"));
- if (scm_is_pair (sig) && to_boolean (scm_memq (ly_music_p_proc, scm_cdr (scm_reverse (sig)))))
- {
- PARSER->parser_error (@$, "Music function applied to event may not have a Music argument, except as the last argument.");
- }
+/* We can't accept a music argument, not even a closed one,
+ * immediately before chord_body_elements, otherwise a function \fun
+ * with a signature of two music arguments can't be sorted out
+ * properly in a construct like
+ * <\fun { c } \fun { c } c>
+ * The second call could be interpreted either as a chord constituent
+ * or a music expression.
+ */
+
+music_function_chord_body_arglist:
+ function_arglist_nonmusic_last
+ | EXPECT_MUSIC music_function_chord_body_arglist chord_body_element {
+ $$ = scm_cons ($3, $2);
}
;
music_function_chord_body:
- /* We could allow chord functions to have multiple music arguments,
- but it's more consistent with music_function_event if we
- prohibit it here too */
- music_function_identifier_musicless_prefix EXPECT_MUSIC function_arglist_nonmusic chord_body_element {
- $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($3, scm_list_1 ($4))));
+ MUSIC_FUNCTION music_function_chord_body_arglist {
+ $$ = scm_cons2 ($1, make_input (@$), scm_reverse_x ($2, SCM_EOL));
}
- | music_function_identifier_musicless_prefix function_arglist_nonmusic {
- $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($2, SCM_EOL)));
+ ;
+
+/* We could accept a closed music argument before the post events
+ * indicated by a trailing argument list. For symmetry with chord
+ * bodies and in order to avoid too tricky and complex behavior, we
+ * refrain from doing so.
+ */
+music_function_event_arglist:
+ function_arglist_nonmusic_last
+ | EXPECT_MUSIC music_function_event_arglist post_event {
+ $$ = scm_cons ($3, $2);
}
;
music_function_event:
- /* Post-events can only have the last argument as music, without this
- restriction we get a shift/reduce conflict from e.g.
- c8-\partcombine c8 -. */
- music_function_identifier_musicless_prefix EXPECT_MUSIC function_arglist_nonmusic post_event {
- $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($3, scm_list_1 ($4))));
- }
- | music_function_identifier_musicless_prefix function_arglist_nonmusic {
- $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($2, SCM_EOL)));
+ MUSIC_FUNCTION music_function_event_arglist {
+ $$ = scm_cons2 ($1, make_input (@$), scm_reverse_x ($2, SCM_EOL));
}
;
Grob *t = text_;
Side_position_interface::add_support (t, i.grob ());
if (Side_position_interface::get_axis (t) == X_AXIS
- && !t->get_parent (Y_AXIS))
- t->set_parent (i.grob (), Y_AXIS);
+ && !t->get_parent (Y_AXIS))
+ t->set_parent (i.grob (), Y_AXIS);
}
}
ADD_ACKNOWLEDGER (Part_combine_engraver, note_head);
ADD_ACKNOWLEDGER (Part_combine_engraver, stem);
ADD_TRANSLATOR (Part_combine_engraver,
- /* doc */
- "Part combine engraver for orchestral scores: Print markings"
- " @q{a2}, @q{Solo}, @q{Solo II}, and @q{unisono}.",
-
- /* create */
- "CombineTextScript ",
-
- /* read */
- "printPartCombineTexts "
- "partCombineTextsOnNote "
- "soloText "
- "soloIIText "
- "aDueText ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Part combine engraver for orchestral scores: Print markings"
+ " @q{a2}, @q{Solo}, @q{Solo II}, and @q{unisono}.",
+
+ /* create */
+ "CombineTextScript ",
+
+ /* read */
+ "printPartCombineTexts "
+ "partCombineTextsOnNote "
+ "soloText "
+ "soloIIText "
+ "aDueText ",
+
+ /* write */
+ ""
+ );
#include "warn.hh"
enum Outlet_type
- {
- CONTEXT_ONE, CONTEXT_TWO,
- CONTEXT_SHARED, CONTEXT_SOLO,
- CONTEXT_NULL, NUM_OUTLETS
- };
+{
+ CONTEXT_ONE, CONTEXT_TWO,
+ CONTEXT_SHARED, CONTEXT_SOLO,
+ CONTEXT_NULL, NUM_OUTLETS
+};
-static const char *outlet_names_[NUM_OUTLETS] =
- {"one", "two", "shared", "solo", "null"};
+static const char *outlet_names_[NUM_OUTLETS]
+ = {"one", "two", "shared", "solo", "null"};
class Part_combine_iterator : public Music_iterator
{
Stream_event *mmrest_event_;
enum Status
- {
- APART,
- TOGETHER,
- SOLO1,
- SOLO2,
- UNISONO,
- UNISILENCE,
- };
+ {
+ APART,
+ TOGETHER,
+ SOLO1,
+ SOLO2,
+ UNISONO,
+ UNISILENCE,
+ };
Status state_;
Status playing_state_;
Context_handle handles_[NUM_OUTLETS];
void substitute_both (Outlet_type to1,
- Outlet_type to2);
+ Outlet_type to2);
/* parameter is really Outlet_type */
void kill_mmrest (int in);
{
Context *c = handles_[i].get_outlet ();
if (c->is_alias (ly_symbol2scm ("Voice")))
- c->event_source ()->remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
+ c->event_source ()->remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
handles_[i].set_context (0);
}
}
mmrest_event_ = 0;
unisono_event_ = 0;
solo_two_event_ = 0;
- solo_one_event_= 0;
+ solo_one_event_ = 0;
first_iter_ = 0;
second_iter_ = 0;
if (second_iter_)
scm_gc_mark (second_iter_->self_scm ());
- Stream_event *ptrs[] = {
+ Stream_event *ptrs[] =
+ {
unisono_event_,
mmrest_event_,
solo_two_event_,
void
Part_combine_iterator::derived_substitute (Context *f,
- Context *t)
+ Context *t)
{
if (first_iter_)
first_iter_->substitute_outlet (f, t);
void
Part_combine_iterator::substitute_both (Outlet_type to1,
- Outlet_type to2)
+ Outlet_type to2)
{
Outlet_type tos[] = {to1, to2};
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < NUM_OUTLETS; j++)
- if (j != tos[i])
- mis[i]->substitute_outlet (handles_[j].get_outlet (), handles_[tos[i]].get_outlet ());
+ if (j != tos[i])
+ mis[i]->substitute_outlet (handles_[j].get_outlet (), handles_[tos[i]].get_outlet ());
}
for (int j = 0; j < NUM_OUTLETS; j++)
{
if (j != to1 && j != to2)
- kill_mmrest (j);
+ kill_mmrest (j);
}
}
else
{
/*
- If we're coming from SOLO2 state, we might have kill mmrests
- in the 1st voice, so in that case, we use the second voice
- as a basis for events.
+ If we're coming from SOLO2 state, we might have kill mmrests
+ in the 1st voice, so in that case, we use the second voice
+ as a basis for events.
*/
Outlet_type c1 = (last_playing_ == SOLO2) ? CONTEXT_NULL : CONTEXT_SHARED;
Outlet_type c2 = (last_playing_ == SOLO2) ? CONTEXT_SHARED : CONTEXT_NULL;
substitute_both (c1, c2);
kill_mmrest ((last_playing_ == SOLO2)
- ? CONTEXT_ONE : CONTEXT_TWO);
+ ? CONTEXT_ONE : CONTEXT_TWO);
kill_mmrest (CONTEXT_SHARED);
if (playing_state_ != UNISONO
- && newstate == UNISONO)
- {
- if (!unisono_event_)
- {
- unisono_event_ = new Stream_event (ly_symbol2scm ("unisono-event"));
- unisono_event_->unprotect ();
- }
-
-
- Context *out = (last_playing_ == SOLO2 ? second_iter_ : first_iter_)
- ->get_outlet ();
- out->event_source ()->broadcast (unisono_event_);
- playing_state_ = UNISONO;
- }
+ && newstate == UNISONO)
+ {
+ if (!unisono_event_)
+ {
+ unisono_event_ = new Stream_event (ly_symbol2scm ("unisono-event"));
+ unisono_event_->unprotect ();
+ }
+
+ Context *out = (last_playing_ == SOLO2 ? second_iter_ : first_iter_)
+ ->get_outlet ();
+ out->event_source ()->broadcast (unisono_event_);
+ playing_state_ = UNISONO;
+ }
state_ = newstate;
}
}
kill_mmrest (CONTEXT_SHARED);
if (playing_state_ != SOLO1)
- {
- if (!solo_one_event_)
- {
- solo_one_event_ = new Stream_event (ly_symbol2scm ("solo-one-event"));
- solo_one_event_->unprotect ();
- }
-
- first_iter_->get_outlet ()->event_source ()->broadcast (solo_one_event_);
- }
+ {
+ if (!solo_one_event_)
+ {
+ solo_one_event_ = new Stream_event (ly_symbol2scm ("solo-one-event"));
+ solo_one_event_->unprotect ();
+ }
+
+ first_iter_->get_outlet ()->event_source ()->broadcast (solo_one_event_);
+ }
playing_state_ = SOLO1;
}
}
substitute_both (CONTEXT_NULL, CONTEXT_SOLO);
if (playing_state_ != SOLO2)
- {
- if (!solo_two_event_)
- {
- solo_two_event_ = new Stream_event (ly_symbol2scm ("solo-two-event"));
- solo_two_event_->unprotect ();
- }
-
- second_iter_->get_outlet ()->event_source ()->broadcast (solo_two_event_);
- playing_state_ = SOLO2;
- }
+ {
+ if (!solo_two_event_)
+ {
+ solo_two_event_ = new Stream_event (ly_symbol2scm ("solo-two-event"));
+ solo_two_event_->unprotect ();
+ }
+
+ second_iter_->get_outlet ()->event_source ()->broadcast (solo_two_event_);
+ playing_state_ = SOLO2;
+ }
}
}
c = c->find_create_context (type, outlet_names_[i], SCM_EOL);
handles_[i].set_context (c);
if (c->is_alias (ly_symbol2scm ("Voice")))
- c->event_source ()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
+ c->event_source ()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
}
SCM lst = get_music ()->get_property ("elements");
set_context (two);
second_iter_ = unsmob_iterator (get_iterator (unsmob_music (scm_cadr (lst))));
-
/* Mimic all settings of voiceOne/voiceTwo for the two separate voices...*/
/* FIXME: Is there any way to use the definition of \voiceOne/\voiceTwo
directly??? */
char const *syms[]
- = {
+ =
+ {
"Stem",
"DynamicLineSpanner",
"Tie",
{
SCM sym = ly_symbol2scm (*p);
execute_pushpop_property (one, sym,
- ly_symbol2scm ("direction"), scm_from_int (1));
+ ly_symbol2scm ("direction"), scm_from_int (1));
execute_pushpop_property (two, sym,
- ly_symbol2scm ("direction"), scm_from_int (-1));
+ ly_symbol2scm ("direction"), scm_from_int (-1));
}
- /* Handle horizontal shifts for crossing notes */
+ /* Handle horizontal shifts for crossing notes */
execute_pushpop_property (one, ly_symbol2scm ("NoteColumn"),
- ly_symbol2scm ("horizontal-shift"), scm_from_int (0));
+ ly_symbol2scm ("horizontal-shift"), scm_from_int (0));
execute_pushpop_property (two, ly_symbol2scm ("NoteColumn"),
- ly_symbol2scm ("horizontal-shift"), scm_from_int (1));
- /* Also handle MultiMeasureRest positions for voice 1/2 */
+ ly_symbol2scm ("horizontal-shift"), scm_from_int (1));
+ /* Also handle MultiMeasureRest positions for voice 1/2 */
execute_pushpop_property (one, ly_symbol2scm ("MultiMeasureRest"),
- ly_symbol2scm ("staff-position"), scm_from_int (4));
+ ly_symbol2scm ("staff-position"), scm_from_int (4));
execute_pushpop_property (two, ly_symbol2scm ("MultiMeasureRest"),
- ly_symbol2scm ("staff-position"), scm_from_int (-4));
+ ly_symbol2scm ("staff-position"), scm_from_int (-4));
}
{
splitm = unsmob_moment (scm_caar (split_list_));
if (splitm && *splitm + start_moment_ > now)
- break;
+ break;
SCM tag = scm_cdar (split_list_);
if (tag == ly_symbol2scm ("chords"))
- chords_together ();
+ chords_together ();
else if (tag == ly_symbol2scm ("apart")
- || tag == ly_symbol2scm ("apart-silence")
- || tag == ly_symbol2scm ("apart-spanner"))
- apart (tag == ly_symbol2scm ("apart-silence"));
+ || tag == ly_symbol2scm ("apart-silence")
+ || tag == ly_symbol2scm ("apart-spanner"))
+ apart (tag == ly_symbol2scm ("apart-silence"));
else if (tag == ly_symbol2scm ("unisono"))
- unisono (false);
+ unisono (false);
else if (tag == ly_symbol2scm ("unisilence"))
- unisono (true);
+ unisono (true);
else if (tag == ly_symbol2scm ("solo1"))
- solo1 ();
+ solo1 ();
else if (tag == ly_symbol2scm ("solo2"))
- solo2 ();
+ solo2 ();
else if (scm_is_symbol (tag))
- {
- string s = "Unknown split directive: "
- + (scm_is_symbol (tag) ? ly_symbol2string (tag) : string ("not a symbol"));
- programming_error (s);
- }
+ {
+ string s = "Unknown split directive: "
+ + (scm_is_symbol (tag) ? ly_symbol2string (tag) : string ("not a symbol"));
+ programming_error (s);
+ }
}
if (first_iter_->ok ())
if (second_iter_->ok ())
{
if (try_process (second_iter_, m))
- last_playing_ = SOLO2;
+ last_playing_ = SOLO2;
}
}
{
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
- protected:
+protected:
virtual void process (Moment);
};
void
Partial_iterator::process (Moment m)
{
- if (Duration *dur
+ if (Duration * dur
= unsmob_duration (get_music ()->get_property ("partial-duration")))
{
Context *ctx = get_outlet ();
Moment now = ctx->now_mom ();
if (now.main_part_ > Rational (0))
- get_music ()->origin ()->
- warning (_ ("trying to use \\partial after the start of a piece"));
+ get_music ()->origin ()->
+ warning (_ ("trying to use \\partial after the start of a piece"));
Moment length = Moment (dur->get_length ());
now = Moment (0, now.grace_part_);
ctx->set_property ("measurePosition", (now - length).smobbed_copy ());
#include "warn.hh"
#include "lily-guile.hh"
-
LY_DEFINE (ly_encode_string_for_pdf, "ly:encode-string-for-pdf",
- 1, 0, 0, (SCM str),
- "Encode the given string to either Latin1 (which is a subset of"
- " the PDFDocEncoding) or if that's not possible to full UTF-16BE"
- " with Byte-Order-Mark (BOM).")
+ 1, 0, 0, (SCM str),
+ "Encode the given string to either Latin1 (which is a subset of"
+ " the PDFDocEncoding) or if that's not possible to full UTF-16BE"
+ " with Byte-Order-Mark (BOM).")
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
char *p = ly_scm2str0 (str);
char *g = NULL;
- char const *charset="UTF-8"; // Input is ALWAYS UTF-8!
+ char const *charset = "UTF-8"; // Input is ALWAYS UTF-8!
gsize bytes_written = 0;
/* First, try to convert to ISO-8859-1 (no encodings required). This will
* for errors. */
g = g_convert (p, -1, "ISO-8859-1", charset, 0, &bytes_written, 0);
/* If that fails, we have to resolve to full UTF-16BE */
- if (!g)
+ if (!g)
{
GError *e = NULL;
- char *g_without_BOM = g_convert (p, -1, "UTF-16BE", charset, 0, &bytes_written, &e);
- if (e != NULL)
+ char *g_without_BOM = g_convert (p, -1, "UTF-16BE", charset, 0, &bytes_written, &e);
+ if (e != NULL)
{
- warning (_f("Conversion of string `%s' to UTF-16be failed: %s", p, e->message));
+ warning (_f ("Conversion of string `%s' to UTF-16be failed: %s", p, e->message));
g_error_free (e);
}
- /* UTF-16BE allows/recommends a byte-order-mark (BOM) of two bytes
- * \xFE\xFF at the begin of the string. The pdfmark specification
+ /* UTF-16BE allows/recommends a byte-order-mark (BOM) of two bytes
+ * \xFE\xFF at the begin of the string. The pdfmark specification
* requires it and depends on it to distinguish PdfDocEncoding from
- * UTF-16BE. As g_convert does not automatically prepend this BOM
- * for UTF-16BE (only for UTF-16, which uses lower endian by default,
+ * UTF-16BE. As g_convert does not automatically prepend this BOM
+ * for UTF-16BE (only for UTF-16, which uses lower endian by default,
* though), we have to prepend it manually. */
if (g_without_BOM) // conversion to UTF-16be might have failed (shouldn't!)
- {
- g = new char[bytes_written+3];
+ {
+ g = new char[bytes_written + 3];
char const *BOM = "\xFE\xFF";
strcpy (g, BOM);
- memcpy (&g[2], g_without_BOM, bytes_written+1); // Copy string + \0
+ memcpy (&g[2], g_without_BOM, bytes_written + 1); // Copy string + \0
free (g_without_BOM);
bytes_written += 2;
}
/* Convert back to SCM object and return it */
/* FIXME guile-2.0: With guile 2.0 the internal representation of a string
- * has changed (char vector rather than binary bytes in
+ * has changed (char vector rather than binary bytes in
* UTF-8). However, with guile 2.0, ly:encode-string-for-pdf
- * is no longer needed and can be replaced by the new
+ * is no longer needed and can be replaced by the new
* (string->utf16 str 'big)
*/
- if (g)
+ if (g)
return scm_take_str (g, bytes_written); // scm_take_str eventually frees g!
else
return str;
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "engraver.hh"
#include "global-context.hh"
#include "international.hh"
public:
TRANSLATOR_DECLARATIONS (Percent_repeat_engraver);
-
+
protected:
Stream_event *percent_event_;
if (now_mom ().main_part_ != command_moment_.main_part_)
{
first_command_column_
- = unsmob_grob (get_property ("currentCommandColumn"));
+ = unsmob_grob (get_property ("currentCommandColumn"));
command_moment_ = now_mom ();
}
if (stop_mom_.main_part_ == now_mom ().main_part_)
{
if (percent_)
- typeset_perc ();
+ typeset_perc ();
percent_event_ = 0;
}
}
else
{
/*
- print a warning: no assignment happens because
- percent_event_ != 0
+ print a warning: no assignment happens because
+ percent_event_ != 0
*/
ASSIGN_EVENT_ONCE (percent_event_, ev);
}
&& now_mom ().main_part_ == start_mom_.main_part_)
{
if (percent_)
- typeset_perc ();
+ typeset_perc ();
percent_ = make_spanner ("PercentRepeat", percent_event_->self_scm ());
SCM count = percent_event_->get_property ("repeat-count");
if (count != SCM_EOL && to_boolean (get_property ("countPercentRepeats"))
- && check_repeat_count_visibility (context (), count))
- {
- percent_counter_ = make_spanner ("PercentRepeatCounter",
- percent_event_->self_scm ());
-
- SCM text = scm_number_to_string (count, scm_from_int (10));
- percent_counter_->set_property ("text", text);
- percent_counter_->set_bound (LEFT, col);
- Side_position_interface::add_support (percent_counter_, percent_);
- percent_counter_->set_parent (percent_, Y_AXIS);
- }
+ && check_repeat_count_visibility (context (), count))
+ {
+ percent_counter_ = make_spanner ("PercentRepeatCounter",
+ percent_event_->self_scm ());
+
+ SCM text = scm_number_to_string (count, scm_from_int (10));
+ percent_counter_->set_property ("text", text);
+ percent_counter_->set_bound (LEFT, col);
+ Side_position_interface::add_support (percent_counter_, percent_);
+ percent_counter_->set_parent (percent_, Y_AXIS);
+ }
else
- percent_counter_ = 0;
+ percent_counter_ = 0;
}
}
}
ADD_TRANSLATOR (Percent_repeat_engraver,
- /* doc */
- "Make whole measure repeats.",
-
- /* create */
- "PercentRepeat "
- "PercentRepeatCounter ",
-
- /* read */
- "countPercentRepeats "
- "currentCommandColumn "
- "repeatCountVisibility ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Make whole measure repeats.",
+
+ /* create */
+ "PercentRepeat "
+ "PercentRepeatCounter ",
+
+ /* read */
+ "countPercentRepeats "
+ "currentCommandColumn "
+ "repeatCountVisibility ",
+
+ /* write */
+ ""
+ );
Stencil slash = Lookup::repeat_slash (wid, slope, thick);
Stencil m = slash;
- Real slash_neg_kern =
- robust_scm2double (me->get_property ("slash-negative-kern"), 1.6);
+ Real slash_neg_kern
+ = robust_scm2double (me->get_property ("slash-negative-kern"), 1.6);
for (int i = count - 1; i--;)
m.add_at_edge (X_AXIS, RIGHT, slash, -slash_neg_kern);
{
Stencil m = brew_slash (me, count);
- Real dot_neg_kern =
- robust_scm2double (me->get_property ("dot-negative-kern"), 0.75);
+ Real dot_neg_kern
+ = robust_scm2double (me->get_property ("dot-negative-kern"), 0.75);
Stencil d1 = Font_interface::get_default_font (me)->find_by_name ("dots.dot");
Stencil d2 = d1;
}
ADD_INTERFACE (Percent_repeat_item_interface,
- "Repeats that look like percent signs.",
-
- /* properties */
- "dot-negative-kern "
- "slash-negative-kern "
- "slope "
- "thickness "
- );
+ "Repeats that look like percent signs.",
+
+ /* properties */
+ "dot-negative-kern "
+ "slash-negative-kern "
+ "slope "
+ "thickness "
+ );
else
{
slash_count
- = scm_call_1 (ly_lily_module_constant ("calc-repeat-slash-count"),
- child->self_scm ());
+ = scm_call_1 (ly_lily_module_constant ("calc-repeat-slash-count"),
+ child->self_scm ());
event_type = "RepeatSlashEvent";
}
int repeats = scm_to_int (mus->get_property ("repeat-count"));
for (int i = repeats; i > 1; i--)
- {
- Music *percent = make_music_by_name (ly_symbol2scm (event_type.c_str ()));
- percent->set_spot (*mus->origin ());
- percent->set_property ("length", length);
- if (repeats > 1)
- {
- percent->set_property ("repeat-count", scm_from_int (i));
- if (event_type == "RepeatSlashEvent")
- percent->set_property ("slash-count", slash_count);
- }
+ {
+ Music *percent = make_music_by_name (ly_symbol2scm (event_type.c_str ()));
+ percent->set_spot (*mus->origin ());
+ percent->set_property ("length", length);
+ if (repeats > 1)
+ {
+ percent->set_property ("repeat-count", scm_from_int (i));
+ if (event_type == "RepeatSlashEvent")
+ percent->set_property ("slash-count", slash_count);
+ }
- child_list = scm_cons (percent->unprotect (), child_list);
- }
+ child_list = scm_cons (percent->unprotect (), child_list);
+ }
child_list = scm_cons (child->self_scm (), child_list);
#include "performance.hh"
LY_DEFINE (ly_performance_write, "ly:performance-write",
- 2, 0, 0, (SCM performance, SCM filename),
- "Write @var{performance} to @var{filename}.")
+ 2, 0, 0, (SCM performance, SCM filename),
+ "Write @var{performance} to @var{filename}.")
{
LY_ASSERT_TYPE (unsmob_performance, performance, 1);
LY_ASSERT_TYPE (scm_is_string, filename, 2);
#include "warn.hh"
Performance::Performance (bool ports)
- : midi_ (0)
- , ports_ (ports)
+ : midi_ (0),
+ ports_ (ports)
{
}
midi_stream.write (Midi_header (1, tracks_, 384));
if (be_verbose_global)
progress_indication (_ ("Track...") + " ");
-
+
for (vsize i = 0; i < audio_staffs_.size (); i++)
{
Audio_staff *s = audio_staffs_[i];
if (be_verbose_global)
- progress_indication ("[" + to_string (i));
+ progress_indication ("[" + to_string (i));
s->output (midi_stream, i, ports_);
if (be_verbose_global)
- progress_indication ("]");
+ progress_indication ("]");
}
}
progress_indication ("\n");
}
-
void
Performance::process ()
{
Performance *
unsmob_performance (SCM x)
{
- return dynamic_cast<Performance*> (unsmob_music_output (x));
+ return dynamic_cast<Performance *> (unsmob_music_output (x));
}
#include "warn.hh"
ADD_TRANSLATOR_GROUP (Performer_group,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
void
Performer_group::announce_element (Audio_element_info info)
Audio_element_info info = announce_infos_[j];
for (SCM p = get_simple_trans_list (); scm_is_pair (p); p = scm_cdr (p))
- {
- Translator *t = unsmob_translator (scm_car (p));
- Performer *eng = dynamic_cast<Performer *> (t);
- if (eng && eng != info.origin_trans_)
- eng->acknowledge_audio_element (info);
- }
+ {
+ Translator *t = unsmob_translator (scm_car (p));
+ Performer *eng = dynamic_cast<Performer *> (t);
+ if (eng && eng != info.origin_trans_)
+ eng->acknowledge_audio_element (info);
+ }
}
}
{
Performer *e = dynamic_cast<Performer *> (unsmob_translator (scm_car (p)));
if (e)
- (e->*method) ();
+ (e->*method) ();
}
}
{
Context *c = unsmob_context (scm_car (s));
Performer_group *group
- = dynamic_cast<Performer_group *> (c->implementation ());
+ = dynamic_cast<Performer_group *> (c->implementation ());
if (group)
- group->do_announces ();
+ group->do_announces ();
}
while (1)
{
performer_each (get_simple_trans_list (),
- &Performer::create_audio_elements);
+ &Performer::create_audio_elements);
if (!announce_infos_.size ())
- break;
+ break;
acknowledge_audio_elements ();
announce_infos_.clear ();
#include "performer-group.hh"
#include "warn.hh"
-
Performer_group *
Performer::get_daddy_performer () const
{
#include "warn.hh"
LY_DEFINE (ly_pfb_2_pfa, "ly:pfb->pfa",
- 1, 0, 0, (SCM pfb_file_name),
- "Convert the contents of a Type@tie{}1 font in PFB format"
- " to PFA format.")
+ 1, 0, 0, (SCM pfb_file_name),
+ "Convert the contents of a Type@tie{}1 font in PFB format"
+ " to PFA format.")
{
LY_ASSERT_TYPE (scm_is_string, pfb_file_name, 1);
if (be_verbose_global)
progress_indication ("\n[" + file_name);
-
+
vector<char> pfb_string = gulp_file (file_name, 0);
char *pfa = pfb2pfa ((Byte *) &pfb_string[0], pfb_string.size ());
-
+
SCM pfa_scm = scm_from_locale_string (pfa);
free (pfa);
}
LY_DEFINE (ly_otf_2_cff, "ly:otf->cff",
- 1, 0, 0, (SCM otf_file_name),
- "Convert the contents of an OTF file to a CFF file,"
- " returning it as a string.")
+ 1, 0, 0, (SCM otf_file_name),
+ "Convert the contents of an OTF file to a CFF file,"
+ " returning it as a string.")
{
LY_ASSERT_TYPE (scm_is_string, otf_file_name, 1);
string table = get_otf_table (face, "CFF ");
SCM asscm = scm_from_locale_stringn ((char *) table.data (),
- table.length ());
+ table.length ());
if (be_verbose_global)
progress_indication ("]");
char *
pfb2pfa (Byte const *pfb, int length)
{
- char *out = (char*) malloc(sizeof(char));
+ char *out = (char *) malloc (sizeof (char));
int olen = 0;
Byte const *p = pfb;
while (p < pfb + length)
{
if (*p++ != 128)
- break;
+ break;
Byte type = *p++;
if (type == 3)
- break;
+ break;
unsigned seglen
- = p[0] | (p[1] << 8)
- | (p[2] << 16) | (p[3] << 24);
+ = p[0] | (p[1] << 8)
+ | (p[2] << 16) | (p[3] << 24);
p += 4;
if (type == 1)
- {
- out = (char *)realloc (out, olen + seglen + 1);
- char *outp = out + olen;
- memcpy (outp, p, seglen);
- olen += seglen;
- p += seglen;
- }
+ {
+ out = (char *)realloc (out, olen + seglen + 1);
+ char *outp = out + olen;
+ memcpy (outp, p, seglen);
+ olen += seglen;
+ p += seglen;
+ }
else if (type == 2)
- {
- unsigned outlength = (seglen * 2) + (seglen / 32) + 2;
-
- out = (char *)realloc (out, olen + outlength + 1);
-
- char *outp = out + olen;
- for (int i = seglen; i--;)
- {
- sprintf (outp, "%02x", *p++);
- outp += 2;
- if (! (i % 32))
- *outp++ = '\n';
- }
-
- olen = outp - out;
- }
+ {
+ unsigned outlength = (seglen * 2) + (seglen / 32) + 2;
+
+ out = (char *)realloc (out, olen + outlength + 1);
+
+ char *outp = out + olen;
+ for (int i = seglen; i--;)
+ {
+ sprintf (outp, "%02x", *p++);
+ outp += 2;
+ if (! (i % 32))
+ *outp++ = '\n';
+ }
+
+ olen = outp - out;
+ }
}
out[olen] = 0;
#include "translator.icc"
-
/*
NOTE NOTE NOTE
This is largely similar to Slur_engraver. Check if fixes
- apply there too.
+ apply there too.
(on principle, engravers don't use inheritance for code sharing)
-
+
*/
/*
It is possible that a slur starts and ends on the same note. At
least, it is for phrasing slurs: a note can be both beginning and
ending of a phrase.
-
*/
class Phrasing_slur_engraver : public Engraver
{
vector<Stream_event *> start_events_;
vector<Stream_event *> stop_events_;
- vector<Grob*> slurs_;
- vector<Grob*> end_slurs_;
+ vector<Grob *> slurs_;
+ vector<Grob *> end_slurs_;
protected:
DECLARE_TRANSLATOR_LISTENER (phrasing_slur);
virtual void finalize ();
-
public:
TRANSLATOR_DECLARATIONS (Phrasing_slur_engraver);
};
{
Direction d = to_dir (ev->get_property ("span-direction"));
if (d == START)
- start_events_.push_back(ev);
+ start_events_.push_back (ev);
else if (d == STOP)
- stop_events_.push_back(ev);
+ stop_events_.push_back (ev);
else ev->origin ()->warning (_f ("direction of %s invalid: %d",
- "phrasing-slur-event", int (d)));
+ "phrasing-slur-event", int (d)));
}
void
// Check if we already have a slur with the same spanner-id.
// In that case, don't create a new slur, but print a warning
for (vsize i = 0; i < slurs_.size (); i++)
- have_slur = have_slur || (id == robust_scm2string (slurs_[i]->get_property ("spanner-id"), ""));
-
+ have_slur = have_slur || (id == robust_scm2string (slurs_[i]->get_property ("spanner-id"), ""));
+
if (have_slur)
- ev->origin ()->warning(_ ("already have phrasing slur"));
- else
+ ev->origin ()->warning (_ ("already have phrasing slur"));
+ else
{
Grob *slur = make_spanner ("PhrasingSlur", ev->self_scm ());
Direction updown = to_dir (ev->get_property ("direction"));
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, tuplet_number);
ADD_TRANSLATOR (Phrasing_slur_engraver,
- /* doc */
- "Print phrasing slurs. Similar to @ref{Slur_engraver}.",
+ /* doc */
+ "Print phrasing slurs. Similar to @ref{Slur_engraver}.",
- /* create */
- "PhrasingSlur ",
+ /* create */
+ "PhrasingSlur ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2006--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "engraver.hh"
#include "spanner.hh"
#include "warn.hh"
#include "axis-group-interface.hh"
-
/*
TODO:
* Detach from pedal specifics,
-
+
* Also use this engraver for dynamics.
-
*/
-
struct Pedal_align_info
{
Spanner *line_spanner_;
protected:
virtual void finalize ();
-
+
DECLARE_ACKNOWLEDGER (piano_pedal_script);
DECLARE_ACKNOWLEDGER (piano_pedal_bracket);
DECLARE_ACKNOWLEDGER (note_column);
void stop_translation_timestep ();
void start_translation_timestep ();
-
+
private:
- enum Pedal_type {
+ enum Pedal_type
+ {
SOSTENUTO,
SUSTAIN,
UNA_CORDA,
void
Piano_pedal_align_engraver::stop_translation_timestep ()
{
- for (int i = 0; i < NUM_PEDAL_TYPES; i ++)
+ for (int i = 0; i < NUM_PEDAL_TYPES; i++)
{
if (pedal_info_[i].line_spanner_)
- {
-
- if (pedal_info_[i].carrying_item_)
- {
- if (!pedal_info_[i].line_spanner_->get_bound (LEFT))
- pedal_info_[i].line_spanner_->set_bound (LEFT,
- pedal_info_[i].carrying_item_);
-
- pedal_info_[i].line_spanner_->set_bound (RIGHT,
- pedal_info_[i].carrying_item_);
- }
- else if (pedal_info_[i].carrying_spanner_
- || pedal_info_[i].finished_carrying_spanner_
- )
- {
- if (!pedal_info_[i].line_spanner_->get_bound (LEFT)
- && pedal_info_[i].carrying_spanner_->get_bound (LEFT))
- pedal_info_[i].line_spanner_->set_bound (LEFT,
- pedal_info_[i].carrying_spanner_->get_bound (LEFT));
-
-
- if (pedal_info_[i].finished_carrying_spanner_)
- pedal_info_[i].line_spanner_->set_bound (RIGHT,
- pedal_info_[i].finished_carrying_spanner_->get_bound (RIGHT));
- }
-
- for (vsize j = 0; j < supports_.size (); j++)
- {
- Side_position_interface::add_support (pedal_info_[i].line_spanner_, supports_[j]);
- }
-
- if (pedal_info_[i].is_finished ())
- {
- announce_end_grob (pedal_info_[i].line_spanner_, SCM_EOL);
- pedal_info_[i].clear ();
- }
- }
+ {
+
+ if (pedal_info_[i].carrying_item_)
+ {
+ if (!pedal_info_[i].line_spanner_->get_bound (LEFT))
+ pedal_info_[i].line_spanner_->set_bound (LEFT,
+ pedal_info_[i].carrying_item_);
+
+ pedal_info_[i].line_spanner_->set_bound (RIGHT,
+ pedal_info_[i].carrying_item_);
+ }
+ else if (pedal_info_[i].carrying_spanner_
+ || pedal_info_[i].finished_carrying_spanner_
+ )
+ {
+ if (!pedal_info_[i].line_spanner_->get_bound (LEFT)
+ && pedal_info_[i].carrying_spanner_->get_bound (LEFT))
+ pedal_info_[i].line_spanner_->set_bound (LEFT,
+ pedal_info_[i].carrying_spanner_->get_bound (LEFT));
+
+ if (pedal_info_[i].finished_carrying_spanner_)
+ pedal_info_[i].line_spanner_->set_bound (RIGHT,
+ pedal_info_[i].finished_carrying_spanner_->get_bound (RIGHT));
+ }
+
+ for (vsize j = 0; j < supports_.size (); j++)
+ {
+ Side_position_interface::add_support (pedal_info_[i].line_spanner_, supports_[j]);
+ }
+
+ if (pedal_info_[i].is_finished ())
+ {
+ announce_end_grob (pedal_info_[i].line_spanner_, SCM_EOL);
+ pedal_info_[i].clear ();
+ }
+ }
pedal_info_[i].carrying_item_ = 0;
}
return SUSTAIN;
}
-
Spanner *
Piano_pedal_align_engraver::make_line_spanner (Pedal_type t, SCM cause)
{
if (!sp)
{
switch (t)
- {
- case (SOSTENUTO):
- sp = make_spanner ("SostenutoPedalLineSpanner", cause);
- break;
- case (SUSTAIN):
- sp = make_spanner ("SustainPedalLineSpanner", cause);
- break;
- case (UNA_CORDA):
- sp = make_spanner ("UnaCordaPedalLineSpanner", cause);
- break;
- default:
- programming_error ("No pedal type fonud!") ;
- return sp;
- }
-
+ {
+ case (SOSTENUTO):
+ sp = make_spanner ("SostenutoPedalLineSpanner", cause);
+ break;
+ case (SUSTAIN):
+ sp = make_spanner ("SustainPedalLineSpanner", cause);
+ break;
+ case (UNA_CORDA):
+ sp = make_spanner ("UnaCordaPedalLineSpanner", cause);
+ break;
+ default:
+ programming_error ("No pedal type fonud!");
+ return sp;
+ }
+
pedal_info_[t].line_spanner_ = sp;
}
-
+
return sp;
}
Piano_pedal_align_engraver::acknowledge_piano_pedal_script (Grob_info gi)
{
Pedal_type type = get_grob_pedal_type (gi);
-
+
Grob *sp = make_line_spanner (type, gi.grob ()->self_scm ());
Axis_group_interface::add_element (sp, gi.grob ());
pedal_info_[type].carrying_item_ = gi.grob ();
}
-
void
Piano_pedal_align_engraver::finalize ()
{
- for (int i = 0; i < NUM_PEDAL_TYPES; i ++)
+ for (int i = 0; i < NUM_PEDAL_TYPES; i++)
{
if (pedal_info_[i].line_spanner_)
- {
- SCM cc = get_property ("currentCommandColumn");
- Item *c = unsmob_item (cc);
- pedal_info_[i].line_spanner_->set_bound (RIGHT, c);
+ {
+ SCM cc = get_property ("currentCommandColumn");
+ Item *c = unsmob_item (cc);
+ pedal_info_[i].line_spanner_->set_bound (RIGHT, c);
- pedal_info_[i].clear ();
- }
+ pedal_info_[i].clear ();
+ }
}
}
ADD_END_ACKNOWLEDGER (Piano_pedal_align_engraver, piano_pedal_bracket);
-
ADD_TRANSLATOR (Piano_pedal_align_engraver,
- /* doc */
- "Align piano pedal symbols and brackets.",
+ /* doc */
+ "Align piano pedal symbols and brackets.",
- /* create */
- "SostenutoPedalLineSpanner "
- "SustainPedalLineSpanner "
- "UnaCordaPedalLineSpanner ",
+ /* create */
+ "SostenutoPedalLineSpanner "
+ "SustainPedalLineSpanner "
+ "UnaCordaPedalLineSpanner ",
- /* read */
- "currentCommandColumn ",
+ /* read */
+ "currentCommandColumn ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Drul_array<bool> broken (false, false);
Drul_array<Real> height = robust_scm2drul
- (me->get_property ("edge-height"), Interval (0, 0));
+ (me->get_property ("edge-height"), Interval (0, 0));
Drul_array<Real> shorten = robust_scm2drul
- (me->get_property ("shorten-pair"), Interval (0, 0));
+ (me->get_property ("shorten-pair"), Interval (0, 0));
Drul_array<Real> flare = robust_scm2drul
- (me->get_property ("bracket-flare"), Interval (0, 0));
+ (me->get_property ("bracket-flare"), Interval (0, 0));
Grob *common = me->get_bound (LEFT)
- ->common_refpoint (me->get_bound (RIGHT), X_AXIS);
+ ->common_refpoint (me->get_bound (RIGHT), X_AXIS);
Grob *textbit = unsmob_grob (me->get_object ("pedal-text"));
if (textbit)
Item *b = me->get_bound (d);
broken[d] = b->break_status_dir () != CENTER;
if (broken[d])
- {
- if (orig
- && ((d == RIGHT
- && me->get_break_index () != orig->broken_intos_.size () - 1)
- || (d == LEFT && me->get_break_index ())))
- height[d] = 0.0;
- else
- flare[d] = 0.0;
- }
+ {
+ if (orig
+ && ((d == RIGHT
+ && me->get_break_index () != orig->broken_intos_.size () - 1)
+ || (d == LEFT && me->get_break_index ())))
+ height[d] = 0.0;
+ else
+ flare[d] = 0.0;
+ }
Interval ext = robust_relative_extent (b, common, X_AXIS);
span_points[d] = ext [broken[d] ? RIGHT : LEFT];
Real padding = robust_scm2double (me->get_property ("bound-padding"), 0);
span_points[LEFT] = padding
- + robust_relative_extent (textbit, common, X_AXIS)[RIGHT];
+ + robust_relative_extent (textbit, common, X_AXIS)[RIGHT];
}
Stencil m;
&& span_points.length () > 0.001)
{
m = Tuplet_bracket::make_bracket (me, Y_AXIS,
- Offset (span_points.length (), 0),
- height,
- Interval (),
- flare, shorten);
+ Offset (span_points.length (), 0),
+ height,
+ Interval (),
+ flare, shorten);
}
m.translate_axis (span_points[LEFT]
- - me->relative_coordinate (common, X_AXIS), X_AXIS);
+ - me->relative_coordinate (common, X_AXIS), X_AXIS);
return m.smobbed_copy ();
}
ADD_INTERFACE (Piano_pedal_bracket,
- "The bracket of the piano pedal. It can be tuned through"
- " the regular bracket properties.",
-
- /* properties */
- "bound-padding "
- "edge-height "
- "shorten-pair "
- "bracket-flare "
- "pedal-text "
- );
+ "The bracket of the piano pedal. It can be tuned through"
+ " the regular bracket properties.",
+
+ /* properties */
+ "bound-padding "
+ "edge-height "
+ "shorten-pair "
+ "bracket-flare "
+ "pedal-text "
+ );
Softcode using (list (sustain-event SustainPedal PianoPedalBracket) ... )
* Try to use same engraver for dynamics.
-
*/
/* Ugh: This declaration is duplicated in piano-pedal-performer */
-enum Pedal_type {
+enum Pedal_type
+{
SOSTENUTO,
SUSTAIN,
UNA_CORDA,
SCM event_class_sym_;
SCM style_sym_;
SCM strings_sym_;
-
+
const char *pedal_c_str_;
Pedal_type_info ()
void typeset_all (Pedal_info *p);
};
-
static void
init_pedal_types ()
{
string base_name = name;
/* foo-bar */
string base_ident = "";
- int prev_pos=0;
+ int prev_pos = 0;
int cur_pos;
for (cur_pos = 1; name[cur_pos]; cur_pos++)
- if (isupper (name[cur_pos]))
- {
- base_ident = base_ident + String_convert::to_lower (string (name, prev_pos, cur_pos - prev_pos)) + "-";
- prev_pos = cur_pos;
- }
+ if (isupper (name[cur_pos]))
+ {
+ base_ident = base_ident + String_convert::to_lower (string (name, prev_pos, cur_pos - prev_pos)) + "-";
+ prev_pos = cur_pos;
+ }
base_ident += String_convert::to_lower (string (name, prev_pos, cur_pos - prev_pos));
/*
- be careful, as we don't want to loose references to the _sym_ members.
+ be careful, as we don't want to loose references to the _sym_ members.
*/
Pedal_type_info info;
info.event_class_sym_ = scm_from_locale_symbol ((base_ident + "-event").c_str ());
info.style_sym_ = scm_from_locale_symbol (("pedal" + base_name + "Style").c_str ());
info.strings_sym_ = scm_from_locale_symbol (("pedal" + base_name + "Strings").c_str ());
-
+
info.base_name_ = name;
info.pedal_c_str_ = strdup ((base_name + "Pedal").c_str ());
info.protect ();
-
+
pedal_types_[i] = info;
}
}
info_list_[NUM_PEDAL_TYPES].type_ = 0;
}
-
/*
Urg: Code dup
I'm a script
for (Pedal_info *p = info_list_; p->type_; p++)
{
if (p->bracket_)
- add_bound_item (p->bracket_, info.grob ());
+ add_bound_item (p->bracket_, info.grob ());
if (p->finished_bracket_)
- add_bound_item (p->finished_bracket_, info.grob ());
+ add_bound_item (p->finished_bracket_, info.grob ());
}
}
for (Pedal_info *p = info_list_; p->type_; p++)
{
if (p->event_drul_[STOP] || p->event_drul_[START])
- {
- /* Choose the appropriate grobs to add to the line spanner
- These can be text items or text-spanners
- */
-
- /*
- ugh, code dup, should read grob to create from other
- property.
-
- bracket: |_________/\____|
- text: Ped. *Ped. *
- mixed: Ped. _____/\____|
- */
-
- SCM style = internal_get_property (p->type_->style_sym_);
-
- bool mixed = style == ly_symbol2scm ("mixed");
- bool bracket = (mixed
- || style == ly_symbol2scm ("bracket"));
- bool text = (style == ly_symbol2scm ("text")
- || mixed);
-
- if (text && !p->item_)
- create_text_grobs (p, mixed);
- if (bracket)
- create_bracket_grobs (p, mixed);
- }
+ {
+ /* Choose the appropriate grobs to add to the line spanner
+ These can be text items or text-spanners
+ */
+
+ /*
+ ugh, code dup, should read grob to create from other
+ property.
+
+ bracket: |_________/\____|
+ text: Ped. *Ped. *
+ mixed: Ped. _____/\____|
+ */
+
+ SCM style = internal_get_property (p->type_->style_sym_);
+
+ bool mixed = style == ly_symbol2scm ("mixed");
+ bool bracket = (mixed
+ || style == ly_symbol2scm ("bracket"));
+ bool text = (style == ly_symbol2scm ("text")
+ || mixed);
+
+ if (text && !p->item_)
+ create_text_grobs (p, mixed);
+ if (bracket)
+ create_bracket_grobs (p, mixed);
+ }
}
}
if (!m) m = p->event_drul_ [STOP];
string msg = _f ("expect 3 strings for piano pedals, found: %ld",
- scm_ilength (strings));
+ scm_ilength (strings));
if (m)
- m->origin ()->warning (msg);
+ m->origin ()->warning (msg);
else
- warning (msg);
+ warning (msg);
return;
}
if (p->event_drul_[STOP] && p->event_drul_[START])
{
if (!mixed)
- {
- if (!p->start_ev_)
- p->event_drul_[STOP]->origin ()->warning (_f ("cannot find start of piano pedal: `%s'", p->type_->base_name_.c_str ()));
- else
- s = scm_cadr (strings);
- p->start_ev_ = p->event_drul_[START];
- }
+ {
+ if (!p->start_ev_)
+ p->event_drul_[STOP]->origin ()->warning (_f ("cannot find start of piano pedal: `%s'", p->type_->base_name_.c_str ()));
+ else
+ s = scm_cadr (strings);
+ p->start_ev_ = p->event_drul_[START];
+ }
}
else if (p->event_drul_[STOP])
{
if (!mixed)
- {
- if (!p->start_ev_)
- p->event_drul_[STOP]->origin ()->warning (_f ("cannot find start of piano pedal: `%s'", p->type_->base_name_.c_str ()));
- else
- s = scm_caddr (strings);
- p->start_ev_ = 0;
- }
+ {
+ if (!p->start_ev_)
+ p->event_drul_[STOP]->origin ()->warning (_f ("cannot find start of piano pedal: `%s'", p->type_->base_name_.c_str ()));
+ else
+ s = scm_caddr (strings);
+ p->start_ev_ = 0;
+ }
}
else if (p->event_drul_[START])
{
p->start_ev_ = p->event_drul_[START];
s = scm_car (strings);
- }
+ }
if (scm_is_string (s))
{
const char *propname = p->type_->pedal_c_str_;
p->item_ = make_item (propname, (p->event_drul_[START]
- ? p->event_drul_[START]
- : p->event_drul_[STOP])->self_scm ());
+ ? p->event_drul_[START]
+ : p->event_drul_[STOP])->self_scm ());
p->item_->set_property ("text", s);
}
Grob *cmc = unsmob_grob (get_property ("currentMusicalColumn"));
if (!p->bracket_->get_bound (RIGHT))
- p->bracket_->set_bound (RIGHT, cmc);
+ p->bracket_->set_bound (RIGHT, cmc);
/*
- Set properties so that the stencil-creating function will
- know whether the right edge should be flared ___/
+ Set properties so that the stencil-creating function will
+ know whether the right edge should be flared ___/
*/
if (!p->event_drul_[START])
- {
- SCM flare = p->bracket_->get_property ("bracket-flare");
- if (scm_is_pair (flare))
- p->bracket_->set_property ("bracket-flare", scm_cons (scm_car (flare),
- scm_from_double (0)));
- }
+ {
+ SCM flare = p->bracket_->get_property ("bracket-flare");
+ if (scm_is_pair (flare))
+ p->bracket_->set_property ("bracket-flare", scm_cons (scm_car (flare),
+ scm_from_double (0)));
+ }
p->finished_bracket_ = p->bracket_;
p->bracket_ = 0;
announce_end_grob (p->finished_bracket_, p->event_drul_[STOP]->self_scm ());
-
+
p->current_bracket_ev_ = 0;
}
p->bracket_ = make_spanner ("PianoPedalBracket", p->event_drul_[START]->self_scm ());
/*
- Set properties so that the stencil-creating function will
- know whether the left edge should be flared \___
+ Set properties so that the stencil-creating function will
+ know whether the left edge should be flared \___
*/
if (!p->finished_bracket_)
- {
- SCM flare = p->bracket_->get_property ("bracket-flare");
- p->bracket_->set_property ("bracket-flare", scm_cons (scm_from_double (0), scm_cdr (flare)));
- }
+ {
+ SCM flare = p->bracket_->get_property ("bracket-flare");
+ p->bracket_->set_property ("bracket-flare", scm_cons (scm_from_double (0), scm_cdr (flare)));
+ }
/* Set this property for 'mixed style' pedals, Ped._______/\ ,
- so the stencil function will shorten the ____ line by the length of the Ped. text.
+ so the stencil function will shorten the ____ line by the length of the Ped. text.
*/
if (mixed)
- {
- /*
- Mixed style: Store a pointer to the preceding text for use in
- calculating the length of the line
+ {
+ /*
+ Mixed style: Store a pointer to the preceding text for use in
+ calculating the length of the line
- TODO:
+ TODO:
- WTF is pedal-text not the bound of the object? --hwn
- */
- if (p->item_)
- p->bracket_->set_object ("pedal-text", p->item_->self_scm ());
- }
+ WTF is pedal-text not the bound of the object? --hwn
+ */
+ if (p->item_)
+ p->bracket_->set_object ("pedal-text", p->item_->self_scm ());
+ }
}
p->event_drul_[START] = 0;
for (Pedal_info *p = info_list_; p->type_; p++)
{
if (p->bracket_
- && !p->bracket_->is_live ())
- p->bracket_ = 0;
+ && !p->bracket_->is_live ())
+ p->bracket_ = 0;
if (p->bracket_)
- {
- SCM cc = get_property ("currentCommandColumn");
- Item *c = unsmob_item (cc);
- p->bracket_->set_bound (RIGHT, c);
+ {
+ SCM cc = get_property ("currentCommandColumn");
+ Item *c = unsmob_item (cc);
+ p->bracket_->set_bound (RIGHT, c);
- p->finished_bracket_ = p->bracket_;
- p->bracket_ = 0;
- typeset_all (p);
- }
+ p->finished_bracket_ = p->bracket_;
+ p->bracket_ = 0;
+ typeset_all (p);
+ }
}
}
{
for (Pedal_info *p = info_list_; p->type_; p++)
{
-
+
typeset_all (p);
if (p->bracket_ && !p->bracket_->get_bound (LEFT))
- {
- Grob *cmc = unsmob_grob (get_property ("currentMusicalColumn"));
+ {
+ Grob *cmc = unsmob_grob (get_property ("currentMusicalColumn"));
- if (!p->bracket_->get_bound (LEFT))
- p->bracket_->set_bound (LEFT, cmc);
- }
+ if (!p->bracket_->get_bound (LEFT))
+ p->bracket_->set_bound (LEFT, cmc);
+ }
}
for (Pedal_info *p = info_list_; p->type_; p++)
{
Grob *r = p->finished_bracket_->get_bound (RIGHT);
if (!r)
- p->finished_bracket_->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn")));
+ p->finished_bracket_->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn")));
p->finished_bracket_ = 0;
}
ADD_ACKNOWLEDGER (Piano_pedal_engraver, note_column);
ADD_TRANSLATOR (Piano_pedal_engraver,
- /* doc */
- "Engrave piano pedal symbols and brackets.",
-
- /* create */
- "PianoPedalBracket "
- "SostenutoPedal "
- "SustainPedal "
- "UnaCordaPedal ",
-
- /* read */
- "currentCommandColumn "
- "pedalSostenutoStrings "
- "pedalSostenutoStyle "
- "pedalSustainStrings "
- "pedalSustainStyle "
- "pedalUnaCordaStrings "
- "pedalUnaCordaStyle ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Engrave piano pedal symbols and brackets.",
+
+ /* create */
+ "PianoPedalBracket "
+ "SostenutoPedal "
+ "SustainPedal "
+ "UnaCordaPedal ",
+
+ /* read */
+ "currentCommandColumn "
+ "pedalSostenutoStrings "
+ "pedalSostenutoStyle "
+ "pedalSustainStrings "
+ "pedalSustainStyle "
+ "pedalUnaCordaStrings "
+ "pedalUnaCordaStyle ",
+
+ /* write */
+ ""
+ );
DECLARE_TRANSLATOR_LISTENER (una_corda);
DECLARE_TRANSLATOR_LISTENER (sostenuto);
private:
- vector<Audio_piano_pedal*> audios_;
+ vector<Audio_piano_pedal *> audios_;
Pedal_info info_alist_[NUM_PEDAL_TYPES];
};
{
switch (t)
{
- case SOSTENUTO:
+ case SOSTENUTO:
return "Sostenuto";
case SUSTAIN:
return "Sustain";
- case UNA_CORDA:
+ case UNA_CORDA:
return "UnaCorda";
default:
programming_error ("Unknown pedal type");
{
string pedal_type = pedal_type_str (i);
if (p->event_drul_[STOP])
- {
- if (!p->start_event_)
- p->event_drul_[STOP]->origin ()->warning (_f ("cannot find start of piano pedal: `%s'", pedal_type));
- else
- {
- Audio_piano_pedal *a = new Audio_piano_pedal;
- a->type_string_ = pedal_type;
- a->dir_ = STOP;
- audios_.push_back (a);
+ {
+ if (!p->start_event_)
+ p->event_drul_[STOP]->origin ()->warning (_f ("cannot find start of piano pedal: `%s'", pedal_type));
+ else
+ {
+ Audio_piano_pedal *a = new Audio_piano_pedal;
+ a->type_string_ = pedal_type;
+ a->dir_ = STOP;
+ audios_.push_back (a);
Audio_element_info info (a, p->event_drul_[STOP]);
announce_element (info);
- }
- p->start_event_ = 0;
- }
+ }
+ p->start_event_ = 0;
+ }
if (p->event_drul_[START])
- {
- p->start_event_ = p->event_drul_[START];
- Audio_piano_pedal *a = new Audio_piano_pedal;
- a->type_string_ = pedal_type;
- a->dir_ = START;
- audios_.push_back (a);
+ {
+ p->start_event_ = p->event_drul_[START];
+ Audio_piano_pedal *a = new Audio_piano_pedal;
+ a->type_string_ = pedal_type;
+ a->dir_ = START;
+ audios_.push_back (a);
Audio_element_info info (a, p->event_drul_[START]);
announce_element (info);
- }
+ }
p->event_drul_[START] = 0;
p->event_drul_[STOP] = 0;
}
}
ADD_TRANSLATOR (Piano_pedal_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Drul_array<bool>
Pitch_interval::add_point (Pitch p)
{
- Drul_array<bool> expansions(false,false);
+ Drul_array<bool> expansions (false, false);
if (at (LEFT).tone_pitch () > p.tone_pitch ())
{
at (LEFT) = p;
return expansions;
}
-
Pitch_lexicographic_interval::Pitch_lexicographic_interval (Pitch p1, Pitch p2)
{
at (LEFT) = p1;
Drul_array<bool>
Pitch_lexicographic_interval::add_point (Pitch p)
{
- Drul_array<bool> expansions(false,false);
+ Drul_array<bool> expansions (false, false);
if (at (LEFT) > p)
{
at (LEFT) = p;
#include "pitch.hh"
LY_DEFINE (ly_pitch_transpose, "ly:pitch-transpose",
- 2, 0, 0, (SCM p, SCM delta),
- "Transpose @var{p} by the amount @var{delta},"
- " where @var{delta} is relative to middle@tie{}C.")
+ 2, 0, 0, (SCM p, SCM delta),
+ "Transpose @var{p} by the amount @var{delta},"
+ " where @var{delta} is relative to middle@tie{}C.")
{
LY_ASSERT_SMOB (Pitch, p, 1);
LY_ASSERT_SMOB (Pitch, delta, 2);
/* Should add optional args. */
LY_DEFINE (ly_make_pitch, "ly:make-pitch",
- 2, 1, 0, (SCM octave, SCM note, SCM alter),
- "@var{octave} is specified by an integer, zero for the octave"
- " containing middle@tie{}C. @var{note} is a number indexing the"
- " global default scale, with 0 corresponding to pitch@tie{}C"
- " and 6 usually corresponding to pitch@tie{}B. @var{alter} is"
- " a rational number of 200-cent whole tones for alteration.")
+ 2, 1, 0, (SCM octave, SCM note, SCM alter),
+ "@var{octave} is specified by an integer, zero for the octave"
+ " containing middle@tie{}C. @var{note} is a number indexing the"
+ " global default scale, with 0 corresponding to pitch@tie{}C"
+ " and 6 usually corresponding to pitch@tie{}B. @var{alter} is"
+ " a rational number of 200-cent whole tones for alteration.")
{
LY_ASSERT_TYPE (scm_is_integer, octave, 1);
LY_ASSERT_TYPE (scm_is_integer, note, 2);
LY_ASSERT_TYPE (scm_is_rational, alter, 3);
-
+
Pitch p (scm_to_int (octave), scm_to_int (note),
- ly_scm2rational (alter));
-
+ ly_scm2rational (alter));
+
return p.smobbed_copy ();
}
LY_DEFINE (ly_pitch_negate, "ly:pitch-negate", 1, 0, 0,
- (SCM p),
- "Negate @var{p}.")
+ (SCM p),
+ "Negate @var{p}.")
{
LY_ASSERT_SMOB (Pitch, p, 1);
Pitch *pp = unsmob_pitch (p);
}
LY_DEFINE (ly_pitch_steps, "ly:pitch-steps", 1, 0, 0,
- (SCM p),
- "Number of steps counted from middle@tie{}C of the"
- " pitch@tie{}@var{p}.")
+ (SCM p),
+ "Number of steps counted from middle@tie{}C of the"
+ " pitch@tie{}@var{p}.")
{
LY_ASSERT_SMOB (Pitch, p, 1);
Pitch *pp = unsmob_pitch (p);
}
LY_DEFINE (ly_pitch_octave, "ly:pitch-octave",
- 1, 0, 0, (SCM pp),
- "Extract the octave from pitch@tie{}@var{pp}.")
+ 1, 0, 0, (SCM pp),
+ "Extract the octave from pitch@tie{}@var{pp}.")
{
LY_ASSERT_SMOB (Pitch, pp, 1);
Pitch *p = unsmob_pitch (pp);
}
LY_DEFINE (ly_pitch_alteration, "ly:pitch-alteration",
- 1, 0, 0, (SCM pp),
- "Extract the alteration from pitch@tie{}@var{pp}.")
+ 1, 0, 0, (SCM pp),
+ "Extract the alteration from pitch@tie{}@var{pp}.")
{
LY_ASSERT_SMOB (Pitch, pp, 1);
Pitch *p = unsmob_pitch (pp);
}
LY_DEFINE (pitch_notename, "ly:pitch-notename",
- 1, 0, 0, (SCM pp),
- "Extract the note name from pitch @var{pp}.")
+ 1, 0, 0, (SCM pp),
+ "Extract the note name from pitch @var{pp}.")
{
LY_ASSERT_SMOB (Pitch, pp, 1);
Pitch *p = unsmob_pitch (pp);
}
LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones",
- 1, 0, 0, (SCM pp),
- "Calculate the number of quarter tones of@tie{}@var{pp} from"
- " middle@tie{}C.")
+ 1, 0, 0, (SCM pp),
+ "Calculate the number of quarter tones of@tie{}@var{pp} from"
+ " middle@tie{}C.")
{
LY_ASSERT_SMOB (Pitch, pp, 1);
Pitch *p = unsmob_pitch (pp);
}
LY_DEFINE (ly_pitch_semitones, "ly:pitch-semitones",
- 1, 0, 0, (SCM pp),
- "Calculate the number of semitones of@tie{}@var{pp} from"
- " middle@tie{}C.")
+ 1, 0, 0, (SCM pp),
+ "Calculate the number of semitones of@tie{}@var{pp} from"
+ " middle@tie{}C.")
{
LY_ASSERT_SMOB (Pitch, pp, 1);
Pitch *p = unsmob_pitch (pp);
}
LY_DEFINE (ly_pitch_less_p, "ly:pitch<?",
- 2, 0, 0, (SCM p1, SCM p2),
- "Is @var{p1} lexicographically smaller than @var{p2}?")
+ 2, 0, 0, (SCM p1, SCM p2),
+ "Is @var{p1} lexicographically smaller than @var{p2}?")
{
LY_ASSERT_SMOB (Pitch, p1, 1);
LY_ASSERT_SMOB (Pitch, p2, 2);
}
LY_DEFINE (ly_pitch_diff, "ly:pitch-diff",
- 2, 0, 0, (SCM pitch, SCM root),
- "Return pitch @var{delta} such that @var{pitch} transposed by"
- " @var{delta} equals @var{root}.")
+ 2, 0, 0, (SCM pitch, SCM root),
+ "Return pitch @var{delta} such that @var{pitch} transposed by"
+ " @var{delta} equals @var{root}.")
{
-
+
LY_ASSERT_SMOB (Pitch, pitch, 1);
LY_ASSERT_SMOB (Pitch, root, 2);
/* FIXME: probably isn't the right place for this function */
#include "context.hh"
LY_DEFINE (ly_set_middle_C_x, "ly:set-middle-C!",
- 1, 0, 0, (SCM context),
- "Set the @code{middleCPosition} variable in @var{context}"
- " based on the variables @code{middleCClefPosition} and"
- " middleCOffset.")
+ 1, 0, 0, (SCM context),
+ "Set the @code{middleCPosition} variable in @var{context}"
+ " based on the variables @code{middleCClefPosition} and"
+ " middleCOffset.")
{
LY_ASSERT_SMOB (Context, context, 1);
#include "translator.icc"
ADD_ACKNOWLEDGER (Pitch_squash_engraver, note_head);
ADD_TRANSLATOR (Pitch_squash_engraver,
- /* doc */
- "Set the vertical position of note heads to"
- " @code{squashedPosition}, if that property is set. This can"
- " be used to make a single-line staff demonstrating the"
- " rhythm of a melody.",
+ /* doc */
+ "Set the vertical position of note heads to"
+ " @code{squashedPosition}, if that property is set. This can"
+ " be used to make a single-line staff demonstrating the"
+ " rhythm of a melody.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "squashedPosition ",
+ /* read */
+ "squashedPosition ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "ly-smobs.icc"
-
Pitch::Pitch (int o, int n, Rational a)
{
notename_ = n;
{
Rational sound = to.tone_pitch () - from.tone_pitch ();
Pitch pt (to.get_octave () - from.get_octave (),
- to.get_notename () - from.get_notename (),
+ to.get_notename () - from.get_notename (),
- to.get_alteration () - from.get_alteration ());
+ to.get_alteration () - from.get_alteration ());
return pt.transposed (Pitch (0, 0, sound - pt.tone_pitch ()));
}
/* FIXME
Merge with *pitch->text* funcs in chord-name.scm */
char const *accname[] = {"eses", "eseh", "es", "eh", "",
- "ih", "is", "isih", "isis"};
+ "ih", "is", "isih", "isis"
+ };
string
Pitch::to_string () const
{
int n = (notename_ + 2) % scale_->step_count ();
string s = ::to_string (char (n + 'a'));
- Rational qtones = alteration_ * Rational (4,1);
+ Rational qtones = alteration_ * Rational (4, 1);
int qt = int (rint (Real (qtones)));
s += string (accname[qt + 4]);
{
int o = octave_ + 1;
while (o--)
- s += "'";
+ s += "'";
}
else if (octave_ < 0)
{
int o = (-octave_) - 1;
while (o--)
- s += ::to_string (',');
+ s += ::to_string (',');
}
return s;
SCM
Pitch::mark_smob (SCM x)
{
- Pitch *p = (Pitch*) SCM_CELL_WORD_1 (x);
+ Pitch *p = (Pitch *) SCM_CELL_WORD_1 (x);
return p->scale_->self_scm ();
}
Pitch *q = (Pitch *) SCM_CELL_WORD_1 (b);
bool eq = p->notename_ == q->notename_
- && p->octave_ == q->octave_
- && p->alteration_ == q->alteration_;
+ && p->octave_ == q->octave_
+ && p->alteration_ == q->alteration_;
return eq ? SCM_BOOL_T : SCM_BOOL_F;
}
Item *trill_group_;
Item *trill_accidental_;
- vector<Grob*> heads_;
+ vector<Grob *> heads_;
void make_trill (Stream_event *);
};
SCM keysig = get_property ("localKeySignature");
SCM key = scm_cons (scm_from_int (p->get_octave ()),
- scm_from_int (p->get_notename ()));
+ scm_from_int (p->get_notename ()));
- int bn = measure_number (context());
+ int bn = measure_number (context ());
SCM handle = scm_assoc (key, keysig);
if (handle != SCM_BOOL_F)
{
bool same_bar = (bn == robust_scm2int (scm_caddr (handle), 0));
bool same_alt
- = (p->get_alteration () == robust_scm2rational (scm_cadr (handle), 0));
+ = (p->get_alteration () == robust_scm2rational (scm_cadr (handle), 0));
if (!same_bar || (same_bar && !same_alt))
- handle = SCM_BOOL_F;
+ handle = SCM_BOOL_F;
}
bool print_acc
= (handle == SCM_BOOL_F) || p->get_alteration () == Rational (0)
- || (ev->get_property ("force-accidental") == SCM_BOOL_T);
+ || (ev->get_property ("force-accidental") == SCM_BOOL_T);
if (trill_head_)
{
int c0 = scm_is_number (c0scm) ? scm_to_int (c0scm) : 0;
trill_head_->set_property ("staff-position",
- scm_from_int (unsmob_pitch (scm_pitch)->steps ()
- + c0));
+ scm_from_int (unsmob_pitch (scm_pitch)->steps ()
+ + c0));
trill_group_ = make_item ("TrillPitchGroup", ev->self_scm ());
trill_group_->set_parent (trill_head_, Y_AXIS);
// fixme: naming -> alterations
trill_accidental_->set_property ("alteration", ly_rational2scm (p->get_alteration ()));
Side_position_interface::add_support (trill_accidental_, trill_head_);
-
+
trill_head_->set_object ("accidental-grob", trill_accidental_->self_scm ());
trill_accidental_->set_parent (trill_head_, Y_AXIS);
Axis_group_interface::add_element (trill_group_, trill_accidental_);
trill_accidental_ = 0;
}
-
#include "translator.icc"
ADD_ACKNOWLEDGER (Pitched_trill_engraver, note_head);
ADD_ACKNOWLEDGER (Pitched_trill_engraver, trill_spanner);
ADD_TRANSLATOR (Pitched_trill_engraver,
- /* doc */
- "Print the bracketed note head after a note head with trill.",
+ /* doc */
+ "Print the bracketed note head after a note head with trill.",
- /* create */
- "TrillPitchHead "
- "TrillPitchAccidental "
- "TrillPitchGroup ",
+ /* create */
+ "TrillPitchHead "
+ "TrillPitchAccidental "
+ "TrillPitchGroup ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "grob.hh"
LY_DEFINE (ly_pointer_group_interface__add_grob, "ly:pointer-group-interface::add-grob",
- 3, 0, 0, (SCM grob, SCM sym, SCM grob_element),
- "Add @var{grob-element} to @var{grob}'s @var{sym} grob array.")
+ 3, 0, 0, (SCM grob, SCM sym, SCM grob_element),
+ "Add @var{grob-element} to @var{grob}'s @var{sym} grob array.")
{
LY_ASSERT_TYPE (unsmob_grob, grob, 1);
LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
LY_ASSERT_TYPE (unsmob_grob, grob_element, 3);
Pointer_group_interface::add_grob (unsmob_grob (grob),
- sym,
- unsmob_grob (grob_element));
+ sym,
+ unsmob_grob (grob_element));
return SCM_UNSPECIFIED;
}
}
Grob *
-Pointer_group_interface::find_grob (Grob *me, SCM sym, bool (*pred) (Grob*))
+Pointer_group_interface::find_grob (Grob *me, SCM sym, bool (*pred) (Grob *))
{
Grob_array *arr = get_grob_array (me, sym);
arr->set_ordered (false);
}
-static vector<Grob*> empty_array;
+static vector<Grob *> empty_array;
-vector<Grob*> const &
+vector<Grob *> const &
ly_scm2link_array (SCM x)
{
Grob_array *arr = unsmob_grob_array (x);
return arr ? arr->array () : empty_array;
}
-vector<Grob*> const &
+vector<Grob *> const &
internal_extract_grob_array (Grob const *elt, SCM symbol)
{
return elt
- ? ly_scm2link_array (elt->internal_get_object (symbol))
- : empty_array;
+ ? ly_scm2link_array (elt->internal_get_object (symbol))
+ : empty_array;
}
-vector<Item*>
+vector<Item *>
internal_extract_item_array (Grob const *elt, SCM symbol)
{
Grob_array *arr = unsmob_grob_array (elt->internal_get_object (symbol));
- vector<Item*> items;
+ vector<Item *> items;
for (vsize i = 0; arr && i < arr->size (); i++)
items.push_back (arr->item (i));
#include "prob.hh"
LY_DEFINE (ly_prob_set_property_x, "ly:prob-set-property!",
- 2, 1, 0, (SCM obj, SCM sym, SCM value),
- "Set property @var{sym} of @var{obj} to @var{value}.")
+ 2, 1, 0, (SCM obj, SCM sym, SCM value),
+ "Set property @var{sym} of @var{obj} to @var{value}.")
{
LY_ASSERT_SMOB (Prob, obj, 1);
Prob *ps = unsmob_prob (obj);
Hmm, this is not orthogonal.
*/
LY_DEFINE (ly_prob_property_p, "ly:prob-property?",
- 2, 1, 0, (SCM obj, SCM sym),
- "Is boolean prop @var{sym} of @var{sym} set?")
+ 2, 1, 0, (SCM obj, SCM sym),
+ "Is boolean prop @var{sym} of @var{sym} set?")
{
return scm_equal_p (SCM_BOOL_T, ly_prob_property (obj, sym, SCM_BOOL_F));
}
LY_DEFINE (ly_prob_property, "ly:prob-property",
- 2, 1, 0, (SCM prob, SCM sym, SCM val),
- "Return the value for property @var{sym} of Prob object"
- " @var{prob}. If no value is found, return @var{val} or"
- " @code{'()} if @var{val} is not specified.")
+ 2, 1, 0, (SCM prob, SCM sym, SCM val),
+ "Return the value for property @var{sym} of Prob object"
+ " @var{prob}. If no value is found, return @var{val} or"
+ " @code{'()} if @var{val} is not specified.")
{
LY_ASSERT_SMOB (Prob, prob, 1);
Prob *ps = unsmob_prob (prob);
}
LY_DEFINE (ly_prob_type_p, "ly:prob-type?",
- 2, 0, 0,
- (SCM obj, SCM type),
- "Is @var{obj} the specified prob-type?")
+ 2, 0, 0,
+ (SCM obj, SCM type),
+ "Is @var{obj} the specified prob-type?")
{
- Prob*prob = unsmob_prob (obj);
+ Prob *prob = unsmob_prob (obj);
return scm_from_bool (prob && prob->type () == type);
}
LY_DEFINE (ly_make_prob, "ly:make-prob",
- 2, 0, 1,
- (SCM type, SCM init, SCM rest),
- "Create a @code{Prob} object.")
+ 2, 0, 1,
+ (SCM type, SCM init, SCM rest),
+ "Create a @code{Prob} object.")
{
Prob *pr = new Prob (type, init);
pr->set_property (sym, val);
}
-
+
return pr->unprotect ();
}
-
LY_DEFINE (ly_prob_mutable_properties, "ly:prob-mutable-properties",
- 1, 0, 0,
- (SCM prob),
- "Retrieve an alist of mutable properties.")
+ 1, 0, 0,
+ (SCM prob),
+ "Retrieve an alist of mutable properties.")
{
LY_ASSERT_SMOB (Prob, prob, 1);
Prob *ps = unsmob_prob (prob);
}
LY_DEFINE (ly_prob_immutable_properties, "ly:prob-immutable-properties",
- 1, 0, 0,
- (SCM prob),
- "Retrieve an alist of immutable properties.")
+ 1, 0, 0,
+ (SCM prob),
+ "Retrieve an alist of immutable properties.")
{
LY_ASSERT_SMOB (Prob, prob, 1);
Prob *ps = unsmob_prob (prob);
SCM bprop = props[1][i];
for (;
- scm_is_pair (aprop) && scm_is_pair (bprop);
- aprop = scm_cdr (aprop), bprop = scm_cdr (bprop))
- {
- SCM aval = scm_cdar (aprop);
- SCM bval = scm_cdar (bprop);
- if (scm_caar (aprop) != scm_caar (bprop) ||
- (
- !(unsmob_input (aval) && unsmob_input (bval))
- &&
- !to_boolean (scm_equal_p (aval, bval))))
- return SCM_BOOL_F;
- }
+ scm_is_pair (aprop) && scm_is_pair (bprop);
+ aprop = scm_cdr (aprop), bprop = scm_cdr (bprop))
+ {
+ SCM aval = scm_cdar (aprop);
+ SCM bval = scm_cdar (bprop);
+ if (scm_caar (aprop) != scm_caar (bprop)
+ || (!(unsmob_input (aval) && unsmob_input (bval))
+ &&
+ !to_boolean (scm_equal_p (aval, bval))))
+ return SCM_BOOL_F;
+ }
/* is one list shorter? */
if (aprop != SCM_EOL || bprop != SCM_EOL)
- return SCM_BOOL_F;
+ return SCM_BOOL_F;
}
return SCM_BOOL_T;
smobify_self ();
}
-
Prob::~Prob ()
{
}
mutable_property_alist_ = src.copy_mutable_properties ();
}
-
SCM
Prob::copy_mutable_properties () const
{
}
int
-Prob::print_smob (SCM smob, SCM port, scm_print_state*)
+Prob::print_smob (SCM smob, SCM port, scm_print_state *)
{
Prob *p = (Prob *) SCM_CELL_WORD_1 (smob);
scm_puts ("#<", port);
return 1;
}
-
-
SCM
Prob::internal_get_property (SCM sym) const
{
/* We don't (yet) instrument probs */
void
-Prob::instrumented_set_property (SCM sym, SCM val, const char*, int, const char*)
+Prob::instrumented_set_property (SCM sym, SCM val, const char *, int, const char *)
{
internal_set_property (sym, val);
}
SCM prob_property_lookup_table;
LY_DEFINE (ly_property_lookup_stats, "ly:property-lookup-stats",
- 1, 0, 0, (SCM sym),
- "Return hash table with a property access corresponding to"
- " @var{sym}. Choices are @code{prob}, @code{grob}, and"
- " @code{context}.")
+ 1, 0, 0, (SCM sym),
+ "Return hash table with a property access corresponding to"
+ " @var{sym}. Choices are @code{prob}, @code{grob}, and"
+ " @code{context}.")
{
if (sym == ly_symbol2scm ("context"))
return context_property_lookup_table ? context_property_lookup_table
- : scm_c_make_hash_table (1);
+ : scm_c_make_hash_table (1);
if (sym == ly_symbol2scm ("prob"))
return prob_property_lookup_table ? prob_property_lookup_table
- : scm_c_make_hash_table (1);
+ : scm_c_make_hash_table (1);
if (sym == ly_symbol2scm ("grob"))
return grob_property_lookup_table ? grob_property_lookup_table
- : scm_c_make_hash_table (1);
+ : scm_c_make_hash_table (1);
return scm_c_make_hash_table (1);
}
-
void
note_property_access (SCM *table, SCM sym)
{
static SCM option_hash;
-
void
internal_set_option (SCM var,
- SCM val)
+ SCM val)
{
if (0)
;
scm_hashq_set_x (option_hash, var, val);
}
-
ssize const HELP_INDENT = 30;
ssize const INDENT = 2;
ssize const SEPARATION = 5;
SCM sym = scm_caar (s);
SCM val = scm_cdar (s);
string opt_spec = String_convert::char_string (' ', INDENT)
- + ly_symbol2string (sym)
- + " ("
- + ly_scm2string (scm_call_1 (converter, val))
- + ")";
+ + ly_symbol2string (sym)
+ + " ("
+ + ly_scm2string (scm_call_1 (converter, val))
+ + ")";
if (opt_spec.length () + SEPARATION > HELP_INDENT)
- opt_spec += "\n" + String_convert::char_string (' ', HELP_INDENT);
+ opt_spec += "\n" + String_convert::char_string (' ', HELP_INDENT);
else
- opt_spec += String_convert::char_string (' ', HELP_INDENT
- - opt_spec.length ());
+ opt_spec += String_convert::char_string (' ', HELP_INDENT
+ - opt_spec.length ());
SCM opt_help_scm
- = scm_object_property (sym,
- ly_symbol2scm ("program-option-documentation"));
+ = scm_object_property (sym,
+ ly_symbol2scm ("program-option-documentation"));
string opt_help = ly_scm2string (opt_help_scm);
replace_all (&opt_help,
- string ("\n"),
- string ("\n")
- + String_convert::char_string (' ', HELP_INDENT));
+ string ("\n"),
+ string ("\n")
+ + String_convert::char_string (' ', HELP_INDENT));
opts.push_back (opt_spec + opt_help + "\n");
}
return help;
}
-
LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (),
- "Print @code{ly:set-option} usage.")
+ "Print @code{ly:set-option} usage.")
{
string help = get_help_string ();
- puts (help.c_str());
+ puts (help.c_str ());
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_add_option, "ly:add-option", 3, 0, 0,
- (SCM sym, SCM val, SCM description),
- "Add a program option @var{sym}. @var{val} is the default"
- " value and @var{description} is a string description.")
+ (SCM sym, SCM val, SCM description),
+ "Add a program option @var{sym}. @var{val} is the default"
+ " value and @var{description} is a string description.")
{
if (!option_hash)
option_hash = scm_permanent_object (scm_c_make_hash_table (11));
internal_set_option (sym, val);
scm_set_object_property_x (sym, ly_symbol2scm ("program-option-documentation"),
- description);
+ description);
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val),
- "Set a program option.")
+ "Set a program option.")
{
LY_ASSERT_TYPE (ly_is_symbol, var, 1);
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_command_line_options, "ly:command-line-options", 0, 0, 0, (),
- "The Scheme options specified on command-line with @option{-d}.")
+ "The Scheme options specified on command-line with @option{-d}.")
{
return ly_string2scm (init_scheme_variables_global);
}
-
LY_DEFINE (ly_command_line_code, "ly:command-line-code", 0, 0, 0, (),
- "The Scheme code specified on command-line with @option{-e}.")
+ "The Scheme code specified on command-line with @option{-e}.")
{
return ly_string2scm (init_scheme_code_global);
}
-
LY_DEFINE (ly_command_line_verbose_p, "ly:command-line-verbose?", 0, 0, 0, (),
- "Was @code{be_verbose_global} set?")
+ "Was @code{be_verbose_global} set?")
{
return scm_from_bool (be_verbose_global);
}
-
LY_DEFINE (ly_all_options, "ly:all-options",
- 0, 0, 0, (),
- "Get all option settings in an alist.")
+ 0, 0, 0, (),
+ "Get all option settings in an alist.")
{
return ly_hash2alist (option_hash);
}
-
LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var),
- "Get a global option setting.")
+ "Get a global option setting.")
{
LY_ASSERT_TYPE (ly_is_symbol, var, 1);
return scm_hashq_ref (option_hash, var, SCM_BOOL_F);
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2007--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Music *m = get_music ();
SCM previous_value = o->get_property (m->get_property ("symbol"));
send_stream_event (o, "SetProperty", m->origin (),
- ly_symbol2scm ("symbol"), m->get_property ("symbol"),
- ly_symbol2scm ("value"), m->get_property ("value"));
+ ly_symbol2scm ("symbol"), m->get_property ("symbol"),
+ ly_symbol2scm ("value"), m->get_property ("value"));
/* For \once \set install a finalization hook to reset the property to the
* previous value after the timestep */
{
Global_context *tg = get_outlet ()->get_global_context ();
tg->add_finalization (scm_list_n (once_finalization_proc,
- o->self_scm (), m->self_scm (),
- ly_quote_scm (previous_value), SCM_UNDEFINED));
+ o->self_scm (), m->self_scm (),
+ ly_quote_scm (previous_value), SCM_UNDEFINED));
}
-
+
Simple_music_iterator::process (mom);
}
{
SCM sym = get_music ()->get_property ("symbol");
send_stream_event (get_outlet (), "UnsetProperty", get_music ()->origin (),
- ly_symbol2scm ("symbol"), sym);
+ ly_symbol2scm ("symbol"), sym);
Simple_music_iterator::process (m);
}
// Do not use UnsetProperty, which sets the default, but rather
// cache the value before the \once \set command and restore it now
send_stream_event (c, "SetProperty", m->origin (),
- ly_symbol2scm ("symbol"), m->get_property ("symbol"),
- ly_symbol2scm ("value"), previous_value);
+ ly_symbol2scm ("symbol"), m->get_property ("symbol"),
+ ly_symbol2scm ("value"), previous_value);
return SCM_UNSPECIFIED;
}
if (!g)
mus->origin ()->warning (_f ("not a grob name, `%s'",
- ly_symbol2string (sym)));
+ ly_symbol2string (sym)));
return g;
}
SCM val = get_music ()->get_property ("grob-value");
if (to_boolean (get_music ()->get_property ("pop-first"))
- && !to_boolean (get_music ()->get_property ("once")))
- send_stream_event (get_outlet (), "Revert", get_music ()->origin (),
- ly_symbol2scm ("symbol"), sym,
- ly_symbol2scm ("property-path"), grob_property_path);
-
+ && !to_boolean (get_music ()->get_property ("once")))
+ send_stream_event (get_outlet (), "Revert", get_music ()->origin (),
+ ly_symbol2scm ("symbol"), sym,
+ ly_symbol2scm ("property-path"), grob_property_path);
+
send_stream_event (get_outlet (), "Override", get_music ()->origin (),
- ly_symbol2scm ("symbol"), sym,
- ly_symbol2scm ("property-path"), grob_property_path,
- ly_symbol2scm ("value"), val);
+ ly_symbol2scm ("symbol"), sym,
+ ly_symbol2scm ("property-path"), grob_property_path,
+ ly_symbol2scm ("value"), val);
}
Simple_music_iterator::process (m);
}
SCM grob_property_path = get_property_path (mus);
send_stream_event (c, "Revert", mus->origin (),
- ly_symbol2scm ("symbol"), sym,
- ly_symbol2scm ("property-path"), grob_property_path);
+ ly_symbol2scm ("symbol"), sym,
+ ly_symbol2scm ("property-path"), grob_property_path);
}
return SCM_UNSPECIFIED;
}
Global_context *tg = get_outlet ()->get_global_context ();
tg->add_finalization (scm_list_n (once_finalization_proc,
- trans, music, SCM_UNDEFINED));
+ trans, music, SCM_UNDEFINED));
}
}
SCM grob_property_path = get_property_path (get_music ());
send_stream_event (get_outlet (), "Revert", get_music ()->origin (),
- ly_symbol2scm ("symbol"), sym,
- ly_symbol2scm ("property-path"), grob_property_path);
+ ly_symbol2scm ("symbol"), sym,
+ ly_symbol2scm ("property-path"), grob_property_path);
}
Simple_music_iterator::process (m);
}
Protected_scm::Protected_scm (Protected_scm const &s)
{
object_ = (SCM_NIMP (s.object_) ? scm_gc_protect_object (s.object_)
- : s.object_);
+ : s.object_);
}
Protected_scm::~Protected_scm ()
SCM event_vector_;
int event_idx_;
int end_idx_;
-
+
SCM transposed_musics_;
DECLARE_SCHEME_CALLBACK (constructor, ());
for (; scm_is_pair (accept); accept = scm_cdr (accept))
{
if (ev->internal_in_event_class (scm_car (accept)))
- return true;
+ return true;
}
return false;
}
SCM when = scm_caar (scm_c_vector_ref (vec, cmp));
bool result = (*is_less) (key, when);
if (result)
- hi = cmp;
+ hi = cmp;
else
- lo = cmp;
+ lo = cmp;
}
while (hi - lo > 1);
Quote_iterator::construct_children ()
{
Music_wrapper_iterator::construct_children ();
-
+
SCM name = get_music ()->get_property ("quoted-context-type");
SCM id = get_music ()->get_property ("quoted-context-id");
&& scm_is_symbol (name))
{
Context *cue_context = get_outlet ()->find_create_context (name,
- ly_scm2string (id), SCM_EOL);
+ ly_scm2string (id), SCM_EOL);
quote_outlet_.set_context (cue_context);
}
else
Quote_iterator::quote_ok () const
{
return (event_idx_ >= 0
- && scm_is_vector (event_vector_)
- && event_idx_ <= end_idx_
+ && scm_is_vector (event_vector_)
+ && event_idx_ <= end_idx_
- /*
- Don't quote the grace notes leading to an unquoted note.
- */
- && vector_moment (event_idx_).main_part_ < stop_moment_.main_part_);
+ /*
+ Don't quote the grace notes leading to an unquoted note.
+ */
+ && vector_moment (event_idx_).main_part_ < stop_moment_.main_part_);
}
Moment
if (event_idx_ < 0)
{
event_idx_ = binsearch_scm_vector (event_vector_,
- get_outlet ()->now_mom ().smobbed_copy (),
- &moment_less);
+ get_outlet ()->now_mom ().smobbed_copy (),
+ &moment_less);
start_moment_ = get_outlet ()->now_mom () - music_start_mom ();
stop_moment_ = start_moment_ + get_music ()->get_length ();
end_idx_ = binsearch_scm_vector (event_vector_,
- stop_moment_.smobbed_copy (),
- &moment_less);
+ stop_moment_.smobbed_copy (),
+ &moment_less);
}
m += start_moment_;
{
Moment em = vector_moment (event_idx_);
if (em > m)
- return;
+ return;
if (em == m)
- break;
+ break;
event_idx_++;
}
Pitch *quote_pitch = unsmob_pitch (scm_cdar (entry));
/*
- The pitch that sounds like central C
+ The pitch that sounds like central C
*/
Pitch *me_pitch = unsmob_pitch (get_music ()->get_property ("quoted-transposition"));
if (!me_pitch)
- me_pitch = unsmob_pitch (get_outlet ()->get_property ("instrumentTransposition"));
+ me_pitch = unsmob_pitch (get_outlet ()->get_property ("instrumentTransposition"));
SCM cid = get_music ()->get_property ("quoted-context-id");
bool is_cue = scm_is_string (cid) && (ly_scm2string (cid) == "cue");
for (SCM s = scm_cdr (entry); scm_is_pair (s); s = scm_cdr (s))
- {
- SCM ev_acc = scm_car (s);
-
- Stream_event *ev = unsmob_stream_event (scm_car (ev_acc));
- if (!ev)
- programming_error ("no music found in quote");
- else if (accept_music_type (ev, is_cue))
- {
- /* create a transposed copy if necessary */
- if (quote_pitch || me_pitch)
- {
- Pitch qp, mp;
- if (quote_pitch)
- qp = *quote_pitch;
- if (me_pitch)
- mp = *me_pitch;
-
- Pitch diff = pitch_interval (qp, mp);
- ev = ev->clone ();
-
- transpose_mutable (ev->get_property_alist (true), diff);
- transposed_musics_ = scm_cons (ev->unprotect (), transposed_musics_);
- }
- quote_outlet_.get_outlet ()->event_source ()->broadcast (ev);
- }
- }
+ {
+ SCM ev_acc = scm_car (s);
+
+ Stream_event *ev = unsmob_stream_event (scm_car (ev_acc));
+ if (!ev)
+ programming_error ("no music found in quote");
+ else if (accept_music_type (ev, is_cue))
+ {
+ /* create a transposed copy if necessary */
+ if (quote_pitch || me_pitch)
+ {
+ Pitch qp, mp;
+ if (quote_pitch)
+ qp = *quote_pitch;
+ if (me_pitch)
+ mp = *me_pitch;
+
+ Pitch diff = pitch_interval (qp, mp);
+ ev = ev->clone ();
+
+ transpose_mutable (ev->get_property_alist (true), diff);
+ transposed_musics_ = scm_cons (ev->unprotect (), transposed_musics_);
+ }
+ quote_outlet_.get_outlet ()->event_source ()->broadcast (ev);
+ }
+ }
event_idx_++;
}
};
MAKE_SCHEME_CALLBACK (Relative_octave_check, relative_callback, 2)
- SCM
+SCM
Relative_octave_check::relative_callback (SCM music, SCM last_pitch)
{
Pitch p = *unsmob_pitch (last_pitch);
if (check_p)
{
Pitch no_octave (-1,
- check_p->get_notename (),
- check_p->get_alteration ());
+ check_p->get_notename (),
+ check_p->get_alteration ());
Pitch result = no_octave.to_relative_octave (p);
if (result != *check_p)
- {
- string s = _ ("Failed octave check, got: ");
- s += result.to_string ();
+ {
+ string s = _ ("Failed octave check, got: ");
+ s += result.to_string ();
- m->origin ()->warning (s);
+ m->origin ()->warning (s);
- delta_oct = check_p->get_octave () - result.get_octave ();
- }
+ delta_oct = check_p->get_octave () - result.get_octave ();
+ }
}
return Pitch (p.get_octave () + delta_oct,
- p.get_notename (),
- p.get_alteration ()).smobbed_copy ();
+ p.get_notename (),
+ p.get_alteration ()).smobbed_copy ();
}
};
MAKE_SCHEME_CALLBACK (Relative_octave_music, no_relative_callback, 2)
- SCM
+SCM
Relative_octave_music::no_relative_callback (SCM /* music */,
- SCM pitch)
+ SCM pitch)
{
return pitch;
}
MAKE_SCHEME_CALLBACK (Relative_octave_music, relative_callback, 2)
- SCM
+SCM
Relative_octave_music::relative_callback (SCM music, SCM pitch)
{
Music *me = unsmob_music (music);
{
lily_1_8_compatibility_used = true;
/* last-pitch should be junked some time, when
- we ditch 1.8 compat too.
+ we ditch 1.8 compat too.
- When you do, B should start where A left off.
+ When you do, B should start where A left off.
- \relative { A \relative { ...} B } */
+ \relative { A \relative { ...} B } */
SCM last_pitch = me->get_property ("last-pitch");
Pitch *ptr = unsmob_pitch (last_pitch);
return (ptr) ? last_pitch : pitch;
#include "config.hh"
-
/* TODO: autoconf support */
#include <sys/types.h>
char *s = strdup (combine.c_str ());
if (be_verbose_global)
- progress_indication (_f ("Setting %s to %s" , key, value.c_str ())
- + "\n");
-
- int retval = putenv (s);
+ progress_indication (_f ("Setting %s to %s", key, value.c_str ())
+ + "\n");
+
+ int retval = putenv (s);
/*
- unfortunately, we can't portably free S here,
- due to various bugs in glibc prior to 2.1.1
- */
+ unfortunately, we can't portably free S here,
+ due to various bugs in glibc prior to 2.1.1
+ */
return retval;
}
-
+
return -1;
}
if (is_dir (value))
{
if (be_verbose_global)
- progress_indication (_f ("%s=%s (prepend)\n", key, value.c_str ()));
+ progress_indication (_f ("%s=%s (prepend)\n", key, value.c_str ()));
if (char const *cur = getenv (key))
- value += to_string (PATHSEP) + cur;
+ value += to_string (PATHSEP) + cur;
return sane_putenv (key, value.c_str (), true);
}
lilypond_datadir = package_datadir + "/current";
else
warning (_f ("not relocating, no %s/ or current/ found under %s",
- TOPLEVEL_VERSION, package_datadir.c_str ()));
-
+ TOPLEVEL_VERSION, package_datadir.c_str ()));
+
#if HAVE_GETTEXT
if (is_dir (localedir))
bindtextdomain ("lilypond", localedir.c_str ());
if (be_verbose_global)
warning (_f ("Relocation: compile datadir=%s, new datadir=%s",
- old_lilypond_datadir.c_str (),
- lilypond_datadir.c_str ()));
+ old_lilypond_datadir.c_str (),
+ lilypond_datadir.c_str ()));
}
/*
warning (_f ("Relocation: framework_prefix=%s", prefix));
sane_putenv ("INSTALLER_PREFIX", prefix, true);
-
+
read_relocation_dir (prefix + "/etc/relocate/");
string bindir = prefix + "/bin";
-
+
prepend_env_path ("PATH", bindir);
}
setup_paths (char const *argv0_ptr)
{
File_name argv0_filename (argv0_ptr);
-
+
if (relocate_binary)
{
string prefix_directory;
if (getenv ("LILYPOND_RELOCATE_PREFIX"))
- {
- prefix_directory = getenv ("LILYPOND_RELOCATE_PREFIX");
+ {
+ prefix_directory = getenv ("LILYPOND_RELOCATE_PREFIX");
#ifdef __MINGW32__
- /* Normalize file name. */
- prefix_directory = File_name (prefix_directory).to_string ();
+ /* Normalize file name. */
+ prefix_directory = File_name (prefix_directory).to_string ();
#endif /* __MINGW32__ */
-
- prefix_relocation (prefix_directory);
- string bindir = prefix_directory + "/bin";
- framework_relocation (bindir);
- }
+
+ prefix_relocation (prefix_directory);
+ string bindir = prefix_directory + "/bin";
+ framework_relocation (bindir);
+ }
else if (relocate_binary)
- {
- string argv0_abs;
- if (argv0_filename.is_absolute ())
- {
- argv0_abs = argv0_filename.to_string ();
- if (be_verbose_global)
- warning (_f ("Relocation: is absolute: argv0=%s", argv0_ptr));
- }
- else if (argv0_filename.dir_.length ())
- {
- argv0_abs = get_working_directory ()
- + "/" + string (argv0_filename.to_string ());
- if (be_verbose_global)
- warning (_f ("Relocation: from cwd: argv0=%s", argv0_ptr));
- }
- else
- {
- /* Find absolute ARGV0 name, using PATH. */
- File_path path;
- path.parse_path (getenv ("PATH"));
+ {
+ string argv0_abs;
+ if (argv0_filename.is_absolute ())
+ {
+ argv0_abs = argv0_filename.to_string ();
+ if (be_verbose_global)
+ warning (_f ("Relocation: is absolute: argv0=%s", argv0_ptr));
+ }
+ else if (argv0_filename.dir_.length ())
+ {
+ argv0_abs = get_working_directory ()
+ + "/" + string (argv0_filename.to_string ());
+ if (be_verbose_global)
+ warning (_f ("Relocation: from cwd: argv0=%s", argv0_ptr));
+ }
+ else
+ {
+ /* Find absolute ARGV0 name, using PATH. */
+ File_path path;
+ path.parse_path (getenv ("PATH"));
#ifndef __MINGW32__
- argv0_abs = path.find (argv0_filename.to_string ());
+ argv0_abs = path.find (argv0_filename.to_string ());
#else /* __MINGW32__ */
- path.prepend (get_working_directory ());
- char const *ext[] = {"exe", "", 0 };
- argv0_abs = path.find (argv0_filename.to_string (), ext);
+ path.prepend (get_working_directory ());
+ char const *ext[] = {"exe", "", 0 };
+ argv0_abs = path.find (argv0_filename.to_string (), ext);
#endif /* __MINGW32__ */
- if (be_verbose_global)
- warning (_f ("Relocation: from PATH=%s\nargv0=%s",
- path.to_string ().c_str (), argv0_ptr));
-
- if (argv0_abs.empty ())
- programming_error ("cannot find absolute argv0");
- }
-
- string bindir = dir_name (argv0_abs);
- string argv0_prefix = dir_name (bindir);
- string compile_prefix = dir_name (dir_name (dir_name (lilypond_datadir)));
- if (argv0_prefix != compile_prefix)
- {
- prefix_relocation (argv0_prefix);
- prefix_directory = argv0_prefix;
- }
- if (argv0_prefix != compile_prefix || string (FRAMEWORKDIR) != "..")
- {
- framework_relocation (bindir + "/" + FRAMEWORKDIR);
- prefix_directory = bindir + "/" + FRAMEWORKDIR;
- }
- }
+ if (be_verbose_global)
+ warning (_f ("Relocation: from PATH=%s\nargv0=%s",
+ path.to_string ().c_str (), argv0_ptr));
+
+ if (argv0_abs.empty ())
+ programming_error ("cannot find absolute argv0");
+ }
+
+ string bindir = dir_name (argv0_abs);
+ string argv0_prefix = dir_name (bindir);
+ string compile_prefix = dir_name (dir_name (dir_name (lilypond_datadir)));
+ if (argv0_prefix != compile_prefix)
+ {
+ prefix_relocation (argv0_prefix);
+ prefix_directory = argv0_prefix;
+ }
+ if (argv0_prefix != compile_prefix || string (FRAMEWORKDIR) != "..")
+ {
+ framework_relocation (bindir + "/" + FRAMEWORKDIR);
+ prefix_directory = bindir + "/" + FRAMEWORKDIR;
+ }
+ }
lilypond_datadir = prefix_directory
- + "/share/lilypond/" TOPLEVEL_VERSION;
+ + "/share/lilypond/" TOPLEVEL_VERSION;
}
if (getenv ("LILYPONDPREFIX"))
&& is_dir (build_datadir_current.c_str ()))
lilypond_datadir = build_datadir_current;
+ lilypond_datadir = File_name (lilypond_datadir).canonicalized ().to_string ();
- lilypond_datadir = File_name (lilypond_datadir).canonicalized().to_string();
-
global_path.append ("");
/* Adding mf/out make lilypond unchanged source directory, when setting
LILYPONDPREFIX to lilypond-x.y.z */
char const *suffixes[] = {"ly", "ps", "scm", 0 };
-
+
vector<string> dirs;
for (char const **s = suffixes; *s; s++)
{
string path = lilypond_datadir + to_string ('/') + string (*s);
dirs.push_back (path);
}
-
+
dirs.push_back (lilypond_datadir + "/fonts/otf/");
dirs.push_back (lilypond_datadir + "/fonts/type1/");
dirs.push_back (lilypond_datadir + "/fonts/svg/");
-
+
for (vsize i = 0; i < dirs.size (); i++)
global_path.prepend (dirs[i]);
}
while (ptr < start_ptr + len)
{
char const *dollar = strchr (ptr, '$');
-
+
if (dollar != NULL)
- {
- char const *start_var = dollar + 1;
- char const *end_var = start_var;
- char const *start_next = end_var;
-
- out += string (ptr, dollar - ptr);
- ptr = dollar;
-
- if (*start_var == '{')
- {
- start_var ++;
-
- end_var = strchr (start_var, '}');
-
- if (end_var == NULL)
- {
- end_var = start_var + len;
- start_next = end_var;
- }
- else
- {
- start_next = end_var + 1;
- }
- }
- else
- {
- /*
- Hmm. what to do for $1 , $~ etc.?
- */
- do
- {
- end_var ++;
- }
- while (isalnum (*end_var) || *end_var == '_');
- start_next = end_var;
- }
-
- if (start_var < end_var)
- {
- string var_name (start_var, end_var - start_var);
- char const *value = getenv (var_name.c_str ());
- if (value != NULL)
- out += string (value);
-
- ptr = start_next;
- }
- }
+ {
+ char const *start_var = dollar + 1;
+ char const *end_var = start_var;
+ char const *start_next = end_var;
+
+ out += string (ptr, dollar - ptr);
+ ptr = dollar;
+
+ if (*start_var == '{')
+ {
+ start_var++;
+
+ end_var = strchr (start_var, '}');
+
+ if (end_var == NULL)
+ {
+ end_var = start_var + len;
+ start_next = end_var;
+ }
+ else
+ {
+ start_next = end_var + 1;
+ }
+ }
+ else
+ {
+ /*
+ Hmm. what to do for $1 , $~ etc.?
+ */
+ do
+ {
+ end_var++;
+ }
+ while (isalnum (*end_var) || *end_var == '_');
+ start_next = end_var;
+ }
+
+ if (start_var < end_var)
+ {
+ string var_name (start_var, end_var - start_var);
+ char const *value = getenv (var_name.c_str ());
+ if (value != NULL)
+ out += string (value);
+
+ ptr = start_next;
+ }
+ }
else
- break;
+ break;
}
read_line (FILE *f)
{
string out;
-
+
int c = 0;
while ((c = fgetc (f)) != EOF && c != '\n')
- out += char(c);
+ out += char (c);
return out;
}
{
if (be_verbose_global)
progress_indication (_f ("Relocation file: %s", filename.c_str ())
- + "\n");
-
+ + "\n");
+
char const *cname = filename.c_str ();
FILE *f = fopen (cname, "r");
if (!f)
string line = read_line (f);
size_t idx = line.find (' ');
if (idx == NPOS)
- continue;
-
+ continue;
+
string command = line.substr (0, idx);
line = line.substr (idx + 1);
-
+
if (idx == NPOS)
- continue;
+ continue;
idx = line.find ('=');
string variable = line.substr (0, idx);
value = expand_environment_variables (value);
if (command == "set")
- sane_putenv (variable.c_str (), value, true);
+ sane_putenv (variable.c_str (), value, true);
else if (command == "setdir")
- set_env_dir (variable.c_str (), value);
+ set_env_dir (variable.c_str (), value);
else if (command == "setfile")
- set_env_file (variable.c_str (), value);
+ set_env_file (variable.c_str (), value);
else if (command == "prependdir")
- prepend_env_path (variable.c_str (), value);
+ prepend_env_path (variable.c_str (), value);
else
- error (_f ("Unknown relocation command %s", command));
+ error (_f ("Unknown relocation command %s", command));
}
fclose (f);
if (DIR *dir = opendir (dirname.c_str ()))
while (struct dirent *ent = readdir (dir))
{
- File_name name (ent->d_name);
- if (name.ext_ == "reloc")
- read_relocation_file (dirname + "/" + name.to_string ());
+ File_name name (ent->d_name);
+ if (name.ext_ == "reloc")
+ read_relocation_file (dirname + "/" + name.to_string ());
}
}
{
SCM command = scm_car (cs);
if (command == ly_symbol2scm ("start-repeat"))
- start = true;
+ start = true;
else if (command == ly_symbol2scm ("end-repeat"))
- end = true;
+ end = true;
else if (scm_is_pair (command) && scm_car (command) == ly_symbol2scm ("volta"))
- volta_found = true;
+ volta_found = true;
cs = scm_cdr (cs);
}
if (!scm_is_string (wb) || ly_is_equal (db, wb))
{
if (s != "" || (volta_found && !scm_is_string (wb)))
- context ()->set_property ("whichBar", ly_string2scm (s));
+ context ()->set_property ("whichBar", ly_string2scm (s));
}
}
ADD_TRANSLATOR (Repeat_acknowledge_engraver,
- /* doc */
- "Acknowledge repeated music, and convert the contents of"
- " @code{repeatCommands} into an appropriate setting for"
- " @code{whichBar}.",
-
- /* create */
- "",
-
- /* read */
- "doubleRepeatType "
- "repeatCommands "
- "whichBar ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Acknowledge repeated music, and convert the contents of"
+ " @code{repeatCommands} into an appropriate setting for"
+ " @code{whichBar}.",
+
+ /* create */
+ "",
+
+ /* read */
+ "doubleRepeatType "
+ "repeatCommands "
+ "whichBar ",
+
+ /* write */
+ ""
+ );
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "engraver.hh"
#include "item.hh"
#include "pointer-group-interface.hh"
{
Stream_event *event_;
Grob *semi_tie_column_;
- vector<Grob*> semi_ties_;
-
- void stop_translation_timestep ();
+ vector<Grob *> semi_ties_;
+
+ void stop_translation_timestep ();
DECLARE_ACKNOWLEDGER (note_head);
DECLARE_TRANSLATOR_LISTENER (repeat_tie);
-
+
public:
TRANSLATOR_DECLARATIONS (Repeat_tie_engraver);
};
SCM cause = event_->self_scm ();
Grob *semi_tie = make_item ("RepeatTie", cause);
semi_tie->set_object ("note-head", inf.grob ()->self_scm ());
-
+
Pointer_group_interface::add_grob (semi_tie_column_, ly_symbol2scm ("ties"),
- semi_tie);
+ semi_tie);
semi_tie->set_parent (semi_tie_column_, Y_AXIS);
semi_ties_.push_back (semi_tie);
-
if (is_direction (unsmob_stream_event (cause)->get_property ("direction")))
{
Direction d = to_dir (unsmob_stream_event (cause)->get_property ("direction"));
- semi_tie->set_property ("direction", scm_from_int (d));
+ semi_tie->set_property ("direction", scm_from_int (d));
}
}
ADD_ACKNOWLEDGER (Repeat_tie_engraver, note_head);
-ADD_TRANSLATOR (Repeat_tie_engraver,
- /* doc */
- "Create repeat ties.",
-
- /* create */
- "RepeatTie "
- "RepeatTieColumn ",
-
- /* read */
- "",
-
- /* write */
- ""
- );
+ADD_TRANSLATOR (Repeat_tie_engraver,
+ /* doc */
+ "Create repeat ties.",
+
+ /* create */
+ "RepeatTie "
+ "RepeatTieColumn ",
+
+ /* read */
+ "",
+
+ /* write */
+ ""
+ );
{
Music *body = unsmob_music (me->get_property ("element"));
if (body)
- p = body->to_relative_octave (p);
+ p = body->to_relative_octave (p);
Pitch last = p;
SCM alternatives = me->get_property ("elements");
for (SCM s = alternatives; scm_is_pair (s); s = scm_cdr (s))
- {
- lily_1_8_compatibility_used = true;
- unsmob_music (scm_car (s))->to_relative_octave (p);
- }
+ {
+ lily_1_8_compatibility_used = true;
+ unsmob_music (scm_car (s))->to_relative_octave (p);
+ }
return last.smobbed_copy ();
}
m = m + unsmob_music (scm_car (p))->get_length ();
done++;
if (count - done < len)
- p = scm_cdr (p);
+ p = scm_cdr (p);
}
return m;
}
Music *body = unsmob_music (me->get_property ("element"));
Moment rv = (body) ? body->start_mom ()
- : Music_sequence::first_start (me->get_property ("elements"));
+ : Music_sequence::first_start (me->get_property ("elements"));
return rv.smobbed_copy ();
}
Rest_collision_engraver::process_acknowledged ()
{
vsize rest_count = 0;
- set<Grob*> columns;
+ set<Grob *> columns;
Moment now = now_mom ();
for (SCM s = get_property ("busyGrobs"); scm_is_pair (s); s = scm_cdr (s))
Grob *g = unsmob_grob (scm_cdar (s));
Moment *m = unsmob_moment (scm_caar (s));
if (!g || !m)
- continue;
+ continue;
if (Rhythmic_head::has_interface (g) && (*m) > now)
- {
- Grob *column = g->get_parent (X_AXIS);
- if (!column)
- {
- g->warning (_ ("rhythmic head is not part of a rhythmic column"));
- continue;
- }
-
- // Only include rests that start now. Include notes that started any time.
- Paper_column *paper_column = dynamic_cast<Item*> (column)->get_column ();
- if (!Rest::has_interface (g) || !paper_column || Paper_column::when_mom (paper_column) == now)
- {
- columns.insert (column);
- rest_count += Note_column::has_rests (column);
- }
- }
+ {
+ Grob *column = g->get_parent (X_AXIS);
+ if (!column)
+ {
+ g->warning (_ ("rhythmic head is not part of a rhythmic column"));
+ continue;
+ }
+
+ // Only include rests that start now. Include notes that started any time.
+ Paper_column *paper_column = dynamic_cast<Item *> (column)->get_column ();
+ if (!Rest::has_interface (g) || !paper_column || Paper_column::when_mom (paper_column) == now)
+ {
+ columns.insert (column);
+ rest_count += Note_column::has_rests (column);
+ }
+ }
}
if (!rest_collision_ && rest_count && columns.size () > 1)
{
rest_collision_ = make_item ("RestCollision", SCM_EOL);
- for (set<Grob*>::iterator i = columns.begin (); i != columns.end (); ++i)
- Rest_collision::add_column (rest_collision_, *i);
+ for (set<Grob *>::iterator i = columns.begin (); i != columns.end (); ++i)
+ Rest_collision::add_column (rest_collision_, *i);
}
}
#include "translator.icc"
ADD_TRANSLATOR (Rest_collision_engraver,
- /* doc */
- "Handle collisions of rests.",
+ /* doc */
+ "Handle collisions of rests.",
- /* create */
- "RestCollision ",
+ /* create */
+ "RestCollision ",
- /* read */
- "busyGrobs ",
+ /* read */
+ "busyGrobs ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "rest-collision.hh"
-#include <cmath> // ceil.
+#include <cmath> // ceil.
using namespace std;
#include "directional-element-interface.hh"
*/
if (scm_is_number (offset))
rest_grob->translate_axis (scm_to_double (offset), Y_AXIS);
-
+
if (Note_column::has_interface (parent) && Note_column::has_rests (parent))
{
Grob *collision = unsmob_grob (parent->get_object ("rest-collision"));
if (collision)
- (void) collision->get_property ("positioning-done");
+ (void) collision->get_property ("positioning-done");
}
return scm_from_double (0.0);
if (rest)
{
chain_offset_callback (rest,
- Rest_collision::force_shift_callback_rest_proc, Y_AXIS);
+ Rest_collision::force_shift_callback_rest_proc, Y_AXIS);
}
}
extract_grob_set (me, "elements", elts);
- vector<Grob*> rests;
- vector<Grob*> notes;
+ vector<Grob *> rests;
+ vector<Grob *> notes;
for (vsize i = 0; i < elts.size (); i++)
{
Grob *e = elts[i];
if (unsmob_grob (e->get_object ("rest")))
- rests.push_back (e);
+ rests.push_back (e);
else
- notes.push_back (e);
+ notes.push_back (e);
}
/*
{
/*
- This is incomplete: in case of an uneven number of rests, the
- center one should be centered on the staff.
+ This is incomplete: in case of an uneven number of rests, the
+ center one should be centered on the staff.
*/
- Drul_array<vector<Grob*> > ordered_rests;
+ Drul_array<vector<Grob *> > ordered_rests;
for (vsize i = 0; i < rests.size (); i++)
- {
- Grob *r = Note_column::get_rest (rests[i]);
+ {
+ Grob *r = Note_column::get_rest (rests[i]);
- Direction d = get_grob_direction (r);
- if (d)
- ordered_rests[d].push_back (r);
- else
- rests[d]->warning (_ ("cannot resolve rest collision: rest direction not set"));
- }
+ Direction d = get_grob_direction (r);
+ if (d)
+ ordered_rests[d].push_back (r);
+ else
+ rests[d]->warning (_ ("cannot resolve rest collision: rest direction not set"));
+ }
Direction d = LEFT;
do
- vector_sort (ordered_rests[d], rest_shift_less);
+ vector_sort (ordered_rests[d], rest_shift_less);
while (flip (&d) != LEFT)
- ;
+ ;
do
- {
- if (ordered_rests[d].size () < 1)
- {
- if (ordered_rests[-d].size () > 1)
- ordered_rests[-d][0]->warning (_ ("too many colliding rests"));
-
- return SCM_BOOL_T;
- }
- }
+ {
+ if (ordered_rests[d].size () < 1)
+ {
+ if (ordered_rests[-d].size () > 1)
+ ordered_rests[-d][0]->warning (_ ("too many colliding rests"));
+
+ return SCM_BOOL_T;
+ }
+ }
while (flip (&d) != LEFT);
Grob *common = common_refpoint_of_array (ordered_rests[DOWN], me, Y_AXIS);
common = common_refpoint_of_array (ordered_rests[UP], common, Y_AXIS);
Real diff
- = (ordered_rests[DOWN].back ()->extent (common, Y_AXIS)[UP]
- - ordered_rests[UP].back ()->extent (common, Y_AXIS)[DOWN]) / staff_space;
+ = (ordered_rests[DOWN].back ()->extent (common, Y_AXIS)[UP]
+ - ordered_rests[UP].back ()->extent (common, Y_AXIS)[DOWN]) / staff_space;
if (diff > 0)
- {
- int amount_down = (int) ceil (diff / 2);
- diff -= amount_down;
- Rest::translate (ordered_rests[DOWN].back (),
- -2 * amount_down);
- if (diff > 0)
- Rest::translate (ordered_rests[UP].back (),
- 2 * int (ceil (diff)));
- }
+ {
+ int amount_down = (int) ceil (diff / 2);
+ diff -= amount_down;
+ Rest::translate (ordered_rests[DOWN].back (),
+ -2 * amount_down);
+ if (diff > 0)
+ Rest::translate (ordered_rests[UP].back (),
+ 2 * int (ceil (diff)));
+ }
do
- {
- for (vsize i = ordered_rests[d].size () - 1; i-- > 0;)
- {
- Real last_y = ordered_rests[d][i + 1]->extent (common, Y_AXIS)[d];
- Real y = ordered_rests[d][i]->extent (common, Y_AXIS)[-d];
-
- Real diff = d * ((last_y - y) / staff_space);
- if (diff > 0)
- Rest::translate (ordered_rests[d][i], d * (int) ceil (diff) * 2);
- }
- }
+ {
+ for (vsize i = ordered_rests[d].size () - 1; i-- > 0;)
+ {
+ Real last_y = ordered_rests[d][i + 1]->extent (common, Y_AXIS)[d];
+ Real y = ordered_rests[d][i]->extent (common, Y_AXIS)[-d];
+
+ Real diff = d * ((last_y - y) / staff_space);
+ if (diff > 0)
+ Rest::translate (ordered_rests[d][i], d * (int) ceil (diff) * 2);
+ }
+ }
while (flip (&d) != LEFT);
}
else
{
/*
- Rests and notes.
+ Rests and notes.
*/
// Count how many rests we move
Drul_array<int> rcount (0, 0);
for (vsize i = 0; i < rests.size (); i++)
- {
- Grob *rcol = rests[i];
- Direction dir = Note_column::dir (rcol);
- if (!dir)
- continue;
-
- Grob *rest = Note_column::get_rest (rcol);
- // Do not compute a translation for pre-positioned rests,
- // nor count them for the "too many colliding rests" warning
- if (scm_is_number (rest->get_property ("staff-position")))
- continue;
-
- Grob *common = common_refpoint_of_array (notes, rcol, Y_AXIS);
- Interval restdim = rest->extent (common, Y_AXIS);
- if (restdim.is_empty ())
- continue;
-
- Real staff_space = Staff_symbol_referencer::staff_space (rcol);
- Real minimum_dist = robust_scm2double (me->get_property ("minimum-distance"), 1.0) * staff_space;
-
- Interval notedim;
- for (vsize i = 0; i < notes.size (); i++)
- {
- if (Note_column::dir (notes[i]) == -dir
- // If the note has already happened (but it has a long
- // duration, so there is a collision), don't look at the stem.
- // If we do, the rest gets shifted down a lot and it looks bad.
- || dynamic_cast<Item*> (notes[i])->get_column () != dynamic_cast<Item*> (rest)->get_column ())
- {
- /* try not to look at the stem, as looking at a beamed
- note may trigger beam positioning prematurely.
-
- This happens with dotted rests, which need Y
- positioning to compute X-positioning.
- */
- Grob *head = Note_column::first_head (notes[i]);
- if (head)
- notedim.unite (head->extent (common, Y_AXIS));
- else
- programming_error ("Note_column without first_head()");
- }
- else
- notedim.unite (notes[i]->extent (common, Y_AXIS));
- }
-
- Real y = dir * max (0.0,
- -dir * restdim[-dir] + dir * notedim[dir] + minimum_dist);
-
- int stafflines = Staff_symbol_referencer::line_count (me);
- if (!stafflines)
- {
- programming_error ("no staff line count");
- stafflines = 5;
- }
-
- // move discretely by half spaces.
- int discrete_y = dir * int (ceil (y / (0.5 * dir * staff_space)));
-
- // move by whole spaces inside the staff.
- if (fabs (Staff_symbol_referencer::get_position (rest)
- + discrete_y) < stafflines + 1)
- {
- discrete_y = dir * int (ceil (dir * discrete_y / 2.0) * 2.0);
- }
-
- Rest::translate (rest, discrete_y);
- if (rcount[dir]++)
- rest->warning (_ ("too many colliding rests"));
- }
+ {
+ Grob *rcol = rests[i];
+ Direction dir = Note_column::dir (rcol);
+ if (!dir)
+ continue;
+
+ Grob *rest = Note_column::get_rest (rcol);
+ // Do not compute a translation for pre-positioned rests,
+ // nor count them for the "too many colliding rests" warning
+ if (scm_is_number (rest->get_property ("staff-position")))
+ continue;
+
+ Grob *common = common_refpoint_of_array (notes, rcol, Y_AXIS);
+ Interval restdim = rest->extent (common, Y_AXIS);
+ if (restdim.is_empty ())
+ continue;
+
+ Real staff_space = Staff_symbol_referencer::staff_space (rcol);
+ Real minimum_dist = robust_scm2double (me->get_property ("minimum-distance"), 1.0) * staff_space;
+
+ Interval notedim;
+ for (vsize i = 0; i < notes.size (); i++)
+ {
+ if (Note_column::dir (notes[i]) == -dir
+ // If the note has already happened (but it has a long
+ // duration, so there is a collision), don't look at the stem.
+ // If we do, the rest gets shifted down a lot and it looks bad.
+ || dynamic_cast<Item *> (notes[i])->get_column () != dynamic_cast<Item *> (rest)->get_column ())
+ {
+ /* try not to look at the stem, as looking at a beamed
+ note may trigger beam positioning prematurely.
+
+ This happens with dotted rests, which need Y
+ positioning to compute X-positioning.
+ */
+ Grob *head = Note_column::first_head (notes[i]);
+ if (head)
+ notedim.unite (head->extent (common, Y_AXIS));
+ else
+ programming_error ("Note_column without first_head()");
+ }
+ else
+ notedim.unite (notes[i]->extent (common, Y_AXIS));
+ }
+
+ Real y = dir * max (0.0,
+ -dir * restdim[-dir] + dir * notedim[dir] + minimum_dist);
+
+ int stafflines = Staff_symbol_referencer::line_count (me);
+ if (!stafflines)
+ {
+ programming_error ("no staff line count");
+ stafflines = 5;
+ }
+
+ // move discretely by half spaces.
+ int discrete_y = dir * int (ceil (y / (0.5 * dir * staff_space)));
+
+ // move by whole spaces inside the staff.
+ if (fabs (Staff_symbol_referencer::get_position (rest)
+ + discrete_y) < stafflines + 1)
+ {
+ discrete_y = dir * int (ceil (dir * discrete_y / 2.0) * 2.0);
+ }
+
+ Rest::translate (rest, discrete_y);
+ if (rcount[dir]++)
+ rest->warning (_ ("too many colliding rests"));
+ }
}
return SCM_BOOL_T;
}
ADD_INTERFACE (Rest_collision,
- "Move ordinary rests (not multi-measure nor pitched rests)"
- " to avoid conflicts.",
-
- /* properties */
- "minimum-distance "
- "positioning-done "
- "elements "
- );
+ "Move ordinary rests (not multi-measure nor pitched rests)"
+ " to avoid conflicts.",
+
+ /* properties */
+ "minimum-distance "
+ "positioning-done "
+ "elements "
+ );
Pitch *p = unsmob_pitch (rest_event_->get_property ("pitch"));
if (p)
- {
- int pos = p->steps ();
- SCM c0 = get_property ("middleCPosition");
- if (scm_is_number (c0))
- pos += scm_to_int (c0);
-
- rest_->set_property ("staff-position", scm_from_int (pos));
- }
+ {
+ int pos = p->steps ();
+ SCM c0 = get_property ("middleCPosition");
+ if (scm_is_number (c0))
+ pos += scm_to_int (c0);
+
+ rest_->set_property ("staff-position", scm_from_int (pos));
+ }
}
}
}
ADD_TRANSLATOR (Rest_engraver,
- /* doc */
- "Engrave rests.",
+ /* doc */
+ "Engrave rests.",
- /* create */
- "Rest ",
+ /* create */
+ "Rest ",
- /* read */
- "middleCPosition ",
+ /* read */
+ "middleCPosition ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
bool position_override = scm_is_number (me->get_property ("staff-position"));
Real amount = robust_scm2double (me->get_property ("staff-position"), 0)
- * 0.5 * ss;
-
+ * 0.5 * ss;
+
if (line_count % 2)
{
if (duration_log == 0 && line_count > 1)
- amount += ss;
+ amount += ss;
}
else
amount += ss / 2;
if (!position_override)
- amount += 2 * ss * get_grob_direction (me);;
-
+ amount += 2 * ss * get_grob_direction (me);;
+
return scm_from_double (amount);
}
Real pos = Staff_symbol_referencer::get_position (me);
/*
- Figure out when the rest is far enough outside the staff. This
- could bemore generic, but hey, we understand this even after
- dinner.
+ Figure out when the rest is far enough outside the staff. This
+ could bemore generic, but hey, we understand this even after
+ dinner.
*/
is_ledgered |= (balltype == -1) && (pos <= -rad - 3 || pos >= +rad + 1);
is_ledgered |= (balltype == 0) && (pos >= +rad + 2 || pos < -rad);
{
/*
- FIXME: Currently, ancient font does not provide ledgered rests;
- hence the "o" suffix in the glyph name is bogus. But do we need
- ledgered rests at all now that we can draw ledger lines with
- variable width, length and blotdiameter? -- jr
+ FIXME: Currently, ancient font does not provide ledgered rests;
+ hence the "o" suffix in the glyph name is bogus. But do we need
+ ledgered rests at all now that we can draw ledger lines with
+ variable width, length and blotdiameter? -- jr
*/
is_ledgered = 0;
/*
- There are no 32th/64th/128th mensural/neomensural rests. In
- these cases, revert back to default style.
+ There are no 32th/64th/128th mensural/neomensural rests. In
+ these cases, revert back to default style.
*/
if (balltype > 4)
- actual_style = "";
+ actual_style = "";
}
if ((style == "classical") && (balltype != 2))
{
/*
- classical style: revert back to default style for any rest other
- than quarter rest
+ classical style: revert back to default style for any rest other
+ than quarter rest
*/
actual_style = "";
}
if (style == "default")
{
/*
- Some parts of lily still prefer style "default" over "".
- Correct this here. -- jr
+ Some parts of lily still prefer style "default" over "".
+ Correct this here. -- jr
*/
actual_style = "";
}
return ("rests." + to_string (balltype) + (is_ledgered ? "o" : "")
- + actual_style);
+ + actual_style);
}
MAKE_SCHEME_CALLBACK (Rest, print, 1);
MAKE_SCHEME_CALLBACK (Rest, pure_height, 3);
SCM
Rest::pure_height (SCM smob,
- SCM /* start */,
- SCM /* end */)
+ SCM /* start */,
+ SCM /* end */)
{
Grob *me = unsmob_grob (smob);
SCM m = brew_internal_stencil (me, false);
}
ADD_INTERFACE (Rest,
- "A rest symbol. The property @code{style} can be"
- " @code{default}, @code{mensural}, @code{neomensural} or"
- " @code{classical}.",
-
- /* properties */
- "direction "
- "minimum-distance "
- "style "
- );
+ "A rest symbol. The property @code{style} can be"
+ " @code{default}, @code{mensural}, @code{neomensural} or"
+ " @code{classical}.",
+
+ /* properties */
+ "direction "
+ "minimum-distance "
+ "style "
+ );
class Rhythmic_column_engraver : public Engraver
{
- vector<Grob*> rheads_;
+ vector<Grob *> rheads_;
Grob *stem_;
Grob *note_column_;
Grob *dotcol_;
arpeggio_ = 0;
}
-
void
Rhythmic_column_engraver::process_acknowledged ()
{
if (rheads_.size ())
{
if (!note_column_)
- note_column_ = make_item ("NoteColumn", rheads_[0]->self_scm ());
+ note_column_ = make_item ("NoteColumn", rheads_[0]->self_scm ());
for (vsize i = 0; i < rheads_.size (); i++)
- if (!rheads_[i]->get_parent (X_AXIS))
- Note_column::add_head (note_column_, rheads_[i]);
+ if (!rheads_[i]->get_parent (X_AXIS))
+ Note_column::add_head (note_column_, rheads_[i]);
rheads_.resize (0);
}
if (note_column_)
{
if (stem_
- && !stem_->get_parent (X_AXIS))
- {
- Note_column::set_stem (note_column_, stem_);
- stem_ = 0;
- }
+ && !stem_->get_parent (X_AXIS))
+ {
+ Note_column::set_stem (note_column_, stem_);
+ stem_ = 0;
+ }
if (arpeggio_)
- note_column_->set_object ("arpeggio", arpeggio_->self_scm ());
+ note_column_->set_object ("arpeggio", arpeggio_->self_scm ());
}
}
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, arpeggio);
ADD_TRANSLATOR (Rhythmic_column_engraver,
- /* doc */
- "Generate @code{NoteColumn}, an object that groups stems,"
- " note heads, and rests.",
+ /* doc */
+ "Generate @code{NoteColumn}, an object that groups stems,"
+ " note heads, and rests.",
- /* create */
- "NoteColumn ",
+ /* create */
+ "NoteColumn ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Rhythmic_head::dot_count (Grob *me)
{
return get_dots (me)
- ? robust_scm2int (get_dots (me)->get_property ("dot-count"), 0) : 0;
+ ? robust_scm2int (get_dots (me)->get_property ("dot-count"), 0) : 0;
}
void
}
ADD_INTERFACE (Rhythmic_head,
- "Note head or rest.",
+ "Note head or rest.",
- /* properties */
- "dot "
- "duration-log "
- "stem "
- );
+ /* properties */
+ "dot "
+ "duration-log "
+ "stem "
+ );
if (item_drul_[LEFT] != item_drul_[RIGHT]
&& item_drul_[LEFT] && item_drul_[RIGHT])
Spaceable_grob::add_rod (item_drul_[LEFT],
- item_drul_[RIGHT],
- distance_);
+ item_drul_[RIGHT],
+ distance_);
}
/*
todo: put string <-> pitch here too.
-
*/
LY_DEFINE (ly_make_scale, "ly:make-scale",
- 1, 0, 0, (SCM steps),
- "Create a scale."
- " The argument is a vector of rational numbers, each of which"
- " represents the number of 200 cent tones of a pitch above the"
- " tonic.")
+ 1, 0, 0, (SCM steps),
+ "Create a scale."
+ " The argument is a vector of rational numbers, each of which"
+ " represents the number of 200 cent tones of a pitch above the"
+ " tonic.")
{
bool type_ok = scm_is_vector (steps);
- vector<Rational> tones;
+ vector<Rational> tones;
if (type_ok)
{
int len = scm_c_vector_length (steps);
- for (int i = 0 ; i < len; i++)
- {
- SCM step = scm_c_vector_ref (steps, i);
- type_ok = type_ok && scm_is_rational (step);
- if (type_ok)
- {
- Rational from_c (scm_to_int (scm_numerator (step)),
- scm_to_int (scm_denominator (step)));
- tones.push_back (from_c);
- }
- }
+ for (int i = 0; i < len; i++)
+ {
+ SCM step = scm_c_vector_ref (steps, i);
+ type_ok = type_ok && scm_is_rational (step);
+ if (type_ok)
+ {
+ Rational from_c (scm_to_int (scm_numerator (step)),
+ scm_to_int (scm_denominator (step)));
+ tones.push_back (from_c);
+ }
+ }
}
-
-
+
SCM_ASSERT_TYPE (type_ok, steps, SCM_ARG1, __FUNCTION__, "vector of rational");
Scale *s = new Scale (tones);
- SCM retval = s->self_scm ();
+ SCM retval = s->self_scm ();
s->unprotect ();
-
+
return retval;
}
LY_DEFINE (ly_default_scale, "ly:default-scale",
- 0, 0, 0, (),
- "Get the global default scale.")
+ 0, 0, 0, (),
+ "Get the global default scale.")
{
return default_global_scale
- ? default_global_scale->self_scm ()
- : SCM_BOOL_F;
+ ? default_global_scale->self_scm ()
+ : SCM_BOOL_F;
}
-
-Scale * default_global_scale = 0;
+Scale *default_global_scale = 0;
LY_DEFINE (ly_set_default_scale, "ly:set-default-scale",
- 1, 0, 0, (SCM scale),
- "Set the global default scale. This determines the tuning of"
- " pitches with no accidentals or key signatures. The first"
- " pitch is C. Alterations are calculated relative to this"
- " scale. The number of pitches in this scale determines the"
- " number of scale steps that make up an octave. Usually the"
- " 7-note major scale.")
+ 1, 0, 0, (SCM scale),
+ "Set the global default scale. This determines the tuning of"
+ " pitches with no accidentals or key signatures. The first"
+ " pitch is C. Alterations are calculated relative to this"
+ " scale. The number of pitches in this scale determines the"
+ " number of scale steps that make up an octave. Usually the"
+ " 7-note major scale.")
{
LY_ASSERT_SMOB (Scale, scale, 1);
default_global_scale->unprotect ();
default_global_scale = s;
s->protect ();
-
+
return SCM_UNSPECIFIED;
}
octave += (step - normalized_step) / step_count ();
// There are 6 tones in an octave.
- return step_tones_[normalized_step] + Rational (octave*6);
+ return step_tones_[normalized_step] + Rational (octave * 6);
}
Rational
// scale (6 is the number of tones of the octave above the
// first note).
if (normalized_step + 1 == step_count ())
- return Rational(6) - step_tones_[normalized_step];
+ return Rational (6) - step_tones_[normalized_step];
return step_tones_[normalized_step + 1] - step_tones_[normalized_step];
}
int
Scale::print_smob (SCM /* x */,
- SCM port,
- scm_print_state *)
+ SCM port,
+ scm_print_state *)
{
- scm_puts ("#<Scale>", port);
+ scm_puts ("#<Scale>", port);
return 1;
}
smobify_self ();
}
-
Scale::~Scale ()
{
}
-/*
+/*
scheme-engraver.cc -- implement Scheme_engraver
-
+
source file of the GNU LilyPond music typesetter
-
+
Copyright (c) 2009--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
LilyPond is free software: you can redistribute it and/or modify
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+ along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
#include "scheme-engraver.hh"
Scheme_engraver::init_from_scheme (SCM definition)
{
start_translation_timestep_function_ = callable (ly_symbol2scm ("start-translation-timestep"),
- definition);
+ definition);
stop_translation_timestep_function_ = callable (ly_symbol2scm ("stop-translation-timestep"),
- definition);
+ definition);
process_music_function_ = callable (ly_symbol2scm ("process-music"), definition);
process_acknowledged_function_ = callable (ly_symbol2scm ("process-acknowledged"),
- definition);
+ definition);
initialize_function_ = callable (ly_symbol2scm ("initialize"), definition);
finalize_function_ = callable (ly_symbol2scm ("finalize"), definition);
listeners_alist_ = SCM_EOL;
must_be_last_ = to_boolean (ly_assoc_get (ly_symbol2scm ("must-be-last"),
- definition,
- SCM_BOOL_F));
-
+ definition,
+ SCM_BOOL_F));
+
translator_listener_record **tail = &per_instance_listeners_;
for (SCM p = listeners; scm_is_pair (p); p = scm_cdr (p))
{
SCM proc = scm_cdar (p);
if (!(ly_is_procedure (proc) && ly_is_symbol (event_class)))
- continue;
+ continue;
// We should check the arity of the function?
-
+
// Record for later lookup.
listeners_alist_ = scm_acons (event_class, proc, listeners_alist_);
tail = &rec->next_;
}
- init_acknowledgers (ly_assoc_get(ly_symbol2scm ("acknowledgers"),
- definition, SCM_EOL),
- &interface_acknowledger_hash_);
-
- init_acknowledgers (ly_assoc_get(ly_symbol2scm ("end-acknowledgers"),
- definition, SCM_EOL),
- &interface_end_acknowledger_hash_);
+ init_acknowledgers (ly_assoc_get (ly_symbol2scm ("acknowledgers"),
+ definition, SCM_EOL),
+ &interface_acknowledger_hash_);
+
+ init_acknowledgers (ly_assoc_get (ly_symbol2scm ("end-acknowledgers"),
+ definition, SCM_EOL),
+ &interface_end_acknowledger_hash_);
// TODO: hook up description, props read/written, grobs created
// etc. to provide automatic documentation.
void
Scheme_engraver::init_acknowledgers (SCM alist,
- SCM *hash)
-{
- *hash = scm_c_make_hash_table(7);
+ SCM *hash)
+{
+ *hash = scm_c_make_hash_table (7);
for (SCM p = alist; scm_is_pair (p); p = scm_cdr (p))
{
SCM iface = scm_caar (p);
SCM proc = scm_cdar (p);
if (!(ly_is_procedure (proc) && ly_is_symbol (iface)))
- continue;
+ continue;
scm_hashq_set_x (*hash, iface, proc);
}
// This is the easy way to do it, at the cost of too many invocations
// of Scheme_engraver::acknowledge_grob. The clever dispatching of
// acknowledgers is hardwired to have 1 method per engraver per
-// grob-type, which doesn't work for this case.
+// grob-type, which doesn't work for this case.
void
Scheme_engraver::acknowledge_grob (Grob_info info)
{
void
Scheme_engraver::acknowledge_grob_by_hash (Grob_info info,
- SCM iface_function_hash)
+ SCM iface_function_hash)
{
SCM meta = info.grob ()->internal_get_property (ly_symbol2scm ("meta"));
SCM ifaces = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta));
for (SCM s = ifaces; scm_is_pair (s); s = scm_cdr (s))
{
SCM func = scm_hashq_ref (iface_function_hash,
- scm_car (s), SCM_BOOL_F);
+ scm_car (s), SCM_BOOL_F);
if (ly_is_procedure (func))
- scm_call_3 (func, self_scm (), info.grob ()->self_scm (),
- info.origin_translator ()->self_scm ());
+ scm_call_3 (func, self_scm (), info.grob ()->self_scm (),
+ info.origin_translator ()->self_scm ());
}
}
scm_gc_mark ((SCM)target);
}
-Listener_function_table listen_closure = {
+Listener_function_table listen_closure =
+{
call_listen_closure, mark_listen_closure
};
Listener
Scheme_engraver::get_listener (void *arg, SCM name)
{
- Scheme_engraver *me = (Scheme_engraver*) arg;
+ Scheme_engraver *me = (Scheme_engraver *) arg;
SCM func = ly_assoc_get (name, me->listeners_alist_, SCM_BOOL_F);
assert (ly_is_procedure (func));
- SCM closure = scm_cons (func, me->self_scm());
- return Listener((void*)closure, &listen_closure);
+ SCM closure = scm_cons (func, me->self_scm ());
+ return Listener ((void *)closure, &listen_closure);
}
translator_listener_record *
-Scheme_engraver::get_listener_list () const
-{
+Scheme_engraver::get_listener_list () const
+{
return per_instance_listeners_;
}
-#define DISPATCH(what) \
- void \
- Scheme_engraver::what () \
- { \
- if (what ## _function_ != SCM_BOOL_F) \
- scm_call_1 (what ## _function_, self_scm ()); \
+#define DISPATCH(what) \
+ void \
+ Scheme_engraver::what () \
+ { \
+ if (what ## _function_ != SCM_BOOL_F) \
+ scm_call_1 (what ## _function_, self_scm ()); \
}
-DISPATCH(start_translation_timestep);
-DISPATCH(stop_translation_timestep);
-DISPATCH(initialize);
-DISPATCH(finalize);
-DISPATCH(process_music);
-DISPATCH(process_acknowledged);
+DISPATCH (start_translation_timestep);
+DISPATCH (stop_translation_timestep);
+DISPATCH (initialize);
+DISPATCH (finalize);
+DISPATCH (process_music);
+DISPATCH (process_acknowledged);
void
Scheme_engraver::derived_mark () const
scm_gc_mark (finalize_function_);
scm_gc_mark (process_music_function_);
scm_gc_mark (process_acknowledged_function_);
- scm_gc_mark (listeners_alist_);
- scm_gc_mark (interface_acknowledger_hash_);
- scm_gc_mark (interface_end_acknowledger_hash_);
-}
+ scm_gc_mark (listeners_alist_);
+ scm_gc_mark (interface_acknowledger_hash_);
+ scm_gc_mark (interface_end_acknowledger_hash_);
+}
ADD_ACKNOWLEDGER (Scheme_engraver, grob);
ADD_END_ACKNOWLEDGER (Scheme_engraver, grob);
ADD_TRANSLATOR (Scheme_engraver,
- /* doc */
- "Implement engravers in Scheme. Interprets arguments to"
- " @code{\\consists} as callbacks.",
+ /* doc */
+ "Implement engravers in Scheme. Interprets arguments to"
+ " @code{\\consists} as callbacks.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "scheme-listener.hh"
LY_DEFINE (ly_make_listener, "ly:make-listener",
- 1, 0, 0, (SCM callback),
- "Create a listener. Any time the listener hears an object,"
- " it will call @var{callback} with that object.\n"
- "\n"
- "@var{callback} should take exactly one argument.")
+ 1, 0, 0, (SCM callback),
+ "Create a listener. Any time the listener hears an object,"
+ " it will call @var{callback} with that object.\n"
+ "\n"
+ "@var{callback} should take exactly one argument.")
{
LY_ASSERT_TYPE (ly_is_procedure, callback, 1);
Scheme_listener *l = new Scheme_listener (callback);
callback_ = SCM_EOL;
self_scm_ = SCM_EOL;
smobify_self ();
- callback_ = c;
+ callback_ = c;
}
SCM
}
int
-Scheme_listener::print_smob (SCM obj, SCM p, scm_print_state*)
+Scheme_listener::print_smob (SCM obj, SCM p, scm_print_state *)
{
Scheme_listener *me = (Scheme_listener *) SCM_CELL_WORD_1 (obj);
scm_puts ("#<Scheme_listener ", p);
copy_scm_hashes (SCM dest, SCM src)
{
scm_internal_hash_for_each_handle ((scm_t_hash_handle_fn) ©_handle,
- dest, src);
+ dest, src);
}
Scheme_hash_table::Scheme_hash_table ()
if (&src == this)
return;
- hash_tab_ = scm_c_make_hash_table (SCM_HASHTABLE_N_ITEMS(src.hash_tab_));
+ hash_tab_ = scm_c_make_hash_table (SCM_HASHTABLE_N_ITEMS (src.hash_tab_));
copy_scm_hashes (hash_tab_, src.hash_tab_);
}
}
int
-Scheme_hash_table::print_smob (SCM s, SCM p, scm_print_state*)
+Scheme_hash_table::print_smob (SCM s, SCM p, scm_print_state *)
{
assert (unsmob (s));
scm_puts ("#<Scheme_hash_table ", p);
}
bool
-Scheme_hash_table::try_retrieve (SCM k, SCM *v){
+Scheme_hash_table::try_retrieve (SCM k, SCM *v)
+{
SCM handle = scm_hashq_get_handle (hash_tab_, k);
if (scm_is_pair (handle))
static SCM
collect_handles (void * /* closure */,
- SCM key,
- SCM value,
- SCM result)
+ SCM key,
+ SCM value,
+ SCM result)
{
- return scm_acons(key, value, result);
+ return scm_acons (key, value, result);
}
SCM
Scheme_hash_table::to_alist () const
{
return scm_internal_hash_fold ((scm_t_hash_fold_fn) &collect_handles,
- NULL, SCM_EOL, hash_tab_);
+ NULL, SCM_EOL, hash_tab_);
}
IMPLEMENT_SMOBS (Scheme_hash_table);
Score_engraver::finish (SCM)
{
recurse_over_translators (context (), &Translator::finalize,
- &Translator_group::finalize,
- UP);
+ &Translator_group::finalize,
+ UP);
}
#define MUSIC_FONT "emmentaler-20"
if (!fm)
{
error (_f ("cannot find `%s'", MUSIC_FONT ".otf")
- + "\n"
- + _ ("Music font has not been installed properly.")
- + "\n"
- + _f ("Search path `%s'", global_path.to_string ().c_str ())
- + "\n"
- + _ ("Aborting"));
+ + "\n"
+ + _ ("Music font has not been installed properly.")
+ + "\n"
+ + _f ("Search path `%s'", global_path.to_string ().c_str ())
+ + "\n"
+ + _ ("Aborting"));
}
pscore_ = new Paper_score (dynamic_cast<Output_def *> (context ()->get_output_def ()));
SCM props = updated_grob_properties (context (), ly_symbol2scm ("System"));
pscore_->typeset_system (new System (props));
-
+
system_ = pscore_->root_system ();
context ()->set_property ("rootSystem", system_->self_scm ());
Score_engraver::connect_to_context (Context *c)
{
Engraver_group::connect_to_context (c);
-
+
Dispatcher *d = c->get_global_context ()->event_source ();
d->add_listener (GET_LISTENER (one_time_step), ly_symbol2scm ("OneTimeStep"));
d->add_listener (GET_LISTENER (prepare), ly_symbol2scm ("Prepare"));
/*
uncovered:
-
- check_removal always returns false for Score contexts, it has been that way
-since I joined the project. There is a reason for this: The typeset score is
-stored in the Score_engraver, which in turn is accessed through the
-Global_context returned by ly:run-translator. So the score-translator must be
+
+ check_removal always returns false for Score contexts, it has been that way
+since I joined the project. There is a reason for this: The typeset score is
+stored in the Score_engraver, which in turn is accessed through the
+Global_context returned by ly:run-translator. So the score-translator must be
connected to the score-context after run-translator finishes.
-I plan to change this: we should junk run-translator, and instead keep track
-of both context and translator in the SCM code, and access the typeset score
-directly via the created global-translator. Then it would be possible to
+I plan to change this: we should junk run-translator, and instead keep track
+of both context and translator in the SCM code, and access the typeset score
+directly via the created global-translator. Then it would be possible to
disconnect score-translators at iteration time. -es
*/
void
Grob *elem = elems_[i];
if (!elem->get_parent (Y_AXIS))
- Axis_group_interface::add_element (system_, elem);
+ Axis_group_interface::add_element (system_, elem);
}
elems_.clear ();
}
ADD_TRANSLATOR_GROUP (Score_engraver,
- /* doc */
- "The top-level engraver. Takes care of generating"
- " columns and the complete system (i.e.,"
- " @code{System}).\n"
- "\n"
- "This engraver decides whether a column is breakable."
- " The default is that a column is always breakable."
- " However, every @code{Bar_engraver} that does not have"
- " a bar line at a certain point sets @code{forbidBreaks}"
- " to stop line breaks. In practice, this means that you"
- " can make a break point by creating a bar line"
- " (assuming that there are no beams or notes that"
- " prevent a break point).",
-
- /* create */
- "System ",
-
- /* read */
- "currentMusicalColumn "
- "currentCommandColumn ",
-
- /* write */
- ""
- );
+ /* doc */
+ "The top-level engraver. Takes care of generating"
+ " columns and the complete system (i.e.,"
+ " @code{System}).\n"
+ "\n"
+ "This engraver decides whether a column is breakable."
+ " The default is that a column is always breakable."
+ " However, every @code{Bar_engraver} that does not have"
+ " a bar line at a certain point sets @code{forbidBreaks}"
+ " to stop line breaks. In practice, this means that you"
+ " can make a break point by creating a bar line"
+ " (assuming that there are no beams or notes that"
+ " prevent a break point).",
+
+ /* create */
+ "System ",
+
+ /* read */
+ "currentMusicalColumn "
+ "currentCommandColumn ",
+
+ /* write */
+ ""
+ );
#include "audio-item.hh"
ADD_TRANSLATOR_GROUP (Score_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Score_performer::Score_performer ()
{
Score_performer::announce_element (Audio_element_info info)
{
announce_infos_.push_back (info);
- if (Audio_staff *s = dynamic_cast<Audio_staff*> (info.elem_))
+ if (Audio_staff *s = dynamic_cast<Audio_staff *> (info.elem_))
{
performance_->audio_staffs_.push_back (s);
}
for (vsize i = 0; i < announce_infos_.size (); i++)
{
if (Audio_item *ai = dynamic_cast<Audio_item *> (announce_infos_[i].elem_))
- audio_column_->add_audio_item (ai);
+ audio_column_->add_audio_item (ai);
}
Performer_group::acknowledge_audio_elements ();
}
-
void
Score_performer::connect_to_context (Context *c)
{
Performer_group::connect_to_context (c);
-
+
Dispatcher *d = c->get_global_context ()->event_source ();
d->add_listener (GET_LISTENER (one_time_step), ly_symbol2scm ("OneTimeStep"));
d->add_listener (GET_LISTENER (prepare), ly_symbol2scm ("Prepare"));
bool use_ports = channel_mapping == ly_symbol2scm ("voice");
performance_->ports_ = use_ports;
recurse_over_translators (context (),
- &Translator::finalize,
- &Translator_group::finalize,
- UP);
+ &Translator::finalize,
+ &Translator_group::finalize,
+ UP);
}
IMPLEMENT_LISTENER (Score_performer, one_time_step);
{
if (!skipping_)
{
- skip_start_mom_ = audio_column_->when ();
- skipping_ = true;
+ skip_start_mom_ = audio_column_->when ();
+ skipping_ = true;
}
}
else
{
if (skipping_)
{
- offset_mom_ -= audio_column_->when () - skip_start_mom_;
- skipping_ = false;
- }
+ offset_mom_ -= audio_column_->when () - skip_start_mom_;
+ skipping_ = false;
+ }
audio_column_->offset_when (offset_mom_);
precomputed_recurse_over_translators (context (), PROCESS_MUSIC, UP);
{
performance_ = new Performance;
performance_->unprotect ();
- context ()->set_property ("output", performance_->self_scm ());
+ context ()->set_property ("output", performance_->self_scm ());
performance_->midi_ = context ()->get_output_def ();
-
Translator_group::initialize ();
}
-
#include "paper-book.hh"
LY_DEFINE (ly_make_score, "ly:make-score",
- 1, 0, 0,
- (SCM music),
- "Return score with @var{music} encapsulated in it.")
+ 1, 0, 0,
+ (SCM music),
+ "Return score with @var{music} encapsulated in it.")
{
LY_ASSERT_SMOB (Music, music, 1);
}
LY_DEFINE (ly_score_output_defs, "ly:score-output-defs",
- 1, 0, 0, (SCM score),
- "All output definitions in a score.")
+ 1, 0, 0, (SCM score),
+ "All output definitions in a score.")
{
LY_ASSERT_SMOB (Score, score, 1);
Score *sc = unsmob_score (score);
}
LY_DEFINE (ly_score_add_output_def_x, "ly:score-add-output-def!",
- 2, 0, 0, (SCM score, SCM def),
- "Add an output definition @var{def} to @var{score}.")
+ 2, 0, 0, (SCM score, SCM def),
+ "Add an output definition @var{def} to @var{score}.")
{
LY_ASSERT_SMOB (Score, score, 1);
LY_ASSERT_SMOB (Output_def, def, 2);
}
LY_DEFINE (ly_score_header, "ly:score-header",
- 1, 0, 0, (SCM score),
- "Return score header.")
+ 1, 0, 0, (SCM score),
+ "Return score header.")
{
LY_ASSERT_SMOB (Score, score, 1);
Score *sc = unsmob_score (score);
}
LY_DEFINE (ly_score_set_header_x, "ly:score-set-header!",
- 2, 0, 0, (SCM score, SCM module),
- "Set the score header.")
+ 2, 0, 0, (SCM score, SCM module),
+ "Set the score header.")
{
LY_ASSERT_SMOB (Score, score, 1);
SCM_ASSERT_TYPE (ly_is_module (module), module, SCM_ARG2, __FUNCTION__,
- "module");
+ "module");
Score *sc = unsmob_score (score);
sc->set_header (module);
}
LY_DEFINE (ly_score_music, "ly:score-music",
- 1, 0, 0, (SCM score),
- "Return score music.")
+ 1, 0, 0, (SCM score),
+ "Return score music.")
{
LY_ASSERT_SMOB (Score, score, 1);
Score *sc = unsmob_score (score);
}
LY_DEFINE (ly_score_error_p, "ly:score-error?",
- 1, 0, 0, (SCM score),
- "Was there an error in the score?")
+ 1, 0, 0, (SCM score),
+ "Was there an error in the score?")
{
LY_ASSERT_SMOB (Score, score, 1);
Score *sc = unsmob_score (score);
}
LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
- 2, 0, 0, (SCM score, SCM layout),
- "Run @var{score} through @var{layout} (an output definition)"
- " scaled to correct output-scale already, returning a list of"
- " layout-lines.")
+ 2, 0, 0, (SCM score, SCM layout),
+ "Run @var{score} through @var{layout} (an output definition)"
+ " scaled to correct output-scale already, returning a list of"
+ " layout-lines.")
{
LY_ASSERT_SMOB (Score, score, 1);
LY_ASSERT_SMOB (Output_def, layout, 2);
return unsmob_input (input_location_);
}
-
Score::Score ()
{
header_ = SCM_EOL;
}
int
-Score::print_smob (SCM, SCM p, scm_print_state*)
+Score::print_smob (SCM, SCM p, scm_print_state *)
{
scm_puts ("#<Score>", p);
ly_module_copy (header_, s.header_);
}
-
/*
Format score, return list of Music_output objects.
*/
SCM
Score::book_rendering (Output_def *layoutbook,
- Output_def *default_def)
+ Output_def *default_def)
{
if (error_found_)
return SCM_EOL;
SCM scaled = SCM_EOL;
if (def->c_variable ("is-layout") == SCM_BOOL_T)
- {
- def = scale_output_def (def, scale);
- def->parent_ = layoutbook;
+ {
+ def = scale_output_def (def, scale);
+ def->parent_ = layoutbook;
- scaled = def->unprotect ();
- }
+ scaled = def->unprotect ();
+ }
/* TODO: fix or junk --no-layout. */
SCM context = ly_run_translator (music_, def->self_scm ());
if (dynamic_cast<Global_context *> (unsmob_context (context)))
- {
- SCM s = ly_format_output (context);
+ {
+ SCM s = ly_format_output (context);
- *tail = scm_cons (s, SCM_EOL);
- tail = SCM_CDRLOC (*tail);
- }
+ *tail = scm_cons (s, SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ }
scm_remember_upto_here_1 (scaled);
}
m->origin ()->error (_ ("errors found, ignoring music expression"));
this->error_found_ = this->error_found_
- || to_boolean (m->get_property ("error-found"));
+ || to_boolean (m->get_property ("error-found"));
}
if (this->error_found_)
class Script_column_engraver : public Engraver
{
Grob *script_column_;
- vector<Grob*> scripts_;
+ vector<Grob *> scripts_;
public:
TRANSLATOR_DECLARATIONS (Script_column_engraver);
if (script_column_)
{
for (vsize i = 0; i < scripts_.size (); i++)
- if (Side_position_interface::get_axis (scripts_[i]) == Y_AXIS)
- Script_column::add_side_positioned (script_column_, scripts_[i]);
+ if (Side_position_interface::get_axis (scripts_[i]) == Y_AXIS)
+ Script_column::add_side_positioned (script_column_, scripts_[i]);
}
script_column_ = 0;
if (thing)
{
if (!Item::is_non_musical (thing))
- scripts_.push_back (thing);
+ scripts_.push_back (thing);
}
}
ADD_ACKNOWLEDGER (Script_column_engraver, side_position);
ADD_TRANSLATOR (Script_column_engraver,
- /* doc */
- "Find potentially colliding scripts and put them into a"
- " @code{ScriptColumn} object; that will fix the collisions.",
+ /* doc */
+ "Find potentially colliding scripts and put them into a"
+ " @code{ScriptColumn} object; that will fix the collisions.",
- /* create */
- "ScriptColumn ",
+ /* create */
+ "ScriptColumn ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include <map>
-typedef map<Grob*, vector <Grob*> > Grob_scripts_map;
+typedef map<Grob *, vector <Grob *> > Grob_scripts_map;
void
Script_column::add_side_positioned (Grob *me, Grob *script)
}
LY_DEFINE (ly_grob_script_priority_less, "ly:grob-script-priority-less",
- 2, 0, 0, (SCM a, SCM b),
- "Compare two grobs by script priority. For internal use.")
+ 2, 0, 0, (SCM a, SCM b),
+ "Compare two grobs by script priority. For internal use.")
{
Grob *i1 = unsmob_grob (a);
Grob *i2 = unsmob_grob (b);
Script_column::row_before_line_breaking (SCM smob)
{
Grob *me = unsmob_grob (smob);
- vector<Grob*> horizontal_grobs;
+ vector<Grob *> horizontal_grobs;
extract_grob_set (me, "scripts", scripts);
Grob_scripts_map head_scripts_map;
Grob *sc = scripts[i];
/*
- Don't want to consider scripts horizontally next to notes.
+ Don't want to consider scripts horizontally next to notes.
*/
if (Accidental_placement::has_interface (sc)
- || Arpeggio::has_interface (sc))
- {
- affect_all_grobs.push_back (sc);
- }
- else if (sc->get_property_data ("Y-offset") !=
- Side_position_interface::y_aligned_side_proc)
- {
- head_scripts_map[sc->get_parent (Y_AXIS)].push_back (sc);
- }
+ || Arpeggio::has_interface (sc))
+ {
+ affect_all_grobs.push_back (sc);
+ }
+ else if (sc->get_property_data ("Y-offset")
+ != Side_position_interface::y_aligned_side_proc)
+ {
+ head_scripts_map[sc->get_parent (Y_AXIS)].push_back (sc);
+ }
}
for (Grob_scripts_map::const_iterator i (head_scripts_map.begin ());
i != head_scripts_map.end ();
i++)
{
- vector<Grob*> grobs = (*i).second;
+ vector<Grob *> grobs = (*i).second;
// this isn't right in all cases, but in general a safe assumption.
concat (grobs, affect_all_grobs);
return SCM_UNSPECIFIED;
}
-
MAKE_SCHEME_CALLBACK (Script_column, before_line_breaking, 1);
SCM
Script_column::before_line_breaking (SCM smob)
{
Grob *me = unsmob_grob (smob);
- vector<Grob*> staff_sided;
+ vector<Grob *> staff_sided;
extract_grob_set (me, "scripts", scripts);
for (vsize i = 0; i < scripts.size (); i++)
{
Grob *sc = scripts[i];
/*
- Don't want to consider scripts horizontally next to notes.
+ Don't want to consider scripts horizontally next to notes.
*/
- if (sc->get_property_data ("X-offset") !=
- Side_position_interface::x_aligned_side_proc)
- staff_sided.push_back (sc);
+ if (sc->get_property_data ("X-offset")
+ != Side_position_interface::x_aligned_side_proc)
+ staff_sided.push_back (sc);
}
order_grobs (staff_sided);
}
void
-Script_column::order_grobs (vector<Grob*> grobs)
+Script_column::order_grobs (vector<Grob *> grobs)
{
Drul_array<SCM> scripts_drul (SCM_EOL, SCM_EOL);
for (vsize i = 0; i < grobs.size (); i++)
// loop over all grobs in script column (already sorted by script_priority)
for (SCM s = ss; scm_is_pair (s);
s = scm_cdr (s), last = g, last_initial_outside_staff = initial_outside_staff)
- {
- g = unsmob_grob (scm_car (s));
+ {
+ g = unsmob_grob (scm_car (s));
initial_outside_staff = g->get_property ("outside-staff-priority");
if (last) //not the first grob in the list
{
- SCM last_outside_staff = last->get_property ("outside-staff-priority");
+ SCM last_outside_staff = last->get_property ("outside-staff-priority");
/*
if outside_staff_priority is missing for previous grob, just
use it as a support for the current grob
*/
- if (!scm_is_number (last_outside_staff))
- Side_position_interface::add_support (g, last);
+ if (!scm_is_number (last_outside_staff))
+ Side_position_interface::add_support (g, last);
/*
if outside_staff_priority is missing or is equal to original
outside_staff_priority of previous grob, set new
outside_staff_priority to just higher than outside_staff_priority
of previous grob in order to preserve ordering.
*/
- else if ((!scm_is_number (initial_outside_staff)) ||
- (fabs (scm_to_double (initial_outside_staff) -
- robust_scm2double (last_initial_outside_staff, 0)) < 0.001))
+ else if ((!scm_is_number (initial_outside_staff))
+ || (fabs (scm_to_double (initial_outside_staff)
+ - robust_scm2double (last_initial_outside_staff, 0)) < 0.001))
g->set_property ("outside-staff-priority",
- scm_from_double (
- scm_to_double (last_outside_staff) + 0.1));
- }
- }
+ scm_from_double (scm_to_double (last_outside_staff) + 0.1));
+ }
+ }
}
while (flip (&d) != DOWN);
}
ADD_INTERFACE (Script_column,
- "An interface that sorts scripts according to their"
- " @code{script-priority} and @code{outside-staff-priority}.",
+ "An interface that sorts scripts according to their"
+ " @code{script-priority} and @code{outside-staff-priority}.",
- /* properties */
- ""
- );
+ /* properties */
+ ""
+ );
int script_count = scripts_.size ();
for (int i = 0; i < script_count; i++)
if (ly_is_equal (scripts_[i].event_
- ->get_property ("articulation-type"),
- ev->get_property ("articulation-type")))
+ ->get_property ("articulation-type"),
+ ev->get_property ("articulation-type")))
return;
Script_tuple t;
{
SCM entry = scm_assoc (sym, alist);
if (scm_is_pair (entry))
- g->set_property (sym, scm_cdr (entry));
+ g->set_property (sym, scm_cdr (entry));
}
}
ScriptStaccato , ScriptMarcato, etc. ).
*/
void
-make_script_from_event (Grob *p, Context *tg,
- SCM art_type, int index)
+make_script_from_event (Grob *p, Context *tg,
+ SCM art_type, int index)
{
SCM alist = tg->get_property ("scriptDefinitions");
SCM art = scm_assoc (art_type, alist);
SCM sym = scm_caar (s);
SCM type = scm_object_property (sym, ly_symbol2scm ("backend-type?"));
if (!ly_is_procedure (type))
- continue;
+ continue;
SCM val = scm_cdar (s);
if (sym == ly_symbol2scm ("script-priority"))
- {
- priority_found = true;
- /* Make sure they're in order of user input by adding index i.
- Don't use the direction in this priority. Smaller means closer
- to the head. */
- int prio = scm_to_int (val) + index;
+ {
+ priority_found = true;
+ /* Make sure they're in order of user input by adding index i.
+ Don't use the direction in this priority. Smaller means closer
+ to the head. */
+ int prio = scm_to_int (val) + index;
- val = scm_from_int (prio);
- }
+ val = scm_from_int (prio);
+ }
SCM preset = p->get_property_data (sym);
if (val == SCM_EOL
- || scm_call_1 (type, preset) == SCM_BOOL_F)
- p->set_property (sym, val);
+ || scm_call_1 (type, preset) == SCM_BOOL_F)
+ p->set_property (sym, val);
}
if (!priority_found)
{
p->set_property ("script-priority",
- scm_from_int (index));
+ scm_from_int (index));
}
}
Grob *p = make_item ("Script", ev->self_scm ());
make_script_from_event (p, context (),
- ev->get_property ("articulation-type"),
- i);
+ ev->get_property ("articulation-type"),
+ i);
scripts_[i].script_ = p;
SCM force_dir = ev->get_property ("direction");
if (is_direction (force_dir) && to_dir (force_dir))
- p->set_property ("direction", force_dir);
+ p->set_property ("direction", force_dir);
}
}
Grob *e = scripts_[i].script_;
if (to_dir (e->get_property ("side-relative-direction")))
- e->set_object ("direction-source", info.grob ()->self_scm ());
+ e->set_object ("direction-source", info.grob ()->self_scm ());
Side_position_interface::add_support (e, info.grob ());
}
}
}
-
void
Script_engraver::acknowledge_rhythmic_head (Grob_info info)
{
if (info.event_cause ())
{
for (vsize i = 0; i < scripts_.size (); i++)
- {
- Grob *e = scripts_[i].script_;
-
- if (Side_position_interface::get_axis (e) == X_AXIS
- && !e->get_parent (Y_AXIS))
- {
- e->set_parent (info.grob (), Y_AXIS);
- }
- Side_position_interface::add_support (e, info.grob ());
- }
+ {
+ Grob *e = scripts_[i].script_;
+
+ if (Side_position_interface::get_axis (e) == X_AXIS
+ && !e->get_parent (Y_AXIS))
+ {
+ e->set_parent (info.grob (), Y_AXIS);
+ }
+ Side_position_interface::add_support (e, info.grob ());
+ }
}
}
Grob *e = scripts_[i].script_;
if (!e->get_parent (X_AXIS)
- && Side_position_interface::get_axis (e) == Y_AXIS)
- e->set_parent (info.grob (), X_AXIS);
+ && Side_position_interface::get_axis (e) == Y_AXIS)
+ e->set_parent (info.grob (), X_AXIS);
}
}
ADD_ACKNOWLEDGER (Script_engraver, stem_tremolo);
ADD_TRANSLATOR (Script_engraver,
- /* doc */
- "Handle note scripted articulations.",
+ /* doc */
+ "Handle note scripted articulations.",
- /* create */
- "Script ",
+ /* create */
+ "Script ",
- /* read */
- "scriptDefinitions ",
+ /* read */
+ "scriptDefinitions ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
{
SCM name_entry = scm_cdr (s);
SCM str = ((scm_is_pair (name_entry)) ? index_get_cell (name_entry, d)
- : name_entry);
+ : name_entry);
return Font_interface::get_default_font (me)
- ->find_by_name ("scripts." + ly_scm2string (str));
+ ->find_by_name ("scripts." + ly_scm2string (str));
}
else
assert (false);
{
Grob *stem = Note_column::get_stem (par);
if (stem && Stem::first_head (stem))
- me->set_parent (Stem::first_head (stem), X_AXIS);
+ me->set_parent (Stem::first_head (stem), X_AXIS);
}
return SCM_BOOL_T;
}
SCM avoid_slur = me->get_property ("avoid-slur");
if (slur && to_boolean (slur->get_property ("cross-staff"))
&& (avoid_slur == ly_symbol2scm ("outside")
- || avoid_slur == ly_symbol2scm ("around")))
+ || avoid_slur == ly_symbol2scm ("around")))
return SCM_BOOL_T;
return SCM_BOOL_F;
};
ADD_INTERFACE (Text_script,
- "An object that is put above or below a note.",
+ "An object that is put above or below a note.",
- /* properties */
- "add-stem-support "
- "avoid-slur "
- "script-priority "
- "slur "
- );
+ /* properties */
+ "add-stem-support "
+ "avoid-slur "
+ "script-priority "
+ "slur "
+ );
/*
Hmm. Where should we put add-stem-support ?
*/
ADD_INTERFACE (Script_interface,
- "An object that is put above or below a note.",
-
- /* properties */
- "add-stem-support "
- "avoid-slur "
- "direction-source "
- "positioning-done "
- "script-priority "
- "script-stencil "
- "side-relative-direction "
- "slur "
- "slur-padding "
- "toward-stem-shift "
- );
+ "An object that is put above or below a note.",
+
+ /* properties */
+ "add-stem-support "
+ "avoid-slur "
+ "direction-source "
+ "positioning-done "
+ "script-priority "
+ "script-stencil "
+ "side-relative-direction "
+ "slur "
+ "slur-padding "
+ "toward-stem-shift "
+ );
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2006--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "translator.icc"
-
/**
Find potentially colliding scripts, and put them in a
Script_row
class Script_row_engraver : public Engraver
{
Grob *script_row_;
- vector<Grob*> scripts_;
-
+ vector<Grob *> scripts_;
+
public:
TRANSLATOR_DECLARATIONS (Script_row_engraver);
protected:
if (script_row_)
{
for (vsize i = 0; i < scripts_.size (); i++)
- if (Accidental_placement::has_interface (scripts_[i])
- || Side_position_interface::get_axis (scripts_[i]) == X_AXIS)
- Script_column::add_side_positioned (script_row_, scripts_[i]);
+ if (Accidental_placement::has_interface (scripts_[i])
+ || Side_position_interface::get_axis (scripts_[i]) == X_AXIS)
+ Script_column::add_side_positioned (script_row_, scripts_[i]);
}
scripts_.clear ();
if (thing)
{
if (!Item::is_non_musical (thing))
- scripts_.push_back (thing);
+ scripts_.push_back (thing);
}
}
-
void
Script_row_engraver::acknowledge_accidental_placement (Grob_info inf)
{
scripts_.push_back (inf.grob ());
}
-
void
Script_row_engraver::process_acknowledged ()
{
script_row_ = make_item ("ScriptRow", SCM_EOL);
}
-
ADD_ACKNOWLEDGER (Script_row_engraver, accidental_placement);
ADD_ACKNOWLEDGER (Script_row_engraver, side_position);
ADD_TRANSLATOR (Script_row_engraver,
- /* doc */
- "Determine order in horizontal side position elements.",
+ /* doc */
+ "Determine order in horizontal side position elements.",
- /* create */
- "ScriptRow ",
+ /* create */
+ "ScriptRow ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Self_alignment_interface::aligned_on_self (Grob *me, Axis a, bool pure, int start, int end)
{
SCM sym = (a == X_AXIS) ? ly_symbol2scm ("self-alignment-X")
- : ly_symbol2scm ("self-alignment-Y");
+ : ly_symbol2scm ("self-alignment-Y");
SCM align (me->internal_get_property (sym));
if (scm_is_number (align))
{
Interval ext (me->maybe_pure_extent (me, a, pure, start, end));
if (ext.is_empty ())
- programming_error ("cannot align on self: empty element");
+ programming_error ("cannot align on self: empty element");
else
- return scm_from_double (- ext.linear_combination (scm_to_double (align)));
+ return scm_from_double (- ext.linear_combination (scm_to_double (align)));
}
return scm_from_double (0.0);
}
-
SCM
Self_alignment_interface::centered_on_object (Grob *him, Axis a)
{
return centered_on_object (unsmob_grob (smob)->get_parent (Y_AXIS), X_AXIS);
}
-MAKE_SCHEME_CALLBACK (Self_alignment_interface, aligned_on_x_parent,1);
+MAKE_SCHEME_CALLBACK (Self_alignment_interface, aligned_on_x_parent, 1);
SCM
Self_alignment_interface::aligned_on_x_parent (SCM smob)
{
return aligned_on_parent (unsmob_grob (smob), X_AXIS);
}
-MAKE_SCHEME_CALLBACK (Self_alignment_interface, aligned_on_y_parent,1);
+MAKE_SCHEME_CALLBACK (Self_alignment_interface, aligned_on_y_parent, 1);
SCM
Self_alignment_interface::aligned_on_y_parent (SCM smob)
{
Interval he = him->extent (him, a);
SCM sym = (a == X_AXIS) ? ly_symbol2scm ("self-alignment-X")
- : ly_symbol2scm ("self-alignment-Y");
+ : ly_symbol2scm ("self-alignment-Y");
SCM align_prop (me->internal_get_property (sym));
if (!scm_is_number (align_prop))
Self_alignment_interface::set_center_parent (Grob *me, Axis a)
{
add_offset_callback (me,
- (a == X_AXIS) ? centered_on_x_parent_proc : centered_on_y_parent_proc,
- a);
+ (a == X_AXIS) ? centered_on_x_parent_proc : centered_on_y_parent_proc,
+ a);
}
void
Self_alignment_interface::set_align_self (Grob *me, Axis a)
{
add_offset_callback (me,
- (a == X_AXIS) ? x_aligned_on_self_proc : y_aligned_on_self_proc,
- a);
+ (a == X_AXIS) ? x_aligned_on_self_proc : y_aligned_on_self_proc,
+ a);
}
ADD_INTERFACE (Self_alignment_interface,
- "Position this object on itself and/or on its parent. To this"
- " end, the following functions are provided:\n"
- "\n"
- "@table @code\n"
- "@item Self_alignment_interface::[xy]_aligned_on_self\n"
- "Align self on reference point, using"
- " @code{self-alignment-X} and @code{self-alignment-Y}."
- "@item Self_alignment_interface::aligned_on_[xy]_parent\n"
- "@item Self_alignment_interface::centered_on_[xy]_parent\n"
- "Shift the object so its own reference point is centered on"
- " the extent of the parent\n"
- "@end table\n",
-
- /* properties */
- "self-alignment-X "
- "self-alignment-Y "
- );
+ "Position this object on itself and/or on its parent. To this"
+ " end, the following functions are provided:\n"
+ "\n"
+ "@table @code\n"
+ "@item Self_alignment_interface::[xy]_aligned_on_self\n"
+ "Align self on reference point, using"
+ " @code{self-alignment-X} and @code{self-alignment-Y}."
+ "@item Self_alignment_interface::aligned_on_[xy]_parent\n"
+ "@item Self_alignment_interface::centered_on_[xy]_parent\n"
+ "Shift the object so its own reference point is centered on"
+ " the extent of the parent\n"
+ "@end table\n",
+
+ /* properties */
+ "self-alignment-X "
+ "self-alignment-Y "
+ );
#include "tie-formatting-problem.hh"
#include "tie-column-format.hh"
-
ADD_INTERFACE (Semi_tie_column,
- "The interface for a column of l.v. (laissez vibrer) ties.",
-
- /* properties */
- "positioning-done "
- "head-direction "
- "tie-configuration "
- );
-
+ "The interface for a column of l.v. (laissez vibrer) ties.",
+ /* properties */
+ "positioning-done "
+ "head-direction "
+ "tie-configuration "
+ );
/*
Cut & paste from tie-column.cc
- */
+ */
MAKE_SCHEME_CALLBACK (Semi_tie_column, calc_positioning_done, 1);
SCM
Semi_tie_column::calc_positioning_done (SCM smob)
Grob *me = unsmob_grob (smob);
me->set_property ("positioning-done", SCM_BOOL_T);
-
+
extract_grob_set (me, "ties", lv_ro_ties);
- vector<Grob*> lv_ties (lv_ro_ties);
+ vector<Grob *> lv_ties (lv_ro_ties);
vector_sort (lv_ties, Semi_tie::less);
Ties_configuration ties_config;
-
Tie_formatting_problem problem;
-
+
problem.from_semi_ties (lv_ties, to_dir (me->get_property ("head-direction")));
SCM manual_configs = me->get_property ("tie-configuration");
for (vsize i = 0; i < lv_ties.size (); i++)
{
SCM cp = Tie::get_control_points (lv_ties[i], problem.common_x_refpoint (), base[i],
- problem.details_);
+ problem.details_);
lv_ties[i]->set_property ("control-points", cp);
set_grob_direction (lv_ties[i], base[i].dir_);
problem.set_debug_scoring (base);
}
-
+
return SCM_BOOL_T;
}
-
+
MAKE_SCHEME_CALLBACK (Semi_tie_column, calc_head_direction, 1);
SCM
Semi_tie_column::calc_head_direction (SCM smob)
{
Direction this_d = to_dir (ties[i]->get_property ("head-direction"));
if (i > 0 && d != this_d)
- {
- programming_error ("all semi-ties in a semi-tie-column should have the same head-direction");
- return scm_from_int (d);
- }
+ {
+ programming_error ("all semi-ties in a semi-tie-column should have the same head-direction");
+ return scm_from_int (d);
+ }
d = this_d;
}
return scm_from_int (d);
#include "staff-symbol-referencer.hh"
ADD_INTERFACE (Semi_tie,
- "A tie which is only on one side connected to a note head.",
+ "A tie which is only on one side connected to a note head.",
- /* properties */
- "control-points "
- "direction "
- "details "
- "head-direction "
- "note-head "
- "thickness "
- );
+ /* properties */
+ "control-points "
+ "direction "
+ "details "
+ "head-direction "
+ "note-head "
+ "thickness "
+ );
MAKE_SCHEME_CALLBACK (Semi_tie, calc_control_points, 1)
SCM
{
Grob *me = unsmob_grob (smob);
(void) me->get_property ("direction");
-
+
if (Semi_tie_column::has_interface (me->get_parent (Y_AXIS)))
{
me->get_parent (Y_AXIS)->get_property ("positioning-done");
}
else
{
- programming_error ("lv tie without Semi_tie_column. Killing lv tie.");
- me->suicide ();
+ programming_error ("lv tie without Semi_tie_column. Killing lv tie.");
+ me->suicide ();
}
return me->get_property_data ("control-points");
bool
Semi_tie::less (Grob *const &s1,
- Grob *const &s2)
+ Grob *const &s2)
{
return get_position (s1) < get_position (s2);
}
-
+
struct Spacings
{
Item *staff_spacing_;
- vector<Item*> note_spacings_;
+ vector<Item *> note_spacings_;
Spacings ()
{
void stop_translation_timestep ();
void start_translation_timestep ();
- vector<Grob*> break_aligned_;
+ vector<Grob *> break_aligned_;
public:
TRANSLATOR_DECLARATIONS (Separating_line_group_engraver);
};
context ()->set_property ("hasStaffSpacing", SCM_BOOL_T);
Pointer_group_interface::add_grob (current_spacings_.staff_spacing_,
- ly_symbol2scm ("left-items"),
- col);
-
+ ly_symbol2scm ("left-items"),
+ col);
+
if (!last_spacings_.note_spacings_.size ()
- && last_spacings_.staff_spacing_)
- {
- SCM ri = last_spacings_.staff_spacing_->get_object ("right-items");
- Grob_array *ga = unsmob_grob_array (ri);
- if (!ga)
- {
- SCM ga_scm = Grob_array::make_array ();
- last_spacings_.staff_spacing_->set_object ("right-items", ga_scm);
- ga = unsmob_grob_array (ga_scm);
- }
-
- ga->clear ();
- ga->add (col);
- }
+ && last_spacings_.staff_spacing_)
+ {
+ SCM ri = last_spacings_.staff_spacing_->get_object ("right-items");
+ Grob_array *ga = unsmob_grob_array (ri);
+ if (!ga)
+ {
+ SCM ga_scm = Grob_array::make_array ();
+ last_spacings_.staff_spacing_->set_object ("right-items", ga_scm);
+ ga = unsmob_grob_array (ga_scm);
+ }
+
+ ga->clear ();
+ ga->add (col);
+ }
}
}
SCM smob = break_aligned_[i]->self_scm ();
if (Item *sp = current_spacings_.staff_spacing_)
- Pointer_group_interface::add_grob (sp, ly_symbol2scm ("left-break-aligned"), smob);
+ Pointer_group_interface::add_grob (sp, ly_symbol2scm ("left-break-aligned"), smob);
for (vsize j = 0; j < last_spacings_.note_spacings_.size (); j++)
- Pointer_group_interface::add_grob (last_spacings_.note_spacings_[j],
- ly_symbol2scm ("right-break-aligned"), smob);
+ Pointer_group_interface::add_grob (last_spacings_.note_spacings_[j],
+ ly_symbol2scm ("right-break-aligned"), smob);
}
if (!current_spacings_.is_empty ())
ADD_ACKNOWLEDGER (Separating_line_group_engraver, break_aligned);
ADD_TRANSLATOR (Separating_line_group_engraver,
- /* doc */
- "Generate objects for computing spacing parameters.",
+ /* doc */
+ "Generate objects for computing spacing parameters.",
- /* create */
- "StaffSpacing ",
+ /* create */
+ "StaffSpacing ",
- /* read */
- "createSpacing ",
+ /* read */
+ "createSpacing ",
- /* write */
- "hasStaffSpacing "
- );
+ /* write */
+ "hasStaffSpacing "
+ );
Real
Separation_item::set_distance (Item *l, Item *r, Real padding)
{
- Drul_array<Skyline_pair*> lines (Skyline_pair::unsmob (l->get_property ("horizontal-skylines")),
- Skyline_pair::unsmob (r->get_property ("horizontal-skylines")));
+ Drul_array<Skyline_pair *> lines (Skyline_pair::unsmob (l->get_property ("horizontal-skylines")),
+ Skyline_pair::unsmob (r->get_property ("horizontal-skylines")));
Skyline right = conditional_skyline (r, l);
right.merge ((*lines[RIGHT])[LEFT]);
-
+
Real dist = padding + (*lines[LEFT])[RIGHT].distance (right);
if (dist > 0)
{
Rod rod;
- rod.item_drul_ = Drul_array<Item*> (l, r);
+ rod.item_drul_ = Drul_array<Item *> (l, r);
rod.distance_ = dist;
rod.add_to_cols ();
return Skyline (bs, horizon_padding, Y_AXIS, LEFT);
}
-
-MAKE_SCHEME_CALLBACK (Separation_item, calc_skylines,1);
+MAKE_SCHEME_CALLBACK (Separation_item, calc_skylines, 1);
SCM
Separation_item::calc_skylines (SCM smob)
{
Paper_column *pc = item->get_column ();
vector<Box> out;
extract_grob_set (me, left ? "conditional-elements" : "elements", read_only_elts);
- vector<Grob*> elts;
+ vector<Grob *> elts;
if (left)
elts = Accidental_placement::get_relevant_accidentals (read_only_elts, left);
elts = read_only_elts;
/* This is a special-case for NoteColumn: we want to include arpeggio in its
- skyline (so spacing takes it into account) but we don't want to include it
- in the NoteColumn's extent because some spanners (eg. Hairpin) bound themselves
- on the NoteColumn and we don't want them to include arpeggios in their bounds.
+ skyline (so spacing takes it into account) but we don't want to include it
+ in the NoteColumn's extent because some spanners (eg. Hairpin) bound themselves
+ on the NoteColumn and we don't want them to include arpeggios in their bounds.
*/
- if (Grob *a = Note_column::arpeggio (me)) {
- elts.push_back (a);
- }
+ if (Grob *a = Note_column::arpeggio (me))
+ {
+ elts.push_back (a);
+ }
}
Grob *ycommon = common_refpoint_of_array (elts, me, Y_AXIS);
-
+
for (vsize i = 0; i < elts.size (); i++)
{
Item *il = dynamic_cast<Item *> (elts[i]);
if (pc != il->get_column ())
- continue;
+ continue;
/* ugh. We want to exclude groups of grobs (so that we insert each grob
- individually into the skyline instead of adding a single box that
- bounds all of them). However, we can't exclude an axis-group that
- adds to its childrens' stencil. Currently, this is just TrillPitchGroup;
- hence the check for note-head-interface. */
+ individually into the skyline instead of adding a single box that
+ bounds all of them). However, we can't exclude an axis-group that
+ adds to its childrens' stencil. Currently, this is just TrillPitchGroup;
+ hence the check for note-head-interface. */
if (Axis_group_interface::has_interface (il)
- && !Note_head::has_interface (il))
- continue;
+ && !Note_head::has_interface (il))
+ continue;
Interval y (il->pure_height (ycommon, 0, very_large));
Interval x (il->extent (pc, X_AXIS));
Interval extra_width = robust_scm2interval (elts[i]->get_property ("extra-spacing-width"),
- Interval (-0.1, 0.1));
+ Interval (-0.1, 0.1));
Interval extra_height = robust_scm2interval (elts[i]->get_property ("extra-spacing-height"),
- Interval (0.0, 0.0));
+ Interval (0.0, 0.0));
x[LEFT] += extra_width[LEFT];
x[RIGHT] += extra_width[RIGHT];
y[UP] += extra_height[UP];
if (!x.is_empty () && !y.is_empty ())
- out.push_back (Box (x, y));
+ out.push_back (Box (x, y));
}
- return out;
+ return out;
}
MAKE_SCHEME_CALLBACK (Separation_item, print, 1)
}
ADD_INTERFACE (Separation_item,
- "Item that computes widths to generate spacing rods.",
-
- /* properties */
- "X-extent "
- "conditional-elements "
- "elements "
- "padding "
- "horizontal-skylines "
- "skyline-vertical-padding "
- );
+ "Item that computes widths to generate spacing rods.",
+
+ /* properties */
+ "X-extent "
+ "conditional-elements "
+ "elements "
+ "padding "
+ "horizontal-skylines "
+ "skyline-vertical-padding "
+ );
Moment l = mus->get_length () - s;
if (s.grace_part_)
- {
- if (last != Moment (-1))
- {
- Grace_fixup *p = new Grace_fixup;
- p->start_ = last;
- p->length_ = here - last;
- p->grace_start_ = s.grace_part_;
- p->next_ = 0;
- *tail = p;
- tail = &(*tail)->next_;
- }
-
- here.grace_part_ = s.grace_part_;
- }
+ {
+ if (last != Moment (-1))
+ {
+ Grace_fixup *p = new Grace_fixup;
+ p->start_ = last;
+ p->length_ = here - last;
+ p->grace_start_ = s.grace_part_;
+ p->next_ = 0;
+ *tail = p;
+ tail = &(*tail)->next_;
+ }
+
+ here.grace_part_ = s.grace_part_;
+ }
if (l.to_bool ())
- {
- last = here;
- here += l;
- }
+ {
+ last = here;
+ here += l;
+ }
}
return head;
else
{
/*
- !len.grace_part_ || len.main_part_
+ !len.grace_part_ || len.main_part_
- We skip over a big chunk (mainpart != 0). Any starting graces
- in that chunk should be in len.grace_part_
+ We skip over a big chunk (mainpart != 0). Any starting graces
+ in that chunk should be in len.grace_part_
*/
last_mom_ = here_mom_;
{
Grace_fixup *gf = get_grace_fixup ();
if (gf
- && gf->start_ + gf->length_
- + Moment (Rational (0), gf->grace_start_) == until)
- {
- /*
- do the stuff/note/rest preceding a grace.
- */
- iter_->process (iter_->music_get_length ());
- }
+ && gf->start_ + gf->length_
+ + Moment (Rational (0), gf->grace_start_) == until)
+ {
+ /*
+ do the stuff/note/rest preceding a grace.
+ */
+ iter_->process (iter_->music_get_length ());
+ }
else
- {
- Moment w = until - here_mom_ + iter_->music_start_mom ();
- iter_->process (w);
- }
+ {
+ Moment w = until - here_mom_ + iter_->music_start_mom ();
+ iter_->process (w);
+ }
/*
- if the iter is still OK, there must be events left that have
+ if the iter is still OK, there must be events left that have
- TIME > LEFT
+ TIME > LEFT
*/
if (iter_->ok ())
- return;
+ return;
descend_to_child (iter_->get_outlet ());
next_element (true);
#include "side-position-interface.hh"
-#include <cmath> // ceil.
+#include <cmath> // ceil.
#include <algorithm>
using namespace std;
*/
SCM
Side_position_interface::general_side_position (Grob *me, Axis a, bool use_extents,
- bool include_my_extent,
- bool pure, int start, int end,
- Real *current_offset)
+ bool include_my_extent,
+ bool pure, int start, int end,
+ Real *current_offset)
{
Real ss = Staff_symbol_referencer::staff_space (me);
Grob *common = common_refpoint_of_array (support, me->get_parent (a), a);
Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (me);
- bool include_staff =
- staff_symbol
- && a == Y_AXIS
- && scm_is_number (me->get_property ("staff-padding"))
- && !to_boolean (me->get_property ("quantize-position"));
+ bool include_staff
+ = staff_symbol
+ && a == Y_AXIS
+ && scm_is_number (me->get_property ("staff-padding"))
+ && !to_boolean (me->get_property ("quantize-position"));
Interval dim;
Interval staff_extents;
staff_extents = staff_symbol->maybe_pure_extent (common, Y_AXIS, pure, start, end);
if (include_staff)
- dim.unite (staff_extents);
+ dim.unite (staff_extents);
}
Direction dir = get_grob_direction (me);
// ignoring the stem solves cyclic dependencies if the stem is
// attached to a cross-staff beam.
if (a == Y_AXIS
- && Stem::has_interface (e)
- && dir == - get_grob_direction (e))
- continue;
+ && Stem::has_interface (e)
+ && dir == - get_grob_direction (e))
+ continue;
if (e)
- {
- if (use_extents)
- dim.unite (e->maybe_pure_extent (common, a, pure, start, end));
- else
- {
- Real x = e->maybe_pure_coordinate (common, a, pure, start, end);
- dim.unite (Interval (x, x));
- }
- }
+ {
+ if (use_extents)
+ dim.unite (e->maybe_pure_extent (common, a, pure, start, end));
+ else
+ {
+ Real x = e->maybe_pure_coordinate (common, a, pure, start, end);
+ dim.unite (Interval (x, x));
+ }
+ }
}
if (dim.is_empty ())
{
Interval iv = me->maybe_pure_extent (me, a, pure, start, end);
if (!iv.is_empty ())
- {
- if (!dir)
- {
- programming_error ("direction unknown, but aligned-side wanted");
- dir = DOWN;
- }
- total_off += -iv[-dir];
- }
+ {
+ if (!dir)
+ {
+ programming_error ("direction unknown, but aligned-side wanted");
+ dir = DOWN;
+ }
+ total_off += -iv[-dir];
+ }
}
if (current_offset)
total_off = dir * max (dir * total_off,
- dir * (*current_offset));
-
+ dir * (*current_offset));
/* FIXME: 1000 should relate to paper size. */
if (fabs (total_off) > 1000)
{
string msg
- = String_convert::form_string ("Improbable offset for grob %s: %f",
- me->name ().c_str (), total_off);
+ = String_convert::form_string ("Improbable offset for grob %s: %f",
+ me->name ().c_str (), total_off);
programming_error (msg);
if (strict_infinity_checking)
- scm_misc_error (__FUNCTION__, "Improbable offset.", SCM_EOL);
+ scm_misc_error (__FUNCTION__, "Improbable offset.", SCM_EOL);
}
return scm_from_double (total_off);
}
-
MAKE_SCHEME_CALLBACK (Side_position_interface, y_aligned_on_support_refpoints, 1);
SCM
Side_position_interface::y_aligned_on_support_refpoints (SCM smob)
Side_position_interface::pure_y_aligned_on_support_refpoints (SCM smob, SCM start, SCM end)
{
return general_side_position (unsmob_grob (smob), Y_AXIS, false, false,
- true, scm_to_int (start), scm_to_int (end), 0);
+ true, scm_to_int (start), scm_to_int (end), 0);
}
-
/*
Position next to support, taking into account my own dimensions and padding.
*/
return Side_position_interface::aligned_side (unsmob_grob (smob), a, pure, start, end, current_off_ptr);
}
-
MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, x_aligned_side, 2, 1, "");
SCM
Side_position_interface::x_aligned_side (SCM smob, SCM current_off)
Side_position_interface::pure_y_aligned_side (SCM smob, SCM start, SCM end, SCM cur_off)
{
return axis_aligned_side_helper (smob, Y_AXIS, true,
- scm_to_int (start),
- scm_to_int (end),
- cur_off);
+ scm_to_int (start),
+ scm_to_int (end),
+ cur_off);
}
MAKE_SCHEME_CALLBACK (Side_position_interface, calc_cross_staff, 1)
SCM
Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, int end,
- Real *current_off)
+ Real *current_off)
{
Direction dir = get_grob_direction (me);
if (staff && a == Y_AXIS)
{
if (to_boolean (me->get_property ("quantize-position")))
- {
- Grob *common = me->common_refpoint (staff, Y_AXIS);
- Real my_off = me->get_parent (Y_AXIS)->maybe_pure_coordinate (common, Y_AXIS, pure, start, end);
- Real staff_off = staff->maybe_pure_coordinate (common, Y_AXIS, pure, start, end);
- Real ss = Staff_symbol::staff_space (staff);
- Real position = 2 * (my_off + o - staff_off) / ss;
- Real rounded = directed_round (position, dir);
- Grob *head = me->get_parent (X_AXIS);
-
- if (fabs (position) <= 2 * Staff_symbol_referencer::staff_radius (me) + 1
- /* In case of a ledger lines, quantize even if we're outside the staff. */
- || (Note_head::has_interface (head)
-
- && abs (Staff_symbol_referencer::get_position (head)) > abs (position)))
- {
- o += (rounded - position) * 0.5 * ss;
- if (Staff_symbol_referencer::on_line (me, int (rounded)))
- o += dir * 0.5 * ss;
- }
- }
+ {
+ Grob *common = me->common_refpoint (staff, Y_AXIS);
+ Real my_off = me->get_parent (Y_AXIS)->maybe_pure_coordinate (common, Y_AXIS, pure, start, end);
+ Real staff_off = staff->maybe_pure_coordinate (common, Y_AXIS, pure, start, end);
+ Real ss = Staff_symbol::staff_space (staff);
+ Real position = 2 * (my_off + o - staff_off) / ss;
+ Real rounded = directed_round (position, dir);
+ Grob *head = me->get_parent (X_AXIS);
+
+ if (fabs (position) <= 2 * Staff_symbol_referencer::staff_radius (me) + 1
+ /* In case of a ledger lines, quantize even if we're outside the staff. */
+ || (Note_head::has_interface (head)
+
+ && abs (Staff_symbol_referencer::get_position (head)) > abs (position)))
+ {
+ o += (rounded - position) * 0.5 * ss;
+ if (Staff_symbol_referencer::on_line (me, int (rounded)))
+ o += dir * 0.5 * ss;
+ }
+ }
else if (scm_is_number (me->get_property ("staff-padding")) && dir)
- {
- Interval iv = me->maybe_pure_extent (me, a, pure, start, end);
+ {
+ Interval iv = me->maybe_pure_extent (me, a, pure, start, end);
- Real staff_padding
- = Staff_symbol_referencer::staff_space (me)
- * scm_to_double (me->get_property ("staff-padding"));
+ Real staff_padding
+ = Staff_symbol_referencer::staff_space (me)
+ * scm_to_double (me->get_property ("staff-padding"));
Grob *parent = me->get_parent (Y_AXIS);
Grob *common = me->common_refpoint (staff, Y_AXIS);
- dir * (o + iv[-dir])
+ dir * (staff_position - parent_position));
o += dir * max (diff, 0.0);
- }
+ }
}
return scm_from_double (o);
}
{
me->set_property ("side-axis", scm_from_int (a));
chain_offset_callback (me,
- (a==X_AXIS)
- ? x_aligned_side_proc
- : y_aligned_side_proc,
- a);
+ (a == X_AXIS)
+ ? x_aligned_side_proc
+ : y_aligned_side_proc,
+ a);
}
}
return Axis (scm_to_int (me->get_property ("side-axis")));
string msg = String_convert::form_string ("side-axis not set for grob %s.",
- me->name ().c_str ());
+ me->name ().c_str ());
me->programming_error (msg);
return NO_AXES;
}
Side_position_interface::move_to_extremal_staff (SCM smob)
{
Grob *me = unsmob_grob (smob);
- System *sys = dynamic_cast<System*> (me->get_system ());
+ System *sys = dynamic_cast<System *> (me->get_system ());
Direction dir = get_grob_direction (me);
if (dir != DOWN)
dir = UP;
Grob_array *ga = unsmob_grob_array (me->get_object ("side-support-elements"));
if (ga)
{
- vector<Grob*> const& elts = ga->array ();
- vector<Grob*> new_elts;
+ vector<Grob *> const &elts = ga->array ();
+ vector<Grob *> new_elts;
for (vsize i = 0; i < elts.size (); ++i)
- {
- if (me->common_refpoint (elts[i], Y_AXIS) == top_staff)
- new_elts.push_back (elts[i]);
- }
+ {
+ if (me->common_refpoint (elts[i], Y_AXIS) == top_staff)
+ new_elts.push_back (elts[i]);
+ }
ga->set_array (new_elts);
}
return SCM_BOOL_T;
}
-
ADD_INTERFACE (Side_position_interface,
- "Position a victim object (this one) next to other objects"
- " (the support). The property @code{direction} signifies where"
- " to put the victim object relative to the support (left or"
- " right, up or down?)\n"
- "\n"
- "The routine also takes the size of the staff into account if"
- " @code{staff-padding} is set. If undefined, the staff symbol"
- " is ignored.",
-
- /* properties */
- "direction "
- "minimum-space "
- "padding "
- "quantize-position "
- "side-axis "
- "side-support-elements "
- "slur-padding "
- "staff-padding "
- );
+ "Position a victim object (this one) next to other objects"
+ " (the support). The property @code{direction} signifies where"
+ " to put the victim object relative to the support (left or"
+ " right, up or down?)\n"
+ "\n"
+ "The routine also takes the size of the staff into account if"
+ " @code{staff-padding} is set. If undefined, the staff symbol"
+ " is ignored.",
+
+ /* properties */
+ "direction "
+ "minimum-space "
+ "padding "
+ "quantize-position "
+ "side-axis "
+ "side-support-elements "
+ "slur-padding "
+ "staff-padding "
+ );
simple_closure_expression (SCM smob)
{
assert (is_simple_closure (smob));
- return (SCM) SCM_CELL_WORD_1(smob);
+ return (SCM) SCM_CELL_WORD_1 (smob);
}
SCM
for (SCM s = args; scm_is_pair (s); s = scm_cdr (s))
{
*tail = scm_cons (evaluate_with_simple_closure (delayed_argument, scm_car (s),
- pure, start, end),
- SCM_EOL);
+ pure, start, end),
+ SCM_EOL);
if (scm_car (*tail) == SCM_UNSPECIFIED)
- return SCM_UNSPECIFIED;
+ return SCM_UNSPECIFIED;
tail = SCM_CDRLOC (*tail);
}
-
+
return new_args;
}
SCM
evaluate_with_simple_closure (SCM delayed_argument,
- SCM expr,
- bool pure,
- int start,
- int end)
+ SCM expr,
+ bool pure,
+ int start,
+ int end)
{
if (is_simple_closure (expr))
{
SCM inside = simple_closure_expression (expr);
SCM args = scm_cons (delayed_argument,
- evaluate_args (delayed_argument, scm_cdr (inside),
- pure, start, end));
+ evaluate_args (delayed_argument, scm_cdr (inside),
+ pure, start, end));
if (scm_cdr (args) == SCM_UNSPECIFIED)
- return SCM_UNSPECIFIED;
+ return SCM_UNSPECIFIED;
if (pure)
- return call_pure_function (scm_car (inside), args, start, end);
+ return call_pure_function (scm_car (inside), args, start, end);
return scm_apply_0 (scm_car (inside), args);
}
else if (!scm_is_pair (expr))
{
SCM args = evaluate_args (delayed_argument, scm_cdr (expr), pure, start, end);
if (args == SCM_UNSPECIFIED)
- return SCM_UNSPECIFIED;
+ return SCM_UNSPECIFIED;
if (pure)
- return call_pure_function (scm_car (expr), args, start, end);
+ return call_pure_function (scm_car (expr), args, start, end);
return scm_apply_0 (scm_car (expr), args);
}
else
- // ugh. deviation from standard. Should print error?
- return evaluate_args (delayed_argument, scm_cdr (expr), pure, start, end);
-
+ // ugh. deviation from standard. Should print error?
+ return evaluate_args (delayed_argument, scm_cdr (expr), pure, start, end);
+
assert (false);
return SCM_EOL;
}
LY_DEFINE (ly_simple_closure_p, "ly:simple-closure?",
- 1, 0, 0, (SCM clos),
- "Is @var{clos} a simple closure?")
+ 1, 0, 0, (SCM clos),
+ "Is @var{clos} a simple closure?")
{
return scm_from_bool (is_simple_closure (clos));
}
LY_DEFINE (ly_make_simple_closure, "ly:make-simple-closure",
- 1, 0, 0, (SCM expr),
- "Make a simple closure. @var{expr} should be form of"
- " @code{(@var{func} @var{a1} @var{a2} @dots{})}, and will be"
- " invoked as @code{(@var{func} @var{delayed-arg} @var{a1}"
- " @var{a2} @dots{})}.")
+ 1, 0, 0, (SCM expr),
+ "Make a simple closure. @var{expr} should be form of"
+ " @code{(@var{func} @var{a1} @var{a2} @dots{})}, and will be"
+ " invoked as @code{(@var{func} @var{delayed-arg} @var{a1}"
+ " @var{a2} @dots{})}.")
{
SCM z;
}
LY_DEFINE (ly_eval_simple_closure, "ly:eval-simple-closure",
- 2, 2, 0, (SCM delayed, SCM closure, SCM scm_start, SCM scm_end),
- "Evaluate a simple @var{closure} with the given @var{delayed}"
- " argument. If @var{scm-start} and @var{scm-end} are defined,"
- " evaluate it purely with those start and end points.")
+ 2, 2, 0, (SCM delayed, SCM closure, SCM scm_start, SCM scm_end),
+ "Evaluate a simple @var{closure} with the given @var{delayed}"
+ " argument. If @var{scm-start} and @var{scm-end} are defined,"
+ " evaluate it purely with those start and end points.")
{
bool pure = (scm_is_number (scm_start) && scm_is_number (scm_end));
int start = robust_scm2int (scm_start, 0);
SCM expr = simple_closure_expression (closure);
return evaluate_with_simple_closure (delayed, expr, pure, start, end);
}
-
+
int
print_simple_closure (SCM s, SCM port, scm_print_state *)
{
return 1;
}
-
void init_simple_closure ()
{
simple_closure_tag = scm_make_smob_type ("simple-closure", 0);
scm_set_smob_print (simple_closure_tag, print_simple_closure);
};
-
-
ADD_SCM_INIT_FUNC (simple_closure, init_simple_closure);
#include "simple-spacer.hh"
LY_DEFINE (ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem",
- 4, 1, 0, (SCM springs, SCM rods, SCM length, SCM ragged),
- "Solve a spring and rod problem for @var{count} objects, that"
- " are connected by @var{count}-1 @var{springs}, and an arbitrary"
- " number of @var{rods}. @var{count} is implicitly given by"
- " @var{springs} and @var{rods}. The @var{springs} argument has"
- " the format @code{(ideal, inverse_hook)} and @var{rods} is of"
- " the form @code{(idx1, idx2, distance)}.\n"
- "\n"
- "@var{length} is a number, @var{ragged} a boolean.\n"
- "\n"
- "The function returns a list containing the force (positive for"
- " stretching, negative for compressing and @code{#f} for"
- " non-satisfied constraints) followed by @var{spring-count}+1"
- " positions of the objects.")
+ 4, 1, 0, (SCM springs, SCM rods, SCM length, SCM ragged),
+ "Solve a spring and rod problem for @var{count} objects, that"
+ " are connected by @var{count}-1 @var{springs}, and an arbitrary"
+ " number of @var{rods}. @var{count} is implicitly given by"
+ " @var{springs} and @var{rods}. The @var{springs} argument has"
+ " the format @code{(ideal, inverse_hook)} and @var{rods} is of"
+ " the form @code{(idx1, idx2, distance)}.\n"
+ "\n"
+ "@var{length} is a number, @var{ragged} a boolean.\n"
+ "\n"
+ "The function returns a list containing the force (positive for"
+ " stretching, negative for compressing and @code{#f} for"
+ " non-satisfied constraints) followed by @var{spring-count}+1"
+ " positions of the objects.")
{
int len = scm_ilength (springs);
if (len == 0)
return scm_list_2 (scm_from_double (0.0), scm_from_double (0.0));
SCM_ASSERT_TYPE (len >= 0, springs, SCM_ARG1, __FUNCTION__, "list of springs");
- SCM_ASSERT_TYPE (scm_ilength (rods) > 0, rods, SCM_ARG1, __FUNCTION__, "list of rods");
+ SCM_ASSERT_TYPE (scm_ilength (rods) > 0, rods, SCM_ARG1, __FUNCTION__, "list of rods");
LY_ASSERT_TYPE (scm_is_number, length, 3);
bool is_ragged = ragged == SCM_BOOL_T;
#include "column-x-positions.hh"
#include "dimensions.hh"
#include "international.hh"
-#include "libc-extension.hh" // isinf
+#include "libc-extension.hh" // isinf
#include "paper-column.hh"
#include "simple-spacer.hh"
#include "spaceable-grob.hh"
{
Real spring_dist = range_ideal_len (l, r);
if (spring_dist < dist)
- for (int i = l; i < r; i++)
- {
- if (spring_dist)
- springs_[i].set_distance (springs_[i].distance () * dist / spring_dist);
- else
- springs_[i].set_distance (dist / (r - l));
- }
+ for (int i = l; i < r; i++)
+ {
+ if (spring_dist)
+ springs_[i].set_distance (springs_[i].distance () * dist / spring_dist);
+ else
+ springs_[i].set_distance (dist / (r - l));
+ }
return;
}
Real den = 0.0;
for (int i = l; i < r; i++)
den += stretch ? springs_[i].inverse_stretch_strength ()
- : springs_[i].inverse_compress_strength ();
+ : springs_[i].inverse_compress_strength ();
return 1 / den;
}
double cur_len = configuration_length (force_);
fits_ = true;
- for (vsize i=0; i < springs_.size (); i++)
+ for (vsize i = 0; i < springs_.size (); i++)
inv_hooke += springs_[i].inverse_stretch_strength ();
if (inv_hooke == 0.0) /* avoid division by zero. If springs are infinitely stiff */
/* inv_hooke is the total flexibility of currently-active springs */
double inv_hooke = 0;
vsize i = sorted_springs.size ();
- for ( ; i && sorted_springs[i - 1].blocking_force () < cur_force; i--)
+ for (; i && sorted_springs[i - 1].blocking_force () < cur_force; i--)
inv_hooke += compressed
- ? sorted_springs[i - 1].inverse_compress_strength ()
- : sorted_springs[i - 1].inverse_stretch_strength ();
+ ? sorted_springs[i - 1].inverse_compress_strength ()
+ : sorted_springs[i - 1].inverse_stretch_strength ();
/* i now indexes the first active spring, so */
- for ( ; i < sorted_springs.size (); i++)
+ for (; i < sorted_springs.size (); i++)
{
Spring sp = sorted_springs[i];
if (isinf (sp.blocking_force ()))
- break;
+ break;
double block_dist = (cur_force - sp.blocking_force ()) * inv_hooke;
if (cur_len - block_dist < line_len_)
- {
- cur_force += (line_len_ - cur_len) / inv_hooke;
- cur_len = line_len_;
-
- /*
- Paranoia check.
- */
- assert (fabs (configuration_length (cur_force) - cur_len) < 1e-6);
- return cur_force;
- }
-
+ {
+ cur_force += (line_len_ - cur_len) / inv_hooke;
+ cur_len = line_len_;
+
+ /*
+ Paranoia check.
+ */
+ assert (fabs (configuration_length (cur_force) - cur_len) < 1e-6);
+ return cur_force;
+ }
+
cur_len -= block_dist;
inv_hooke -= compressed ? sp.inverse_compress_strength () : sp.inverse_stretch_strength ();
cur_force = sp.blocking_force ();
/* Use a convex compression penalty. */
Real f = force_;
- return f - (f < 0 ? f*f*f*f*2 : 0);
+ return f - (f < 0 ? f * f * f * f * 2 : 0);
}
/****************************************************************/
vsize r_;
Real dist_;
- bool operator< (const Rod_description r)
+ bool operator < (const Rod_description r)
{
return r_ < r.r_;
}
return (scm_is_pair (g->get_object ("between-cols")));
}
-static Grob*
+static Grob *
maybe_find_prebroken_piece (Grob *g, Direction d)
{
- Grob *ret = dynamic_cast<Item*> (g)->find_prebroken_piece (d);
+ Grob *ret = dynamic_cast<Item *> (g)->find_prebroken_piece (d);
if (ret)
return ret;
return g;
}
-static Grob*
-next_spaceable_column (vector<Grob*> const &list, vsize starting)
+static Grob *
+next_spaceable_column (vector<Grob *> const &list, vsize starting)
{
- for (vsize i = starting+1; i < list.size (); i++)
+ for (vsize i = starting + 1; i < list.size (); i++)
if (!is_loose (list[i]))
return list[i];
return 0;
}
static Column_description
-get_column_description (vector<Grob*> const &cols, vsize col_index, bool line_starter)
+get_column_description (vector<Grob *> const &cols, vsize col_index, bool line_starter)
{
Grob *col = cols[col_index];
if (line_starter)
if (next_col)
description.spring_ = Spaceable_grob::get_spring (col, next_col);
- Grob *end_col = dynamic_cast<Item*> (cols[col_index+1])->find_prebroken_piece (LEFT);
+ Grob *end_col = dynamic_cast<Item *> (cols[col_index + 1])->find_prebroken_piece (LEFT);
if (end_col)
description.end_spring_ = Spaceable_grob::get_spring (col, end_col);
Grob *other = unsmob_grob (scm_caar (s));
vsize j = binary_search (cols, other, Paper_column::less_than, col_index);
if (j != VPOS)
- {
- if (cols[j] == other)
- description.rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
- else /* it must end at the LEFT prebroken_piece */
- description.end_rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
- }
+ {
+ if (cols[j] == other)
+ description.rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
+ else /* it must end at the LEFT prebroken_piece */
+ description.end_rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
+ }
}
-
+
if (!line_starter && to_boolean (col->get_property ("keep-inside-line")))
description.keep_inside_line_ = col->extent (col, X_AXIS);
}
vector<Real>
-get_line_forces (vector<Grob*> const &columns,
- Real line_len, Real indent, bool ragged)
+get_line_forces (vector<Grob *> const &columns,
+ Real line_len, Real indent, bool ragged)
{
vector<vsize> breaks;
vector<Real> force;
- vector<Grob*> non_loose;
+ vector<Grob *> non_loose;
vector<Column_description> cols;
SCM force_break = ly_symbol2scm ("force");
for (vsize i = 1; i + 1 < non_loose.size (); i++)
{
if (Paper_column::is_breakable (non_loose[i]))
- breaks.push_back (cols.size ());
+ breaks.push_back (cols.size ());
cols.push_back (get_column_description (non_loose, i, false));
}
cols[breaks[b]] = get_column_description (non_loose, breaks[b], true);
vsize st = breaks[b];
- for (vsize c = b+1; c < breaks.size (); c++)
- {
- vsize end = breaks[c];
- Simple_spacer spacer;
-
- for (vsize i = breaks[b]; i < end - 1; i++)
- spacer.add_spring (cols[i].spring_);
- spacer.add_spring (cols[end-1].end_spring_);
-
-
- for (vsize i = breaks[b]; i < end; i++)
- {
- for (vsize r = 0; r < cols[i].rods_.size (); r++)
- if (cols[i].rods_[r].r_ < end)
- spacer.add_rod (i - st, cols[i].rods_[r].r_ - st, cols[i].rods_[r].dist_);
- for (vsize r = 0; r < cols[i].end_rods_.size (); r++)
- if (cols[i].end_rods_[r].r_ == end)
- spacer.add_rod (i - st, end - st, cols[i].end_rods_[r].dist_);
- if (!cols[i].keep_inside_line_.is_empty ())
- {
- spacer.add_rod (i - st, end - st, cols[i].keep_inside_line_[RIGHT]);
- spacer.add_rod (0, i - st, -cols[i].keep_inside_line_[LEFT]);
- }
- }
- spacer.solve ((b == 0) ? line_len - indent : line_len, ragged);
- force[b * breaks.size () + c] = spacer.force_penalty (ragged);
-
- if (!spacer.fits ())
- {
- if (c == b + 1)
- force[b * breaks.size () + c] = -200000;
- else
- force[b * breaks.size () + c] = infinity_f;
- break;
- }
- if (end < cols.size () && cols[end].break_permission_ == force_break)
- break;
- }
+ for (vsize c = b + 1; c < breaks.size (); c++)
+ {
+ vsize end = breaks[c];
+ Simple_spacer spacer;
+
+ for (vsize i = breaks[b]; i < end - 1; i++)
+ spacer.add_spring (cols[i].spring_);
+ spacer.add_spring (cols[end - 1].end_spring_);
+
+ for (vsize i = breaks[b]; i < end; i++)
+ {
+ for (vsize r = 0; r < cols[i].rods_.size (); r++)
+ if (cols[i].rods_[r].r_ < end)
+ spacer.add_rod (i - st, cols[i].rods_[r].r_ - st, cols[i].rods_[r].dist_);
+ for (vsize r = 0; r < cols[i].end_rods_.size (); r++)
+ if (cols[i].end_rods_[r].r_ == end)
+ spacer.add_rod (i - st, end - st, cols[i].end_rods_[r].dist_);
+ if (!cols[i].keep_inside_line_.is_empty ())
+ {
+ spacer.add_rod (i - st, end - st, cols[i].keep_inside_line_[RIGHT]);
+ spacer.add_rod (0, i - st, -cols[i].keep_inside_line_[LEFT]);
+ }
+ }
+ spacer.solve ((b == 0) ? line_len - indent : line_len, ragged);
+ force[b * breaks.size () + c] = spacer.force_penalty (ragged);
+
+ if (!spacer.fits ())
+ {
+ if (c == b + 1)
+ force[b * breaks.size () + c] = -200000;
+ else
+ force[b * breaks.size () + c] = infinity_f;
+ break;
+ }
+ if (end < cols.size () && cols[end].break_permission_ == force_break)
+ break;
+ }
}
return force;
}
Column_x_positions
-get_line_configuration (vector<Grob*> const &columns,
- Real line_len,
- Real indent,
- bool ragged)
+get_line_configuration (vector<Grob *> const &columns,
+ Real line_len,
+ Real indent,
+ bool ragged)
{
vector<Column_description> cols;
Simple_spacer spacer;
Column_x_positions ret;
- ret.cols_.push_back (dynamic_cast<Item*> (columns[0])->find_prebroken_piece (RIGHT));
+ ret.cols_.push_back (dynamic_cast<Item *> (columns[0])->find_prebroken_piece (RIGHT));
for (vsize i = 1; i + 1 < columns.size (); i++)
{
if (is_loose (columns[i]))
- ret.loose_cols_.push_back (columns[i]);
+ ret.loose_cols_.push_back (columns[i]);
else
- ret.cols_.push_back (columns[i]);
+ ret.cols_.push_back (columns[i]);
}
- ret.cols_.push_back (dynamic_cast<Item*> (columns.back ())->find_prebroken_piece (LEFT));
+ ret.cols_.push_back (dynamic_cast<Item *> (columns.back ())->find_prebroken_piece (LEFT));
/* since we've already put our line-ending column in the column list, we can ignore
the end_XXX_ fields of our column_description */
for (vsize i = 0; i < cols.size (); i++)
{
for (vsize r = 0; r < cols[i].rods_.size (); r++)
- spacer.add_rod (i, cols[i].rods_[r].r_, cols[i].rods_[r].dist_);
+ spacer.add_rod (i, cols[i].rods_[r].r_, cols[i].rods_[r].dist_);
if (!cols[i].keep_inside_line_.is_empty ())
- {
- spacer.add_rod (i, cols.size (), cols[i].keep_inside_line_[RIGHT]);
- spacer.add_rod (0, i, -cols[i].keep_inside_line_[LEFT]);
- }
+ {
+ spacer.add_rod (i, cols.size (), cols[i].keep_inside_line_[RIGHT]);
+ spacer.add_rod (0, i, -cols[i].keep_inside_line_[LEFT]);
+ }
}
spacer.solve (line_len, ragged);
{
SCM p = ret.cols_[i]->get_property ("line-break-permission");
if (p == ly_symbol2scm ("force"))
- ret.satisfies_constraints_ = false;
+ ret.satisfies_constraints_ = false;
}
return ret;
}
+
+#include "ly-smobs.icc"
+
+IMPLEMENT_SIMPLE_SMOBS (Simple_spacer);
+IMPLEMENT_DEFAULT_EQUAL_P (Simple_spacer);
+
+SCM
+Simple_spacer::mark_smob (SCM /* x */)
+{
+ return SCM_EOL;
+}
+
+int
+Simple_spacer::print_smob (SCM /* x */, SCM p, scm_print_state *)
+{
+ scm_puts ("#<Simple spacer>", p);
+ return 1;
+}
+
Music_iterator *mi = unsmob_iterator (scm_iter);
/* if create_separate_contexts_ is set, create a new context with the
- number number as name */
+ number number as name */
SCM name = ly_symbol2scm (get_outlet ()->context_name ().c_str ());
Context *c = (j && create_separate_contexts_)
- ? get_outlet ()->find_create_context (name, to_string (j), SCM_EOL)
- : get_outlet ();
+ ? get_outlet ()->find_create_context (name, to_string (j), SCM_EOL)
+ : get_outlet ();
if (!c)
- c = get_outlet ();
+ c = get_outlet ();
mi->init_context (mus, c);
mi->construct_children ();
if (mi->ok ())
- {
- *tail = scm_cons (scm_iter, *tail);
- tail = SCM_CDRLOC (*tail);
- }
+ {
+ *tail = scm_cons (scm_iter, *tail);
+ tail = SCM_CDRLOC (*tail);
+ }
else
- mi->quit ();
+ mi->quit ();
}
}
{
Music_iterator *i = unsmob_iterator (scm_car (*proc));
if (i->run_always ()
- || i->pending_moment () == until)
- i->process (until);
+ || i->pending_moment () == until)
+ i->process (until);
if (!i->ok ())
- {
- i->quit ();
- *proc = scm_cdr (*proc);
- }
+ {
+ i->quit ();
+ *proc = scm_cdr (*proc);
+ }
else
- proc = SCM_CDRLOC (*proc);
+ proc = SCM_CDRLOC (*proc);
}
}
{
Music_iterator *it = unsmob_iterator (scm_car (s));
if (!it->run_always ())
- return true;
+ return true;
else
- run_always_ok = run_always_ok || it->ok ();
+ run_always_ok = run_always_ok || it->ok ();
}
return run_always_ok;
}
{
Music_iterator *it = unsmob_iterator (scm_car (s));
if (it->run_always ())
- return true;
+ return true;
}
return false;
}
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2008--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
skylines_[DOWN].print ();
}
-
bool
Skyline_pair::is_empty () const
{
return skylines_[UP].is_empty ()
- && skylines_[DOWN].is_empty ();
+ && skylines_[DOWN].is_empty ();
}
-Skyline&
+Skyline &
Skyline_pair::operator [] (Direction d)
{
return skylines_[d];
}
-Skyline const&
+Skyline const &
Skyline_pair::operator [] (Direction d) const
{
return skylines_[d];
vector<Offset> ps (to_points (X_AXIS));
for (vsize i = 0; i < ps.size (); i++)
- printf ("(%f,%f)%s" , ps[i][X_AXIS], ps[i][Y_AXIS],
- (i%2)==1 ? "\n" : " ");
+ printf ("(%f,%f)%s", ps[i][X_AXIS], ps[i][Y_AXIS],
+ (i % 2) == 1 ? "\n" : " ");
}
Building::Building (Real start, Real start_height, Real end_height, Real end)
Real
Building::height (Real x) const
{
- return isinf (x) ? y_intercept_ : slope_*x + y_intercept_;
+ return isinf (x) ? y_intercept_ : slope_ * x + y_intercept_;
}
void
{
Building c = s->front ();
if (c.conceals (b, start_x))
- return start_x;
+ return start_x;
Real i = b.intersection_x (c);
if (i > start_x && i <= b.end_ && i <= c.end_)
- return i;
+ return i;
start_x = c.end_;
if (b.end_ > c.end_)
- s->pop_front ();
+ s->pop_front ();
}
return b.end_;
}
/* their slopes were not equal, so there is an intersection point */
Real i = intersection_x (other);
return (i <= x && slope_ > other.slope_)
- || (i > x && slope_ < other.slope_);
+ || (i > x && slope_ < other.slope_);
}
void
Skyline::internal_merge_skyline (list<Building> *s1, list<Building> *s2,
- list<Building> *const result)
+ list<Building> *const result)
{
if (s1->empty () || s2->empty ())
{
while (!s1->empty ())
{
if (s2->front ().conceals (s1->front (), x))
- swap (s1, s2);
+ swap (s1, s2);
Building b = s1->front ();
Real end = first_intersection (b, s2, x);
if (s2->empty ())
- {
- result->push_front (b);
- break;
- }
+ {
+ result->push_front (b);
+ break;
+ }
/* only include buildings wider than epsilon */
if (end > x + EPS)
- {
- b.leading_part (end);
- result->push_front (b);
- }
+ {
+ b.leading_part (end);
+ result->push_front (b);
+ }
if (end >= s1->front ().end_)
- s1->pop_front ();
+ s1->pop_front ();
x = end;
}
bool sloped_neighbours = horizon_padding > 0 && !isinf (start) && !isinf (b.end_);
if (!isinf (b.end_))
ret->push_front (Building (b.end_ + horizon_padding, -infinity_f,
- -infinity_f, infinity_f));
+ -infinity_f, infinity_f));
if (sloped_neighbours)
ret->push_front (b.sloped_neighbour (start, horizon_padding, RIGHT));
if (!isinf (start))
ret->push_front (Building (-infinity_f, -infinity_f,
- -infinity_f, start - horizon_padding));
+ -infinity_f, start - horizon_padding));
}
/* remove a non-overlapping set of boxes from BOXES and build a skyline
Interval iv = (*i)[horizon_axis];
if (iv[LEFT] - horizon_padding < last_end)
- {
- i++;
- continue;
- }
+ {
+ i++;
+ continue;
+ }
if (iv[LEFT] - horizon_padding > last_end + EPS)
- result.push_front (Building (last_end, -infinity_f, -infinity_f, iv[LEFT] - 2*horizon_padding));
+ result.push_front (Building (last_end, -infinity_f, -infinity_f, iv[LEFT] - 2 * horizon_padding));
Building b (*i, horizon_padding, horizon_axis, sky);
bool sloped_neighbours = horizon_padding > 0 && !isinf (iv.length ());
if (sloped_neighbours)
- result.push_front (b.sloped_neighbour (iv[LEFT] - horizon_padding, horizon_padding, LEFT));
+ result.push_front (b.sloped_neighbour (iv[LEFT] - horizon_padding, horizon_padding, LEFT));
result.push_front (b);
if (sloped_neighbours)
- result.push_front (b.sloped_neighbour (iv[LEFT] - horizon_padding, horizon_padding, RIGHT));
+ result.push_front (b.sloped_neighbour (iv[LEFT] - horizon_padding, horizon_padding, RIGHT));
list<Box>::iterator j = i++;
boxes->erase (j);
a_ = a;
}
- bool operator() (Box const &b1, Box const &b2)
+ bool operator () (Box const &b1, Box const &b2)
{
return b1[a_][LEFT] < b2[a_][LEFT];
}
{
list<Building> result;
single_skyline (Building (boxes->front (), horizon_padding, horizon_axis, sky),
- boxes->front ()[horizon_axis][LEFT] - horizon_padding,
- horizon_padding, &result);
+ boxes->front ()[horizon_axis][LEFT] - horizon_padding,
+ horizon_padding, &result);
return result;
}
list<Building> one = partials.front ();
partials.pop_front ();
if (partials.empty ())
- return one;
+ return one;
list<Building> two = partials.front ();
partials.pop_front ();
// establish a baseline box
boxes.push_back (Box (Interval (-infinity_f, infinity_f),
- Interval (0, 0)));
+ Interval (0, 0)));
list<Building>::const_iterator end = src.buildings_.end ();
- for (list<Building>::const_iterator i = src.buildings_.begin (); i != end; start=i->end_, i++ )
+ for (list<Building>::const_iterator i = src.buildings_.begin (); i != end; start = i->end_, i++)
if ((i->slope_ == 0) && !isinf (i->y_intercept_))
boxes.push_back (Box (Interval (start, i->end_),
- Interval (-infinity_f , i->y_intercept_)));
+ Interval (-infinity_f, i->y_intercept_)));
buildings_ = internal_build_skyline (&boxes, horizon_padding, X_AXIS, UP);
sky_ = src.sky_;
}
-
/*
build skyline from a set of boxes. If horizon_padding > 0, expand all the boxes
by that amount and add 45-degree sloped boxes to the edges of each box (of
Interval iv = boxes[i][horizon_axis];
iv.widen (horizon_padding);
if (iv.length () > EPS && !boxes[i][vert_axis].is_empty ())
- filtered_boxes.push_front (boxes[i]);
+ filtered_boxes.push_front (boxes[i]);
}
buildings_ = internal_build_skyline (&filtered_boxes, horizon_padding, horizon_axis, sky);
sky_ = sky;
Building front (b, horizon_padding, horizon_axis, sky);
single_skyline (front, b[horizon_axis][LEFT] - horizon_padding,
- horizon_padding, &buildings_);
+ horizon_padding, &buildings_);
}
void
my_bld.splice (my_bld.begin (), buildings_);
single_skyline (Building (b, horizon_padding, a, sky_), b[a][LEFT] - horizon_padding,
- horizon_padding, &other_bld);
+ horizon_padding, &other_bld);
internal_merge_skyline (&other_bld, &my_bld, &buildings_);
}
Real end_dist = i->height (end) + j->height (end);
dist = max (dist, max (start_dist, end_dist));
if (i->end_ <= j->end_)
- i++;
+ i++;
else
- j++;
+ j++;
start = end;
}
return dist;
for (i = buildings_.begin (); i != buildings_.end (); i++)
{
if (i->end_ >= airplane)
- return sky_ * i->height (airplane);
+ return sky_ * i->height (airplane);
}
assert (0);
merge (s);
}
-
vector<Offset>
Skyline::to_points (Axis horizon_axis) const
{
/****************************************************************/
-
IMPLEMENT_SIMPLE_SMOBS (Skyline);
IMPLEMENT_TYPE_P (Skyline, "ly:skyline?");
IMPLEMENT_DEFAULT_EQUAL_P (Skyline);
void
Slash_repeat_engraver::listen_repeat_slash (Stream_event *ev)
{
- ASSIGN_EVENT_ONCE (slash_, ev);
+ ASSIGN_EVENT_ONCE (slash_, ev);
}
void
{
SCM count = slash_->get_property ("slash-count");
if (scm_to_int (count) == 0)
- make_item ("DoubleRepeatSlash", slash_->self_scm ());
+ make_item ("DoubleRepeatSlash", slash_->self_scm ());
else
- make_item ("RepeatSlash", slash_->self_scm ());
+ make_item ("RepeatSlash", slash_->self_scm ());
slash_ = 0;
}
}
ADD_TRANSLATOR (Slash_repeat_engraver,
- /* doc */
- "Make beat repeats.",
+ /* doc */
+ "Make beat repeats.",
- /* create */
- "DoubleRepeatSlash "
- "RepeatSlash ",
+ /* create */
+ "DoubleRepeatSlash "
+ "RepeatSlash ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "slur-configuration.hh"
-
#include "item.hh"
#include "libc-extension.hh"
#include "misc.hh"
Bezier
avoid_staff_line (Slur_score_state const &state,
- Bezier bez)
+ Bezier bez)
{
Offset horiz (1, 0);
vector<Real> ts = bez.solve_derivative (horiz);
Grob *staff = state.extremes_[LEFT].staff_;
Real p = 2 * (y - staff->relative_coordinate (state.common_[Y_AXIS], Y_AXIS))
- / state.staff_space_;
+ / state.staff_space_;
- Real distance = fabs (my_round (p) - p); // in halfspaces
+ Real distance = fabs (my_round (p) - p); // in halfspaces
if (distance < 4 * state.thickness_
- && (int) fabs (my_round (p))
- <= 2 * Staff_symbol_referencer::staff_radius (staff) + 0.1
- && (int (fabs (my_round (p))) % 2
- != Staff_symbol_referencer::line_count (staff) % 2))
- {
- Direction resolution_dir
- = (distance ? state.dir_ : Direction (sign (p - my_round (p))));
-
- // TODO: parameter
- Real newp = my_round (p) + resolution_dir
- * 5 * state.thickness_;
-
- Real dy = (newp - p) * state.staff_space_ / 2.0;
-
- bez.control_[1][Y_AXIS] += dy;
- bez.control_[2][Y_AXIS] += dy;
- }
+ && (int) fabs (my_round (p))
+ <= 2 * Staff_symbol_referencer::staff_radius (staff) + 0.1
+ && (int (fabs (my_round (p))) % 2
+ != Staff_symbol_referencer::line_count (staff) % 2))
+ {
+ Direction resolution_dir
+ = (distance ? state.dir_ : Direction (sign (p - my_round (p))));
+
+ // TODO: parameter
+ Real newp = my_round (p) + resolution_dir
+ * 5 * state.thickness_;
+
+ Real dy = (newp - p) * state.staff_space_ / 2.0;
+
+ bez.control_[1][Y_AXIS] += dy;
+ bez.control_[2][Y_AXIS] += dy;
+ }
}
return bez;
}
Real
fit_factor (Offset dz_unit, Offset dz_perp,
- Bezier curve, Direction d, vector<Offset> const &avoid)
+ Bezier curve, Direction d, vector<Offset> const &avoid)
{
Real fit_factor = 0.0;
Offset x0 = curve.control_[0];
{
Offset z = (avoid[i] - x0);
Offset p (dot_product (z, dz_unit),
- d * dot_product (z, dz_perp));
+ d * dot_product (z, dz_perp));
Real eps = 0.01;
- Interval pext = eps * Interval (-1,1) + p[X_AXIS];
+ Interval pext = eps * Interval (-1, 1) + p[X_AXIS];
pext.intersect (curve_xext);
if (pext.is_empty () || pext.length () <= 1.999 * eps)
- continue;
+ continue;
Real y = curve.get_other_coordinate (X_AXIS, p[X_AXIS]);
if (y)
- fit_factor = max (fit_factor, (p[Y_AXIS] / y));
+ fit_factor = max (fit_factor, (p[Y_AXIS] / y));
}
return fit_factor;
}
void
Slur_configuration::generate_curve (Slur_score_state const &state,
- Real r_0, Real h_inf,
- vector<Offset> const &avoid)
+ Real r_0, Real h_inf,
+ vector<Offset> const &avoid)
{
- Offset dz = attachment_[RIGHT]- attachment_[LEFT];;
+ Offset dz = attachment_[RIGHT] - attachment_[LEFT];;
Offset dz_unit = dz;
dz_unit *= 1 / dz.length ();
Offset dz_perp = dz_unit * Offset (0, 1);
Bezier curve;
curve.control_[0] = attachment_[LEFT];
curve.control_[1] = attachment_[LEFT] + dz_perp * height * state.dir_
- + dz_unit * x1;
+ + dz_unit * x1;
curve.control_[2] = attachment_[RIGHT] + dz_perp * height * state.dir_
- + dz_unit * x2;
+ + dz_unit * x2;
curve.control_[3] = attachment_[RIGHT];
Real ff = fit_factor (dz_unit, dz_perp, curve, state.dir_, avoid);
curve.control_[0] = attachment_[LEFT];
curve.control_[1] = attachment_[LEFT] + dz_perp * height * state.dir_
- + dz_unit * x1;
+ + dz_unit * x1;
curve.control_[2] = attachment_[RIGHT] + dz_perp * height * state.dir_
- + dz_unit * x2;
+ + dz_unit * x2;
curve.control_[3] = attachment_[RIGHT];
curve_ = avoid_staff_line (state, curve);
programming_error ("Negative demerits found for slur. Ignoring");
s = 0.0;
}
-
+
if (s)
{
if (score_card_.length () > 0)
- score_card_ += ", ";
+ score_card_ += ", ";
score_card_ += to_string ("%s=%.2f", desc.c_str (), s);
score_ += s;
}
bool edge = l_edge || r_edge;
if (! (x < attachment_[RIGHT][X_AXIS]
- && x > attachment_[LEFT][X_AXIS]))
- continue;
+ && x > attachment_[LEFT][X_AXIS]))
+ continue;
Real y = bez.get_other_coordinate (X_AXIS, x);
if (!edge)
- {
- Real head_dy = (y - state.encompass_infos_[j].head_);
- if (state.dir_ * head_dy < 0)
- {
- demerit += state.parameters_.head_encompass_penalty_;
- convex_head_distances.push_back (0.0);
- }
- else
- {
- Real hd = (head_dy)
- ? (1 / fabs (head_dy) - 1 / state.parameters_.free_head_distance_)
- : state.parameters_.head_encompass_penalty_;
- hd = min (max (hd, 0.0), state.parameters_.head_encompass_penalty_);
-
- demerit += hd;
- }
-
- Real line_y = linear_interpolate (x,
- attachment_[RIGHT][X_AXIS],
- attachment_[LEFT][X_AXIS],
- attachment_[RIGHT][Y_AXIS],
- attachment_[LEFT][Y_AXIS]);
-
- if (1) // state.dir_ * state.encompass_infos_[j].get_point (state.dir_) > state.dir_ *line_y )
- {
-
- Real closest
- = state.dir_ * max (state.dir_ * state.encompass_infos_[j].get_point (state.dir_), state.dir_ * line_y);
- Real d = fabs (closest - y);
-
- convex_head_distances.push_back (d);
- }
- }
+ {
+ Real head_dy = (y - state.encompass_infos_[j].head_);
+ if (state.dir_ * head_dy < 0)
+ {
+ demerit += state.parameters_.head_encompass_penalty_;
+ convex_head_distances.push_back (0.0);
+ }
+ else
+ {
+ Real hd = (head_dy)
+ ? (1 / fabs (head_dy) - 1 / state.parameters_.free_head_distance_)
+ : state.parameters_.head_encompass_penalty_;
+ hd = min (max (hd, 0.0), state.parameters_.head_encompass_penalty_);
+
+ demerit += hd;
+ }
+
+ Real line_y = linear_interpolate (x,
+ attachment_[RIGHT][X_AXIS],
+ attachment_[LEFT][X_AXIS],
+ attachment_[RIGHT][Y_AXIS],
+ attachment_[LEFT][Y_AXIS]);
+
+ if (1) // state.dir_ * state.encompass_infos_[j].get_point (state.dir_) > state.dir_ *line_y )
+ {
+
+ Real closest
+ = state.dir_ * max (state.dir_ * state.encompass_infos_[j].get_point (state.dir_), state.dir_ * line_y);
+ Real d = fabs (closest - y);
+
+ convex_head_distances.push_back (d);
+ }
+ }
if (state.dir_ * (y - state.encompass_infos_[j].stem_) < 0)
- {
- Real stem_dem = state.parameters_.stem_encompass_penalty_;
- if ((l_edge && state.dir_ == UP)
- || (r_edge && state.dir_ == DOWN))
- stem_dem /= 5;
-
- demerit += stem_dem;
- }
+ {
+ Real stem_dem = state.parameters_.stem_encompass_penalty_;
+ if ((l_edge && state.dir_ == UP)
+ || (r_edge && state.dir_ == DOWN))
+ stem_dem /= 5;
+
+ demerit += stem_dem;
+ }
else if (!edge)
- {
- Interval ext;
- ext.add_point (state.encompass_infos_[j].stem_);
- ext.add_point (state.encompass_infos_[j].head_);
-
- // ?
- demerit += -state.parameters_.closeness_factor_
- * min (state.dir_
- * (y - (ext[state.dir_] + state.dir_ * state.parameters_.free_head_distance_)), 0.0)
- / state.encompass_infos_.size ();
- }
+ {
+ Interval ext;
+ ext.add_point (state.encompass_infos_[j].stem_);
+ ext.add_point (state.encompass_infos_[j].head_);
+
+ // ?
+ demerit += -state.parameters_.closeness_factor_
+ * min (state.dir_
+ * (y - (ext[state.dir_] + state.dir_ * state.parameters_.free_head_distance_)), 0.0)
+ / state.encompass_infos_.size ();
+ }
}
add_score (demerit, "encompass");
-
+
if (convex_head_distances.size ())
{
Real avg_distance = 0.0;
Real min_dist = infinity_f;
for (vsize j = 0; j < convex_head_distances.size (); j++)
- {
- min_dist = min (min_dist, convex_head_distances[j]);
- avg_distance += convex_head_distances[j];
- }
+ {
+ min_dist = min (min_dist, convex_head_distances[j]);
+ avg_distance += convex_head_distances[j];
+ }
/*
- For slurs over 3 or 4 heads, the average distance is not a
- good normalizer.
+ For slurs over 3 or 4 heads, the average distance is not a
+ good normalizer.
*/
Real n = convex_head_distances.size ();
if (n <= 2)
- {
- Real fact = 1.0;
- avg_distance += height_ * fact;
- n += fact;
- }
+ {
+ Real fact = 1.0;
+ avg_distance += height_ * fact;
+ n += fact;
+ }
/*
- TODO: maybe it's better to use (avgdist - mindist)*factor
- as penalty.
+ TODO: maybe it's better to use (avgdist - mindist)*factor
+ as penalty.
*/
avg_distance /= n;
Real variance_penalty = state.parameters_.head_slur_distance_max_ratio_;
if (min_dist > 0.0)
- variance_penalty
- = min ((avg_distance / (min_dist + state.parameters_.absolute_closeness_measure_) - 1.0), variance_penalty);
+ variance_penalty
+ = min ((avg_distance / (min_dist + state.parameters_.absolute_closeness_measure_) - 1.0), variance_penalty);
variance_penalty = max (variance_penalty, 0.0);
variance_penalty *= state.parameters_.head_slur_distance_factor_;
{
Drul_array<Offset> attachment = attachment_;
Extra_collision_info const &info (state.extra_encompass_infos_[j]);
-
+
Interval slur_wid (attachment[LEFT][X_AXIS], attachment[RIGHT][X_AXIS]);
/*
- to prevent numerical inaccuracies in
- Bezier::get_other_coordinate ().
+ to prevent numerical inaccuracies in
+ Bezier::get_other_coordinate ().
*/
Direction d = LEFT;
bool found = false;
Real y = 0.0;
do
- {
- /*
- We need to check for the bound explicitly, since the
- slur-ending can be almost vertical, making the Y
- coordinate a bad approximation of the object-slur
- distance.
- */
- Item *as_item = dynamic_cast<Item *> (state.extra_encompass_infos_[j].grob_);
- if (!as_item)
- continue;
-
- Interval item_x = as_item->extent (state.common_[X_AXIS], X_AXIS);
- item_x.intersect (state.extremes_[d].slur_head_x_extent_);
- if (!item_x.is_empty ())
- {
- y = attachment[d][Y_AXIS];
- found = true;
- }
-
- }
+ {
+ /*
+ We need to check for the bound explicitly, since the
+ slur-ending can be almost vertical, making the Y
+ coordinate a bad approximation of the object-slur
+ distance.
+ */
+ Item *as_item = dynamic_cast<Item *> (state.extra_encompass_infos_[j].grob_);
+ if (!as_item)
+ continue;
+
+ Interval item_x = as_item->extent (state.common_[X_AXIS], X_AXIS);
+ item_x.intersect (state.extremes_[d].slur_head_x_extent_);
+ if (!item_x.is_empty ())
+ {
+ y = attachment[d][Y_AXIS];
+ found = true;
+ }
+
+ }
while (flip (&d) != LEFT);
if (!found)
- {
- Real x = info.extents_[X_AXIS].linear_combination (info.idx_);
+ {
+ Real x = info.extents_[X_AXIS].linear_combination (info.idx_);
- if (!slur_wid.contains (x))
- continue;
+ if (!slur_wid.contains (x))
+ continue;
- y = curve_.get_other_coordinate (X_AXIS, x);
- }
+ y = curve_.get_other_coordinate (X_AXIS, x);
+ }
Real dist = 0.0;
if (info.type_ == ly_symbol2scm ("around"))
- dist = info.extents_[Y_AXIS].distance (y);
+ dist = info.extents_[Y_AXIS].distance (y);
/*
- Have to score too: the curve enumeration is limited in its
- shape, and may produce curves which collide anyway.
+ Have to score too: the curve enumeration is limited in its
+ shape, and may produce curves which collide anyway.
*/
else if (info.type_ == ly_symbol2scm ("inside"))
- dist = state.dir_ * (y - info.extents_[Y_AXIS][state.dir_]);
+ dist = state.dir_ * (y - info.extents_[Y_AXIS][state.dir_]);
else
- programming_error ("unknown avoidance type");
+ programming_error ("unknown avoidance type");
dist = max (dist, 0.0);
-
+
Real penalty = info.penalty_ * peak_around (0.1 * state.parameters_.extra_encompass_free_distance_,
- state.parameters_.extra_encompass_free_distance_,
- dist);
-
+ state.parameters_.extra_encompass_free_distance_,
+ dist);
+
add_score (penalty, "extra");
}
}
{
Direction d = LEFT;
Offset dz = attachment_[RIGHT]
- - attachment_[LEFT];
+ - attachment_[LEFT];
Real slope = dz[Y_AXIS] / dz[X_AXIS];
do
{
Real factor = state.parameters_.edge_attraction_factor_;
Real demerit = factor * dy;
if (state.extremes_[d].stem_
- && state.extremes_[d].stem_dir_ == state.dir_
+ && state.extremes_[d].stem_dir_ == state.dir_
// TODO - Stem::get_beaming() should be precomputed.
- && !Stem::get_beaming (state.extremes_[d].stem_, -d))
- demerit /= 5;
+ && !Stem::get_beaming (state.extremes_[d].stem_, -d))
+ demerit /= 5;
demerit *= exp (state.dir_ * d * slope
- * state.parameters_.edge_slope_exponent_);
-
+ * state.parameters_.edge_slope_exponent_);
string dir_str = d == LEFT ? "L" : "R";
add_score (demerit, dir_str + " edge");
Real demerit = 0.0;
demerit += max ((fabs (slur_dy / slur_dz[X_AXIS])
- - state.parameters_.max_slope_), 0.0)
- * state.parameters_.max_slope_factor_;
+ - state.parameters_.max_slope_), 0.0)
+ * state.parameters_.max_slope_factor_;
/* 0.2: account for staffline offset. */
Real max_dy = (fabs (dy) + 0.2);
if (!state.is_broken_)
demerit += state.parameters_.steeper_slope_factor_
- * (max (fabs (slur_dy) -max_dy, 0.0));
+ * (max (fabs (slur_dy) - max_dy, 0.0));
demerit += max ((fabs (slur_dy / slur_dz[X_AXIS])
- - state.parameters_.max_slope_), 0.0)
- * state.parameters_.max_slope_factor_;
+ - state.parameters_.max_slope_), 0.0)
+ * state.parameters_.max_slope_factor_;
if (sign (dy) == 0
&& sign (slur_dy) != 0
&& sign (slur_dy)
&& sign (slur_dy) != sign (dy))
demerit += state.edge_has_beams_
- ? state.parameters_.same_slope_penalty_ / 10
- : state.parameters_.same_slope_penalty_;
+ ? state.parameters_.same_slope_penalty_ / 10
+ : state.parameters_.same_slope_penalty_;
add_score (demerit, "slope");
}
-
// This is a temporary hack to see how much we can gain by using a
// priority queue on the beams to score.
static int score_count = 0;
LY_DEFINE (ly_slur_score_count, "ly:slur-score-count", 0, 0, 0,
- (),
- "count number of slur scores.") {
+ (),
+ "count number of slur scores.")
+{
return scm_from_int (score_count);
}
void
Slur_configuration::run_next_scorer (Slur_score_state const &state)
{
- switch (next_scorer_todo) {
- case EXTRA_ENCOMPASS:
- score_extra_encompass (state);
- break;
- case SLOPE:
- score_slopes (state);
- break;
- case EDGES:
- score_edges (state);
- break;
- case ENCOMPASS:
- score_encompass (state);
- break;
- default:
- assert (false);
- }
+ switch (next_scorer_todo)
+ {
+ case EXTRA_ENCOMPASS:
+ score_extra_encompass (state);
+ break;
+ case SLOPE:
+ score_slopes (state);
+ break;
+ case EDGES:
+ score_edges (state);
+ break;
+ case ENCOMPASS:
+ score_encompass (state);
+ break;
+ default:
+ assert (false);
+ }
next_scorer_todo++;
score_count++;
}
#include "translator.icc"
-
/*
NOTE NOTE NOTE
apply there too.
(on principle, engravers don't use inheritance for code sharing)
-
+
*/
/*
{
vector<Stream_event *> start_events_;
vector<Stream_event *> stop_events_;
- vector<Grob*> slurs_;
- vector<Grob*> end_slurs_;
+ vector<Grob *> slurs_;
+ vector<Grob *> end_slurs_;
void set_melisma (bool);
virtual void finalize ();
-
public:
TRANSLATOR_DECLARATIONS (Slur_engraver);
};
{
Direction d = to_dir (ev->get_property ("span-direction"));
if (d == START)
- start_events_.push_back(ev);
+ start_events_.push_back (ev);
else if (d == STOP)
- stop_events_.push_back(ev);
+ stop_events_.push_back (ev);
else ev->origin ()->warning (_f ("direction of %s invalid: %d",
- "slur-event", int (d)));
+ "slur-event", int (d)));
}
void
// Check if we already have a slur with the same spanner-id.
// In that case, don't create a new slur, but print a warning
for (vsize j = 0; j < slurs_.size (); j++)
- have_slur = have_slur || (id == robust_scm2string (slurs_[j]->get_property ("spanner-id"), ""));
-
+ have_slur = have_slur || (id == robust_scm2string (slurs_[j]->get_property ("spanner-id"), ""));
+
if (have_slur)
{
// We already have a slur, so give a warning and completely ignore
// the new slur.
- ev->origin ()->warning(_ ("already have slur"));
+ ev->origin ()->warning (_ ("already have slur"));
start_events_.erase (start_events_.begin () + i);
}
- else
+ else
{
Grob *slur = make_spanner ("Slur", ev->self_scm ());
Direction updown = to_dir (ev->get_property ("direction"));
if (Grob *g = unsmob_grob (get_property ("currentCommandColumn")))
{
for (vsize i = 0; i < end_slurs_.size (); i++)
- Slur::add_extra_encompass (end_slurs_[i], g);
+ Slur::add_extra_encompass (end_slurs_[i], g);
if (!start_events_.size ())
- for (vsize i = 0; i < slurs_.size (); i++)
- Slur::add_extra_encompass (slurs_[i], g);
+ for (vsize i = 0; i < slurs_.size (); i++)
+ Slur::add_extra_encompass (slurs_[i], g);
}
-
-
+
for (vsize i = 0; i < end_slurs_.size (); i++)
{
- Spanner * s = dynamic_cast<Spanner*> (end_slurs_[i]);
+ Spanner *s = dynamic_cast<Spanner *> (end_slurs_[i]);
if (!s->get_bound (RIGHT))
- s->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn")));
+ s->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn")));
announce_end_grob (s, SCM_EOL);
}
end_slurs_.clear ();
ADD_ACKNOWLEDGER (Slur_engraver, tie);
ADD_ACKNOWLEDGER (Slur_engraver, tuplet_number);
ADD_TRANSLATOR (Slur_engraver,
- /* doc */
- "Build slur grobs from slur events.",
+ /* doc */
+ "Build slur grobs from slur events.",
- /* create */
- "Slur ",
+ /* create */
+ "Slur ",
- /* read */
- "slurMelismaBusy "
- "doubleSlurs ",
+ /* read */
+ "slurMelismaBusy "
+ "doubleSlurs ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
void start_translation_timestep ();
void process_music ();
void set_melisma (bool);
-
+
DECLARE_TRANSLATOR_LISTENER (slur);
private:
Stream_event *start_ev_;
}
ADD_TRANSLATOR (Slur_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "slur-score-parameters.hh"
#include "grob.hh"
-
Real
get_detail (SCM alist, SCM sym)
{
SCM entry = scm_assq (sym, alist);
return robust_scm2double (scm_is_pair (entry)
- ? scm_cdr (entry)
- : SCM_EOL,
- 0.0);
+ ? scm_cdr (entry)
+ : SCM_EOL,
+ 0.0);
}
void
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "slur-scoring.hh"
#include <queue>
programming_error ("no stem for note column");
ei.x_ = col->relative_coordinate (common_[X_AXIS], X_AXIS);
ei.head_ = ei.stem_ = col->extent (common_[Y_AXIS],
- Y_AXIS)[dir_];
+ Y_AXIS)[dir_];
return ei;
}
Direction stem_dir = get_grob_direction (stem);
{
ei.stem_ = stem->extent (common_[Y_AXIS], Y_AXIS)[dir_];
if (Grob *b = Stem::get_beam (stem))
- ei.stem_ += stem_dir * 0.5 * Beam::get_beam_thickness (b);
+ ei.stem_ += stem_dir * 0.5 * Beam::get_beam_thickness (b);
Interval x = stem->extent (common_[X_AXIS], X_AXIS);
ei.x_ = x.is_empty ()
- ? stem->relative_coordinate (common_[X_AXIS], X_AXIS)
- : x.center ();
+ ? stem->relative_coordinate (common_[X_AXIS], X_AXIS)
+ : x.center ();
}
else
ei.stem_ = ei.head_;
{
extremes[d].bound_ = slur_->get_bound (d);
if (Note_column::has_interface (extremes[d].bound_))
- {
- extremes[d].note_column_ = extremes[d].bound_;
- extremes[d].stem_ = Note_column::get_stem (extremes[d].note_column_);
- if (extremes[d].stem_)
- {
- extremes[d].stem_dir_ = get_grob_direction (extremes[d].stem_);
-
- for (int a = X_AXIS; a < NO_AXES; a++)
- {
- Axis ax = Axis (a);
- Interval s = extremes[d].stem_->extent (common_[ax], ax);
- if (s.is_empty ())
- {
- /*
- do not issue warning. This happens for rests and
- whole notes.
- */
- s = Interval (0, 0)
- + extremes[d].stem_->relative_coordinate (common_[ax], ax);
- }
- extremes[d].stem_extent_[ax] = s;
- }
-
- extremes[d].slur_head_
- = Stem::extremal_heads (extremes[d].stem_)[dir];
- if (!extremes[d].slur_head_
- && Note_column::has_rests (extremes[d].bound_))
- extremes[d].slur_head_ = Note_column::get_rest (extremes[d].bound_);
- extremes[d].staff_ = Staff_symbol_referencer
- ::get_staff_symbol (extremes[d].stem_);
- extremes[d].staff_space_ = Staff_symbol_referencer
- ::staff_space (extremes[d].stem_);
- }
-
- if (extremes[d].slur_head_)
- extremes[d].slur_head_x_extent_
- = extremes[d].slur_head_->extent (common_[X_AXIS], X_AXIS);
-
- }
+ {
+ extremes[d].note_column_ = extremes[d].bound_;
+ extremes[d].stem_ = Note_column::get_stem (extremes[d].note_column_);
+ if (extremes[d].stem_)
+ {
+ extremes[d].stem_dir_ = get_grob_direction (extremes[d].stem_);
+
+ for (int a = X_AXIS; a < NO_AXES; a++)
+ {
+ Axis ax = Axis (a);
+ Interval s = extremes[d].stem_->extent (common_[ax], ax);
+ if (s.is_empty ())
+ {
+ /*
+ do not issue warning. This happens for rests and
+ whole notes.
+ */
+ s = Interval (0, 0)
+ + extremes[d].stem_->relative_coordinate (common_[ax], ax);
+ }
+ extremes[d].stem_extent_[ax] = s;
+ }
+
+ extremes[d].slur_head_
+ = Stem::extremal_heads (extremes[d].stem_)[dir];
+ if (!extremes[d].slur_head_
+ && Note_column::has_rests (extremes[d].bound_))
+ extremes[d].slur_head_ = Note_column::get_rest (extremes[d].bound_);
+ extremes[d].staff_ = Staff_symbol_referencer
+ ::get_staff_symbol (extremes[d].stem_);
+ extremes[d].staff_space_ = Staff_symbol_referencer
+ ::staff_space (extremes[d].stem_);
+ }
+
+ if (extremes[d].slur_head_)
+ extremes[d].slur_head_x_extent_
+ = extremes[d].slur_head_->extent (common_[X_AXIS], X_AXIS);
+
+ }
}
while (flip (&d) != LEFT);
slur_ = dynamic_cast<Spanner *> (me);
columns_
= internal_extract_grob_array (me, ly_symbol2scm ("note-columns"));
-
+
if (columns_.empty ())
{
me->suicide ();
Direction d = LEFT;
do
- {
- /*
- If bound is not in note-columns, we don't want to know about
- its Y-position
- */
- if (a != Y_AXIS)
- common_[a] = common_[a]->common_refpoint (sp->get_bound (d), a);
- }
+ {
+ /*
+ If bound is not in note-columns, we don't want to know about
+ its Y-position
+ */
+ if (a != Y_AXIS)
+ common_[a] = common_[a]->common_refpoint (sp->get_bound (d), a);
+ }
while (flip (&d) != LEFT);
}
extremes_ = get_bound_info ();
is_broken_ = (!extremes_[LEFT].note_column_
- || !extremes_[RIGHT].note_column_);
+ || !extremes_[RIGHT].note_column_);
has_same_beam_
= (extremes_[LEFT].stem_ && extremes_[RIGHT].stem_
do
{
if (!is_broken_
- && extremes_[d].slur_head_)
- musical_dy_ += d
- * extremes_[d].slur_head_->relative_coordinate (common_[Y_AXIS], Y_AXIS);
+ && extremes_[d].slur_head_)
+ musical_dy_ += d
+ * extremes_[d].slur_head_->relative_coordinate (common_[Y_AXIS], Y_AXIS);
}
while (flip (&d) != LEFT);
edge_has_beams_
= (extremes_[LEFT].stem_ && Stem::get_beam (extremes_[LEFT].stem_))
- || (extremes_[RIGHT].stem_ && Stem::get_beam (extremes_[RIGHT].stem_));
+ || (extremes_[RIGHT].stem_ && Stem::get_beam (extremes_[RIGHT].stem_));
if (is_broken_)
musical_dy_ = 0.0;
}
-
MAKE_SCHEME_CALLBACK (Slur, calc_control_points, 1)
SCM
Slur::calc_control_points (SCM smob)
SCM end_ys = me->get_property ("positions");
SCM inspect_quants = me->get_property ("inspect-quants");
bool debug_slurs = to_boolean (me->layout ()
- ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")));
+ ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")));
if (is_number_pair (inspect_quants))
{
debug_slurs = true;
end_ys = inspect_quants;
}
-
+
Slur_configuration *best = NULL;
if (is_number_pair (end_ys))
- best = state.get_forced_configuration (ly_scm2interval(end_ys));
+ best = state.get_forced_configuration (ly_scm2interval (end_ys));
else
best = state.get_best_curve ();
if (debug_slurs)
{
string total = best->card ();
- total += to_string (" TOTAL=%.2f idx=%d", best->score (), best->index_);
+ total += to_string (" TOTAL=%.2f idx=%d", best->score (), best->index_);
me->set_property ("annotation", ly_string2scm (total));
}
#endif
-
+
SCM controls = SCM_EOL;
for (int i = 4; i--;)
{
Offset o = best->curve_.control_[i]
- - Offset (me->relative_coordinate (state.common_[X_AXIS], X_AXIS),
- me->relative_coordinate (state.common_[Y_AXIS], Y_AXIS));
+ - Offset (me->relative_coordinate (state.common_[X_AXIS], X_AXIS),
+ me->relative_coordinate (state.common_[Y_AXIS], Y_AXIS));
controls = scm_cons (ly_offset2scm (o), controls);
}
return controls;
}
-Slur_configuration*
+Slur_configuration *
Slur_score_state::get_forced_configuration (Interval ys) const
{
Slur_configuration *best = NULL;
for (vsize i = 0; i < configurations_.size (); i++)
{
Real d = fabs (configurations_[i]->attachment_[LEFT][Y_AXIS] - ys[LEFT])
- + fabs (configurations_[i]->attachment_[RIGHT][Y_AXIS] - ys[RIGHT]);
+ + fabs (configurations_[i]->attachment_[RIGHT][Y_AXIS] - ys[RIGHT]);
if (d < mindist)
- {
- best = configurations_[i];
- mindist = d;
- }
+ {
+ best = configurations_[i];
+ mindist = d;
+ }
}
while (!best->done ())
best->run_next_scorer (*this);
-
+
if (mindist > 1e5)
programming_error ("cannot find quant");
return best;
}
-
Slur_configuration *
Slur_score_state::get_best_curve () const
{
- std::priority_queue<Slur_configuration*, std::vector<Slur_configuration*>,
- Slur_configuration_less> queue;
+ std::priority_queue < Slur_configuration *, std::vector<Slur_configuration *>,
+ Slur_configuration_less > queue;
for (vsize i = 0; i < configurations_.size (); i++)
queue.push (configurations_[i]);
Slur_configuration *best = NULL;
- while (true) {
- best = queue.top ();
- if (best->done ())
- break;
-
- queue.pop ();
- best->run_next_scorer (*this);
- queue.push (best);
- }
+ while (true)
+ {
+ best = queue.top ();
+ if (best->done ())
+ break;
+
+ queue.pop ();
+ best->run_next_scorer (*this);
+ queue.push (best);
+ }
return best;
}
for (vsize i = 0; i < extra_encompasses.size (); i++)
{
- Item *item = dynamic_cast<Item*> (extra_encompasses[i]);
+ Item *item = dynamic_cast<Item *> (extra_encompasses[i]);
if (item && col == item->get_column ())
- return item;
+ return item;
}
return 0;
do
{
if (extremes_[d].note_column_)
- {
- end_ys[d] = dir_
- * max (max (dir_ * (base_attachments_[d][Y_AXIS]
- + parameters_.region_size_ * dir_),
- dir_ * (dir_ + extremes_[d].note_column_->extent (common_[Y_AXIS], Y_AXIS)[dir_])),
- dir_ * base_attachments_[-d][Y_AXIS]);
- }
+ {
+ end_ys[d] = dir_
+ * max (max (dir_ * (base_attachments_[d][Y_AXIS]
+ + parameters_.region_size_ * dir_),
+ dir_ * (dir_ + extremes_[d].note_column_->extent (common_[Y_AXIS], Y_AXIS)[dir_])),
+ dir_ * base_attachments_[-d][Y_AXIS]);
+ }
else
- end_ys[d] = base_attachments_[d][Y_AXIS] + parameters_.region_size_ * dir_;
+ end_ys[d] = base_attachments_[d][Y_AXIS] + parameters_.region_size_ * dir_;
}
while (flip (&d) != LEFT);
while (flip (&d) != LEFT);
return b2[LEFT] <= b1[LEFT] && b2[RIGHT] >= b1[RIGHT]
- && (b2[LEFT] != b1[LEFT] || b2[RIGHT] != b1[RIGHT]);
+ && (b2[LEFT] != b1[LEFT] || b2[RIGHT] != b1[RIGHT]);
}
Drul_array<Offset>
Real x = 0.0;
Real y = 0.0;
if (extremes_[d].note_column_)
- {
-
- /*
- fixme: X coord should also be set in this case.
- */
- if (stem
- && !Stem::is_invisible (stem)
- && extremes_[d].stem_dir_ == dir_
- && Stem::get_beaming (stem, -d)
- && Stem::get_beam (stem)
- && (!spanner_less (slur_, Stem::get_beam (stem))
- || has_same_beam_))
- y = extremes_[d].stem_extent_[Y_AXIS][dir_];
- else if (head)
- y = head->extent (common_[Y_AXIS], Y_AXIS)[dir_];
- y += dir_ * 0.5 * staff_space_;
-
- y = move_away_from_staffline (y, head);
-
- Grob *fh = Note_column::first_head (extremes_[d].note_column_);
- x
- = (fh ? fh->extent (common_[X_AXIS], X_AXIS)
- : extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS))
- .linear_combination (CENTER);
- }
+ {
+
+ /*
+ fixme: X coord should also be set in this case.
+ */
+ if (stem
+ && !Stem::is_invisible (stem)
+ && extremes_[d].stem_dir_ == dir_
+ && Stem::get_beaming (stem, -d)
+ && Stem::get_beam (stem)
+ && (!spanner_less (slur_, Stem::get_beam (stem))
+ || has_same_beam_))
+ y = extremes_[d].stem_extent_[Y_AXIS][dir_];
+ else if (head)
+ y = head->extent (common_[Y_AXIS], Y_AXIS)[dir_];
+ y += dir_ * 0.5 * staff_space_;
+
+ y = move_away_from_staffline (y, head);
+
+ Grob *fh = Note_column::first_head (extremes_[d].note_column_);
+ x
+ = (fh ? fh->extent (common_[X_AXIS], X_AXIS)
+ : extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS))
+ .linear_combination (CENTER);
+ }
base_attachment[d] = Offset (x, y);
}
while (flip (&d) != LEFT);
do
{
if (!extremes_[d].note_column_)
- {
- Real x = 0;
- Real y = 0;
-
- if (Grob *g = breakable_bound_item (d))
- {
- x = robust_relative_extent (g, common_[X_AXIS], X_AXIS)[RIGHT];
- }
- else if (d == RIGHT)
- x = robust_relative_extent (extremes_[d].bound_, common_[X_AXIS], X_AXIS)[d];
- else
- x = slur_->get_broken_left_end_align ();
-
- Grob *col = (d == LEFT) ? columns_[0] : columns_.back ();
-
- if (extremes_[-d].bound_ != col)
- {
- y = robust_relative_extent (col, common_[Y_AXIS], Y_AXIS)[dir_];
- y += dir_ * 0.5 * staff_space_;
-
- if (get_grob_direction (col) == dir_
- && Note_column::get_stem (col)
- && !Stem::is_invisible (Note_column::get_stem (col)))
- y -= dir_ * 1.5 * staff_space_;
- }
- else
- y = base_attachment[-d][Y_AXIS];
-
- y = move_away_from_staffline (y, col);
-
- base_attachment[d] = Offset (x, y);
- }
+ {
+ Real x = 0;
+ Real y = 0;
+
+ if (Grob *g = breakable_bound_item (d))
+ {
+ x = robust_relative_extent (g, common_[X_AXIS], X_AXIS)[RIGHT];
+ }
+ else if (d == RIGHT)
+ x = robust_relative_extent (extremes_[d].bound_, common_[X_AXIS], X_AXIS)[d];
+ else
+ x = slur_->get_broken_left_end_align ();
+
+ Grob *col = (d == LEFT) ? columns_[0] : columns_.back ();
+
+ if (extremes_[-d].bound_ != col)
+ {
+ y = robust_relative_extent (col, common_[Y_AXIS], Y_AXIS)[dir_];
+ y += dir_ * 0.5 * staff_space_;
+
+ if (get_grob_direction (col) == dir_
+ && Note_column::get_stem (col)
+ && !Stem::is_invisible (Note_column::get_stem (col)))
+ y -= dir_ * 1.5 * staff_space_;
+ }
+ else
+ y = base_attachment[-d][Y_AXIS];
+
+ y = move_away_from_staffline (y, col);
+
+ base_attachment[d] = Offset (x, y);
+ }
}
while (flip (&d) != LEFT);
do
{
for (int a = X_AXIS; a < NO_AXES; a++)
- {
- Real &b = base_attachment[d][Axis (a)];
-
- if (isinf (b) || isnan (b))
- {
- programming_error ("slur attachment is inf/nan");
- b = 0.0;
- }
- }
+ {
+ Real &b = base_attachment[d][Axis (a)];
+
+ if (isinf (b) || isnan (b))
+ {
+ programming_error ("slur attachment is inf/nan");
+ b = 0.0;
+ }
+ }
}
while (flip (&d) != LEFT);
Real
Slur_score_state::move_away_from_staffline (Real y,
- Grob *on_staff) const
+ Grob *on_staff) const
{
if (!on_staff)
return y;
-
+
Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (on_staff);
if (!staff_symbol)
return y;
Real pos
= (y - staff_symbol->relative_coordinate (common_[Y_AXIS],
- Y_AXIS))
- * 2.0 / staff_space_;
+ Y_AXIS))
+ * 2.0 / staff_space_;
if (fabs (pos - my_round (pos)) < 0.2
&& Staff_symbol_referencer::on_line (on_staff, (int) rint (pos))
Slur_score_state::generate_avoid_offsets () const
{
vector<Offset> avoid;
- vector<Grob*> encompasses = columns_;
+ vector<Grob *> encompasses = columns_;
for (vsize i = 0; i < encompasses.size (); i++)
{
if (extremes_[LEFT].note_column_ == encompasses[i]
- || extremes_[RIGHT].note_column_ == encompasses[i])
- continue;
+ || extremes_[RIGHT].note_column_ == encompasses[i])
+ continue;
Encompass_info inf (get_encompass_info (encompasses[i]));
Real y = dir_ * (max (dir_ * inf.head_, dir_ * inf.stem_));
for (vsize i = 0; i < extra_encompasses.size (); i++)
{
if (Slur::has_interface (extra_encompasses[i]))
- {
- Grob *small_slur = extra_encompasses[i];
- Bezier b = Slur::get_curve (small_slur);
+ {
+ Grob *small_slur = extra_encompasses[i];
+ Bezier b = Slur::get_curve (small_slur);
- Offset z = b.curve_point (0.5);
- z += Offset (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS),
- small_slur->relative_coordinate (common_[Y_AXIS], Y_AXIS));
+ Offset z = b.curve_point (0.5);
+ z += Offset (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS),
+ small_slur->relative_coordinate (common_[Y_AXIS], Y_AXIS));
- z[Y_AXIS] += dir_ * parameters_.free_slur_distance_;
- avoid.push_back (z);
- }
+ z[Y_AXIS] += dir_ * parameters_.free_slur_distance_;
+ avoid.push_back (z);
+ }
else if (extra_encompasses[i]->get_property ("avoid-slur") == ly_symbol2scm ("inside"))
- {
- Grob *g = extra_encompasses [i];
- Interval xe = g->extent (common_[X_AXIS], X_AXIS);
- Interval ye = g->extent (common_[Y_AXIS], Y_AXIS);
-
- if (!xe.is_empty ()
- && !ye.is_empty ())
- avoid.push_back (Offset (xe.center (), ye[dir_]));
- }
- }
+ {
+ Grob *g = extra_encompasses [i];
+ Interval xe = g->extent (common_[X_AXIS], X_AXIS);
+ Interval ye = g->extent (common_[Y_AXIS], Y_AXIS);
+
+ if (!xe.is_empty ()
+ && !ye.is_empty ())
+ avoid.push_back (Offset (xe.center (), ye[dir_]));
+ }
+ }
return avoid;
}
configurations_[i]->generate_curve (*this, r_0, h_inf, avoid);
}
-vector<Slur_configuration*>
+vector<Slur_configuration *>
Slur_score_state::enumerate_attachments (Drul_array<Real> end_ys) const
{
- vector<Slur_configuration*> scores;
+ vector<Slur_configuration *> scores;
Drul_array<Offset> os;
os[LEFT] = base_attachments_[LEFT];
Real minimum_length = staff_space_
- * robust_scm2double (slur_->get_property ("minimum-length"), 2.0);
+ * robust_scm2double (slur_->get_property ("minimum-length"), 2.0);
for (int i = 0; dir_ * os[LEFT][Y_AXIS] <= dir_ * end_ys[LEFT]; i++)
{
os[RIGHT] = base_attachments_[RIGHT];
for (int j = 0; dir_ * os[RIGHT][Y_AXIS] <= dir_ * end_ys[RIGHT]; j++)
- {
- Direction d = LEFT;
- Drul_array<bool> attach_to_stem (false, false);
- do
- {
- os[d][X_AXIS] = base_attachments_[d][X_AXIS];
- if (extremes_[d].stem_
- && !Stem::is_invisible (extremes_[d].stem_)
- && extremes_[d].stem_dir_ == dir_)
- {
- Interval stem_y = extremes_[d].stem_extent_[Y_AXIS];
- stem_y.widen (0.25 * staff_space_);
- if (stem_y.contains (os[d][Y_AXIS]))
- {
- os[d][X_AXIS] = extremes_[d].stem_extent_[X_AXIS][-d]
- - d * 0.3;
- attach_to_stem[d] = true;
- }
- else if (dir_ * extremes_[d].stem_extent_[Y_AXIS][dir_]
- < dir_ * os[d][Y_AXIS]
- && !extremes_[d].stem_extent_[X_AXIS].is_empty ())
-
- os[d][X_AXIS] = extremes_[d].stem_extent_[X_AXIS].center ();
- }
- }
- while (flip (&d) != LEFT);
-
- Offset dz;
- dz = os[RIGHT] - os[LEFT];
- if (dz[X_AXIS] < minimum_length
- || fabs (dz[Y_AXIS] / dz[X_AXIS]) > parameters_.max_slope_)
- {
- do
- {
- if (extremes_[d].slur_head_
- && !extremes_[d].slur_head_x_extent_.is_empty ())
- {
- os[d][X_AXIS] = extremes_[d].slur_head_x_extent_.center ();
- attach_to_stem[d] = false;
- }
- }
- while (flip (&d) != LEFT);
- }
-
- dz = os[RIGHT] - os[LEFT];
- do
- {
- if (extremes_[d].slur_head_
- && !attach_to_stem[d])
- {
- /* Horizontally move tilted slurs a little. Move
- more for bigger tilts.
-
- TODO: parameter */
- os[d][X_AXIS]
- -= dir_ * extremes_[d].slur_head_x_extent_.length ()
- * sin (dz.arg ()) / 3;
- }
- }
- while (flip (&d) != LEFT);
-
- scores.push_back (Slur_configuration::new_config (os, scores.size ()));
-
- os[RIGHT][Y_AXIS] += dir_ * staff_space_ / 2;
- }
+ {
+ Direction d = LEFT;
+ Drul_array<bool> attach_to_stem (false, false);
+ do
+ {
+ os[d][X_AXIS] = base_attachments_[d][X_AXIS];
+ if (extremes_[d].stem_
+ && !Stem::is_invisible (extremes_[d].stem_)
+ && extremes_[d].stem_dir_ == dir_)
+ {
+ Interval stem_y = extremes_[d].stem_extent_[Y_AXIS];
+ stem_y.widen (0.25 * staff_space_);
+ if (stem_y.contains (os[d][Y_AXIS]))
+ {
+ os[d][X_AXIS] = extremes_[d].stem_extent_[X_AXIS][-d]
+ - d * 0.3;
+ attach_to_stem[d] = true;
+ }
+ else if (dir_ * extremes_[d].stem_extent_[Y_AXIS][dir_]
+ < dir_ * os[d][Y_AXIS]
+ && !extremes_[d].stem_extent_[X_AXIS].is_empty ())
+
+ os[d][X_AXIS] = extremes_[d].stem_extent_[X_AXIS].center ();
+ }
+ }
+ while (flip (&d) != LEFT);
+
+ Offset dz;
+ dz = os[RIGHT] - os[LEFT];
+ if (dz[X_AXIS] < minimum_length
+ || fabs (dz[Y_AXIS] / dz[X_AXIS]) > parameters_.max_slope_)
+ {
+ do
+ {
+ if (extremes_[d].slur_head_
+ && !extremes_[d].slur_head_x_extent_.is_empty ())
+ {
+ os[d][X_AXIS] = extremes_[d].slur_head_x_extent_.center ();
+ attach_to_stem[d] = false;
+ }
+ }
+ while (flip (&d) != LEFT);
+ }
+
+ dz = os[RIGHT] - os[LEFT];
+ do
+ {
+ if (extremes_[d].slur_head_
+ && !attach_to_stem[d])
+ {
+ /* Horizontally move tilted slurs a little. Move
+ more for bigger tilts.
+
+ TODO: parameter */
+ os[d][X_AXIS]
+ -= dir_ * extremes_[d].slur_head_x_extent_.length ()
+ * sin (dz.arg ()) / 3;
+ }
+ }
+ while (flip (&d) != LEFT);
+
+ scores.push_back (Slur_configuration::new_config (os, scores.size ()));
+
+ os[RIGHT][Y_AXIS] += dir_ * staff_space_ / 2;
+ }
os[LEFT][Y_AXIS] += dir_ * staff_space_ / 2;
}
for (vsize i = encompasses.size (); i--;)
{
if (Slur::has_interface (encompasses[i]))
- {
- Spanner *small_slur = dynamic_cast<Spanner *> (encompasses[i]);
- Bezier b = Slur::get_curve (small_slur);
-
- Offset relative (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS),
- small_slur->relative_coordinate (common_[Y_AXIS], Y_AXIS));
-
- for (int k = 0; k < 3; k++)
- {
- Direction hdir = Direction (k - 1);
-
- /*
- Only take bound into account if small slur starts
- together with big slur.
- */
- if (hdir && small_slur->get_bound (hdir) != slur_->get_bound (hdir))
- continue;
-
- Offset z = b.curve_point (k / 2.0);
- z += relative;
-
- Interval yext;
- yext.set_full ();
- yext[dir_] = z[Y_AXIS] + dir_ * thickness_ * 1.0;
-
- Interval xext (-1, 1);
- xext = xext * (thickness_ * 2) + z[X_AXIS];
- Extra_collision_info info (small_slur,
- hdir,
- xext,
- yext,
- parameters_.extra_object_collision_penalty_);
- collision_infos.push_back (info);
- }
- }
+ {
+ Spanner *small_slur = dynamic_cast<Spanner *> (encompasses[i]);
+ Bezier b = Slur::get_curve (small_slur);
+
+ Offset relative (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS),
+ small_slur->relative_coordinate (common_[Y_AXIS], Y_AXIS));
+
+ for (int k = 0; k < 3; k++)
+ {
+ Direction hdir = Direction (k - 1);
+
+ /*
+ Only take bound into account if small slur starts
+ together with big slur.
+ */
+ if (hdir && small_slur->get_bound (hdir) != slur_->get_bound (hdir))
+ continue;
+
+ Offset z = b.curve_point (k / 2.0);
+ z += relative;
+
+ Interval yext;
+ yext.set_full ();
+ yext[dir_] = z[Y_AXIS] + dir_ * thickness_ * 1.0;
+
+ Interval xext (-1, 1);
+ xext = xext * (thickness_ * 2) + z[X_AXIS];
+ Extra_collision_info info (small_slur,
+ hdir,
+ xext,
+ yext,
+ parameters_.extra_object_collision_penalty_);
+ collision_infos.push_back (info);
+ }
+ }
else
- {
- Grob *g = encompasses [i];
- Interval xe = g->extent (common_[X_AXIS], X_AXIS);
- Interval ye = g->extent (common_[Y_AXIS], Y_AXIS);
-
- Real xp = 0.0;
- Real penalty = parameters_.extra_object_collision_penalty_;
- if (Accidental_interface::has_interface (g))
- {
- penalty = parameters_.accidental_collision_;
-
- Rational alt = ly_scm2rational (g->get_property ("alteration"));
- SCM scm_style = g->get_property ("style");
- if (!scm_is_symbol (scm_style)
- && !to_boolean (g->get_property ("parenthesized"))
- && !to_boolean (g->get_property ("restore-first")))
- {
- /* End copy accidental.cc */
- if (alt == FLAT_ALTERATION
- || alt == DOUBLE_FLAT_ALTERATION)
- xp = LEFT;
- else if (alt == SHARP_ALTERATION)
- xp = 0.5 * dir_;
- else if (alt == NATURAL_ALTERATION)
- xp = -dir_;
- }
- }
-
- ye.widen (thickness_ * 0.5);
- xe.widen (thickness_ * 1.0);
- Extra_collision_info info (g, xp, xe, ye, penalty);
- collision_infos.push_back (info);
- }
+ {
+ Grob *g = encompasses [i];
+ Interval xe = g->extent (common_[X_AXIS], X_AXIS);
+ Interval ye = g->extent (common_[Y_AXIS], Y_AXIS);
+
+ Real xp = 0.0;
+ Real penalty = parameters_.extra_object_collision_penalty_;
+ if (Accidental_interface::has_interface (g))
+ {
+ penalty = parameters_.accidental_collision_;
+
+ Rational alt = ly_scm2rational (g->get_property ("alteration"));
+ SCM scm_style = g->get_property ("style");
+ if (!scm_is_symbol (scm_style)
+ && !to_boolean (g->get_property ("parenthesized"))
+ && !to_boolean (g->get_property ("restore-first")))
+ {
+ /* End copy accidental.cc */
+ if (alt == FLAT_ALTERATION
+ || alt == DOUBLE_FLAT_ALTERATION)
+ xp = LEFT;
+ else if (alt == SHARP_ALTERATION)
+ xp = 0.5 * dir_;
+ else if (alt == NATURAL_ALTERATION)
+ xp = -dir_;
+ }
+ }
+
+ ye.widen (thickness_ * 0.5);
+ xe.widen (thickness_ * 1.0);
+ Extra_collision_info info (g, xp, xe, ye, penalty);
+ collision_infos.push_back (info);
+ }
}
return collision_infos;
}
-
+
Extra_collision_info::Extra_collision_info (Grob *g, Real idx, Interval x, Interval y, Real p)
{
idx_ = idx;
idx_ = 0.0;
penalty_ = 0.;
grob_ = 0;
- type_ = SCM_EOL;
+ type_ = SCM_EOL;
}
#include "item.hh"
#include "pointer-group-interface.hh"
#include "lookup.hh"
-#include "main.hh" // DEBUG_SLUR_SCORING
+#include "main.hh" // DEBUG_SLUR_SCORING
#include "note-column.hh"
#include "output-def.hh"
#include "spanner.hh"
#include "separation-item.hh"
#include "international.hh"
-
-
MAKE_SCHEME_CALLBACK (Slur, calc_direction, 1)
SCM
Slur::calc_direction (SCM smob)
for (vsize i = 0; i < encompasses.size (); i++)
{
if (Note_column::dir (encompasses[i]) < 0)
- {
- d = UP;
- break;
- }
+ {
+ d = UP;
+ break;
+ }
}
return scm_from_int (d);
}
{
Interval d = encompasses[i]->pure_height (parent, start, end);
if (!d.is_empty ())
- ret.unite (d);
+ ret.unite (d);
}
// The +0.5 comes from the fact that we try to place a slur
// FIXME uncached
Stencil *m = me->get_stencil ();
return m ? ly_interval2scm (m->extent (Y_AXIS))
- : ly_interval2scm (Interval ());
+ : ly_interval2scm (Interval ());
}
MAKE_SCHEME_CALLBACK (Slur, print, 1);
Real staff_thick = Staff_symbol_referencer::line_thickness (me);
Real base_thick = staff_thick
- * robust_scm2double (me->get_property ("thickness"), 1);
+ * robust_scm2double (me->get_property ("thickness"), 1);
Real line_thick = staff_thick
- * robust_scm2double (me->get_property ("line-thickness"), 1);
+ * robust_scm2double (me->get_property ("line-thickness"), 1);
Bezier one = get_curve (me);
Stencil a;
SCM dash_definition = me->get_property ("dash-definition");
a = Lookup::slur (one,
get_grob_direction (me) * base_thick,
- line_thick,
+ line_thick,
dash_definition);
#if DEBUG_SLUR_SCORING
SCM properties = Font_interface::text_font_alist_chain (me);
if (!scm_is_number (me->get_property ("font-size")))
- properties = scm_cons (scm_acons (ly_symbol2scm ("font-size"), scm_from_int (-6), SCM_EOL),
- properties);
-
+ properties = scm_cons (scm_acons (ly_symbol2scm ("font-size"), scm_from_int (-6), SCM_EOL),
+ properties);
+
Stencil tm = *unsmob_stencil (Text_interface::interpret_markup
- (me->layout ()->self_scm (), properties,
- annotation));
+ (me->layout ()->self_scm (), properties,
+ annotation));
a.add_at_edge (Y_AXIS, get_grob_direction (me), tm, 1.0);
}
#endif
return a.smobbed_copy ();
}
-
/*
it would be better to do this at engraver level, but that is
fragile, as the breakable items are generated on staff level, at
for (vsize i = 0; i < extra_objects.size (); i++)
{
Grob *g = extra_objects[i];
-
+
if (Separation_item::has_interface (g))
- {
- extract_grob_set (g, "elements", breakables);
- for (vsize j = 0; j < breakables.size (); j++)
- /* if we encompass a separation-item that spans multiple staves,
- we filter out the grobs that don't belong to our staff */
- if (me->common_refpoint (breakables[j], Y_AXIS) == me->get_parent (Y_AXIS)
- && breakables[j]->get_property ("avoid-slur") == ly_symbol2scm ("inside"))
- new_encompasses.push_back (breakables[j]);
- }
+ {
+ extract_grob_set (g, "elements", breakables);
+ for (vsize j = 0; j < breakables.size (); j++)
+ /* if we encompass a separation-item that spans multiple staves,
+ we filter out the grobs that don't belong to our staff */
+ if (me->common_refpoint (breakables[j], Y_AXIS) == me->get_parent (Y_AXIS)
+ && breakables[j]->get_property ("avoid-slur") == ly_symbol2scm ("inside"))
+ new_encompasses.push_back (breakables[j]);
+ }
else
- new_encompasses.push_back (g);
+ new_encompasses.push_back (g);
}
SCM encompass_scm = me->get_object ("encompass-objects");
if (Grob_array::unsmob (encompass_scm))
{
- vector<Grob *> &arr =
- unsmob_grob_array (encompass_scm)->array_reference ();
+ vector<Grob *> &arr
+ = unsmob_grob_array (encompass_scm)->array_reference ();
arr = new_encompasses;
}
}
Slur::outside_slur_callback (SCM grob, SCM offset_scm)
{
Grob *script = unsmob_grob (grob);
- Grob *slur = unsmob_grob (script->get_object ("slur"));
+ Grob *slur = unsmob_grob (script->get_object ("slur"));
if (!slur)
return offset_scm;
if (avoid != ly_symbol2scm ("outside")
&& avoid != ly_symbol2scm ("around"))
return offset_scm;
-
+
Direction dir = get_grob_direction (script);
if (dir == CENTER)
return offset_scm;
Bezier curve = Slur::get_curve (slur);
curve.translate (Offset (slur->relative_coordinate (cx, X_AXIS),
- slur->relative_coordinate (cy, Y_AXIS)));
+ slur->relative_coordinate (cy, Y_AXIS)));
Interval yext = robust_relative_extent (script, cy, Y_AXIS);
Interval xext = robust_relative_extent (script, cx, X_AXIS);
Real offset = robust_scm2double (offset_scm, 0);
yext.translate (offset);
-
+
/* FIXME: slur property, script property? */
Real slur_padding = robust_scm2double (script->get_property ("slur-padding"),
- 0.0);
+ 0.0);
yext.widen (slur_padding);
const Real EPS = 1e-3;
bool consider[] = {false, false, false};
Real ys[] = {0, 0, 0};
bool do_shift = false;
-
+
for (int d = LEFT, k = 0; d <= RIGHT; d++, k++)
{
Real x = xext.linear_combination ((Direction) d);
consider[k] = bezext.contains (x);
if (consider[k])
- {
- ys[k]
- = (fabs (bezext[LEFT] - x) < EPS)
- ? curve.control_[0][Y_AXIS]
- : ((fabs (bezext[RIGHT] - x) < EPS)
- ? curve.control_[3][Y_AXIS]
- : curve.get_other_coordinate (X_AXIS, x));
-
- /* Request shift if slur is contained script's Y, or if
- script is inside slur and avoid == outside. */
- if (yext.contains (ys[k])
- || (dir * ys[k] > dir * yext[-dir] && avoid == ly_symbol2scm ("outside")))
- do_shift = true;
- }
+ {
+ ys[k]
+ = (fabs (bezext[LEFT] - x) < EPS)
+ ? curve.control_[0][Y_AXIS]
+ : ((fabs (bezext[RIGHT] - x) < EPS)
+ ? curve.control_[3][Y_AXIS]
+ : curve.get_other_coordinate (X_AXIS, x));
+
+ /* Request shift if slur is contained script's Y, or if
+ script is inside slur and avoid == outside. */
+ if (yext.contains (ys[k])
+ || (dir * ys[k] > dir * yext[-dir] && avoid == ly_symbol2scm ("outside")))
+ do_shift = true;
+ }
}
Real avoidance_offset = 0.0;
if (do_shift)
{
for (int d = LEFT, k = 0; d <= RIGHT; d++, k++)
- if (consider[k])
- avoidance_offset = dir * (max (dir * avoidance_offset,
- dir * (ys[k] - yext[-dir] + dir * slur_padding)));
+ if (consider[k])
+ avoidance_offset = dir * (max (dir * avoidance_offset,
+ dir * (ys[k] - yext[-dir] + dir * slur_padding)));
}
return scm_from_double (offset + avoidance_offset);
}
*/
void
Slur::auxiliary_acknowledge_extra_object (Grob_info const &info,
- vector<Grob*> &slurs,
- vector<Grob*> &end_slurs)
+ vector<Grob *> &slurs,
+ vector<Grob *> &end_slurs)
{
if (slurs.empty () && end_slurs.empty ())
return;
-
+
Grob *e = info.grob ();
SCM avoid = e->get_property ("avoid-slur");
if (Tie::has_interface (e)
|| avoid == ly_symbol2scm ("inside"))
{
for (vsize i = slurs.size (); i--;)
- add_extra_encompass (slurs[i], e);
+ add_extra_encompass (slurs[i], e);
for (vsize i = end_slurs.size (); i--;)
- add_extra_encompass (end_slurs[i], e);
+ add_extra_encompass (end_slurs[i], e);
}
else if (avoid == ly_symbol2scm ("outside")
- || avoid == ly_symbol2scm ("around"))
+ || avoid == ly_symbol2scm ("around"))
{
Grob *slur;
if (end_slurs.size () && !slurs.size ())
- slur = end_slurs[0];
+ slur = end_slurs[0];
else
- slur = slurs[0];
+ slur = slurs[0];
if (slur)
- {
- chain_offset_callback (e, outside_slur_callback_proc, Y_AXIS);
- chain_callback (e, outside_slur_cross_staff_proc, ly_symbol2scm("cross-staff"));
- e->set_object ("slur", slur->self_scm ());
- }
+ {
+ chain_offset_callback (e, outside_slur_callback_proc, Y_AXIS);
+ chain_callback (e, outside_slur_cross_staff_proc, ly_symbol2scm ("cross-staff"));
+ e->set_object ("slur", slur->self_scm ());
+ }
}
else if (avoid != ly_symbol2scm ("ignore"))
e->warning (_f ("Ignoring grob for slur: %s. avoid-slur not set?",
- e->name().c_str ()));
+ e->name ().c_str ()));
}
/*
for (vsize i = 0; i < cols.size (); i++)
{
if (Grob *s = Note_column::get_stem (cols[i]))
- if (to_boolean (s->get_property ("cross-staff")))
- return SCM_BOOL_T;
+ if (to_boolean (s->get_property ("cross-staff")))
+ return SCM_BOOL_T;
}
/* the separation items are dealt with in replace_breakable_encompass_objects
so we can ignore them here */
- vector<Grob*> non_sep_extras;
+ vector<Grob *> non_sep_extras;
for (vsize i = 0; i < extras.size (); i++)
if (!Separation_item::has_interface (extras[i]))
non_sep_extras.push_back (extras[i]);
}
ADD_INTERFACE (Slur,
- "A slur."
- "\n"
- "The following properties may be set in the @code{details}"
- " list.\n"
- "\n"
- "@table @code\n"
- "@item region-size\n"
- "Size of region (in staff spaces) for determining"
- " potential endpoints in the Y direction.\n"
- "@item head-encompass-penalty\n"
- "Demerit to apply when note heads collide with a slur.\n"
- "@item stem-encompass-penalty\n"
- "Demerit to apply when stems collide with a slur.\n"
- "@item closeness-factor\n"
- "Additional demerit used when scoring encompasses.\n"
- "@item edge-attraction-factor\n"
- "Factor used to calculate the demerit for distances"
- " between slur endpoints and their corresponding base"
- " attachments.\n"
- "@item same-slope-penalty\n"
- "Demerit for slurs with attachment points that are"
- " horizontally aligned.\n"
- "@item steeper-slope-factor\n"
- "Factor used to calculate demerit only if this slur is"
- " not broken.\n"
- "@item non-horizontal-penalty\n"
- "Demerit for slurs with attachment points that are not"
- " horizontally aligned.\n"
- "@item max-slope\n"
- "The maximum slope allowed for this slur.\n"
- "@item max-slope-factor\n"
- "Factor that calculates demerit based on the max slope.\n"
- "@item free-head-distance\n"
- "The amount of vertical free space that must exist"
- " between a slur and note heads.\n"
- "@item absolute-closeness-measure\n"
- "Factor to calculate demerit for variance between a note"
- " head and slur.\n"
- "@item extra-object-collision-penalty\n"
- "Factor to calculate demerit for extra objects that the"
- " slur encompasses, including accidentals, fingerings, and"
- " tuplet numbers.\n"
- "@item accidental-collision\n"
- "Factor to calculate demerit for @code{Accidental} objects"
- " that the slur encompasses. This property value replaces"
- " the value of @code{extra-object-collision-penalty}.\n"
- "@item extra-encompass-free-distance\n"
- "The amount of vertical free space that must exist"
- " between a slur and various objects it encompasses,"
- " including accidentals, fingerings, and tuplet numbers.\n"
- "@item extra-encompass-collision-distance\n"
- "This detail is currently unused.\n"
- "@item head-slur-distance-factor\n"
- "Factor to calculate demerit for variance between a note"
- " head and slur.\n"
- "@item head-slur-distance-max-ratio\n"
- "The maximum value for the ratio of distance between a"
- " note head and slur.\n"
- "@item free-slur-distance\n"
- "The amount of vertical free space that must exist"
- " between adjacent slurs. This subproperty only works"
- " for @code{PhrasingSlur}.\n"
- "@item edge-slope-exponent\n"
- "Factor used to calculate the demerit for the slope of"
- " a slur near its endpoints; a larger value yields a"
- " larger demerit.\n"
- "@end table\n",
-
- /* properties */
- "annotation "
- "avoid-slur " /* UGH. */
- "control-points "
+ "A slur."
+ "\n"
+ "The following properties may be set in the @code{details}"
+ " list.\n"
+ "\n"
+ "@table @code\n"
+ "@item region-size\n"
+ "Size of region (in staff spaces) for determining"
+ " potential endpoints in the Y direction.\n"
+ "@item head-encompass-penalty\n"
+ "Demerit to apply when note heads collide with a slur.\n"
+ "@item stem-encompass-penalty\n"
+ "Demerit to apply when stems collide with a slur.\n"
+ "@item closeness-factor\n"
+ "Additional demerit used when scoring encompasses.\n"
+ "@item edge-attraction-factor\n"
+ "Factor used to calculate the demerit for distances"
+ " between slur endpoints and their corresponding base"
+ " attachments.\n"
+ "@item same-slope-penalty\n"
+ "Demerit for slurs with attachment points that are"
+ " horizontally aligned.\n"
+ "@item steeper-slope-factor\n"
+ "Factor used to calculate demerit only if this slur is"
+ " not broken.\n"
+ "@item non-horizontal-penalty\n"
+ "Demerit for slurs with attachment points that are not"
+ " horizontally aligned.\n"
+ "@item max-slope\n"
+ "The maximum slope allowed for this slur.\n"
+ "@item max-slope-factor\n"
+ "Factor that calculates demerit based on the max slope.\n"
+ "@item free-head-distance\n"
+ "The amount of vertical free space that must exist"
+ " between a slur and note heads.\n"
+ "@item absolute-closeness-measure\n"
+ "Factor to calculate demerit for variance between a note"
+ " head and slur.\n"
+ "@item extra-object-collision-penalty\n"
+ "Factor to calculate demerit for extra objects that the"
+ " slur encompasses, including accidentals, fingerings, and"
+ " tuplet numbers.\n"
+ "@item accidental-collision\n"
+ "Factor to calculate demerit for @code{Accidental} objects"
+ " that the slur encompasses. This property value replaces"
+ " the value of @code{extra-object-collision-penalty}.\n"
+ "@item extra-encompass-free-distance\n"
+ "The amount of vertical free space that must exist"
+ " between a slur and various objects it encompasses,"
+ " including accidentals, fingerings, and tuplet numbers.\n"
+ "@item extra-encompass-collision-distance\n"
+ "This detail is currently unused.\n"
+ "@item head-slur-distance-factor\n"
+ "Factor to calculate demerit for variance between a note"
+ " head and slur.\n"
+ "@item head-slur-distance-max-ratio\n"
+ "The maximum value for the ratio of distance between a"
+ " note head and slur.\n"
+ "@item free-slur-distance\n"
+ "The amount of vertical free space that must exist"
+ " between adjacent slurs. This subproperty only works"
+ " for @code{PhrasingSlur}.\n"
+ "@item edge-slope-exponent\n"
+ "Factor used to calculate the demerit for the slope of"
+ " a slur near its endpoints; a larger value yields a"
+ " larger demerit.\n"
+ "@end table\n",
+
+ /* properties */
+ "annotation "
+ "avoid-slur " /* UGH. */
+ "control-points "
"dash-definition "
- "details "
- "direction "
- "eccentricity "
- "encompass-objects "
- "height-limit "
- "inspect-quants "
- "inspect-index "
- "line-thickness "
- "note-columns "
- "positions "
- "ratio "
- "thickness "
- );
+ "details "
+ "direction "
+ "eccentricity "
+ "encompass-objects "
+ "height-limit "
+ "inspect-quants "
+ "inspect-index "
+ "line-thickness "
+ "note-columns "
+ "positions "
+ "ratio "
+ "thickness "
+ );
ADD_SCM_INIT_FUNC (init_smob_protection, init_smob_protection);
LY_DEFINE (ly_smob_protects, "ly:smob-protects",
- 0, 0, 0, (),
- "Return LilyPond's internal smob protection list.")
+ 0, 0, 0, (),
+ "Return LilyPond's internal smob protection list.")
{
return scm_is_pair (smob_protection_list)
- ? scm_cdr (smob_protection_list)
- : SCM_EOL;
+ ? scm_cdr (smob_protection_list)
+ : SCM_EOL;
}
void
}
SCM prot = scm_cons (smob, s);
scm_set_cdr_x (smob_protection_list,
- prot);
+ prot);
*prot_cons = prot;
#else
- (void) prot_cons;
+ (void) prot_cons;
scm_gc_protect_object (smob);
#endif
}
unprotect_smob (SCM smob, SCM *prot_cons)
{
#if 1
- (void) prot_cons;
+ (void) prot_cons;
scm_gc_unprotect_object (smob);
#else
SCM next = scm_cdr (*prot_cons);
{
scm_set_car_x (*prot_cons, SCM_BOOL_F);
while (scm_is_pair (next)
- && scm_car (next) == SCM_BOOL_F)
+ && scm_car (next) == SCM_BOOL_F)
- next = scm_cdr (next);
+ next = scm_cdr (next);
scm_set_cdr_x (*prot_cons, next);
}
}
/*
- return contents of FILENAME. *Not 0-terminated!*
+ return contents of FILENAME. *Not 0-terminated!*
*/
vector<char>
gulp_file (string filename, int desired_size)
if (desired_size > 0)
read_count = min (read_count, desired_size);
-
+
rewind (f);
char *str = new char[read_count + 1];
int bytes_read = fread (str, sizeof (char), read_count, f);
if (bytes_read != read_count)
warning (_f ("expected to read %d characters, got %d", bytes_read,
- read_count));
+ read_count));
fclose (f);
int filesize = bytes_read;
cxx_arr.resize (filesize);
copy (str, str + filesize, cxx_arr.begin ());
-
+
delete[] str;
return cxx_arr;
}
Source_file::Source_file (string filename, string data)
{
init ();
-
+
name_ = filename;
characters_.resize (data.length ());
copy (data.begin (), data.end (), characters_.begin ());
characters_.push_back (0);
-
+
init_port ();
for (vsize i = 0; i < characters_.size (); i++)
Source_file::Source_file (string filename_string)
{
init ();
-
+
name_ = filename_string;
if (filename_string == "-")
scm_set_port_filename_x (str_port_, ly_string2scm (name_));
}
-
istream *
Source_file::get_istream ()
{
if (!istream_)
{
if (length ()) // can-t this be done without such a hack?
- istream_ = new istringstream (c_str ());
+ istream_ = new istringstream (c_str ());
else
- {
- istream_ = new istringstream ("");
- istream_->setstate (ios::eofbit);
- // istream_->set (ios::eofbit);
- }
+ {
+ istream_ = new istringstream ("");
+ istream_->setstate (ios::eofbit);
+ // istream_->set (ios::eofbit);
+ }
}
return istream_;
}
get_counts (context_str0, &l, &ch, &col, &offset);
return name_string () + ":" + to_string (l)
- + ":" + to_string (col);
+ + ":" + to_string (col);
}
}
get_counts (pos_str0, &l, &ch, &col, &offset);
string line = line_string (pos_str0);
string context = line.substr (0, offset)
- + to_string ('\n')
- + to_string (' ', col)
- + line.substr (offset, line.length () - offset);
+ + to_string ('\n')
+ + to_string (' ', col)
+ + line.substr (offset, line.length () - offset);
return context;
}
while (begin_str0 > data_str0)
if (*--begin_str0 == '\n')
{
- begin_str0++;
- break;
+ begin_str0++;
+ break;
}
char const *end_str0 = pos_str0;
while (end_str0 < eof_C_)
if (*end_str0++ == '\n')
{
- end_str0--;
- break;
+ end_str0--;
+ break;
}
return Slice (begin_str0 - data_str0, end_str0 - data_str0);
void
Source_file::get_counts (char const *pos_str0,
- int *line_number,
- int *line_char,
- int *column,
- int *byte_offset) const
+ int *line_number,
+ int *line_char,
+ int *column,
+ int *byte_offset) const
{
*line_number = 0;
-
+
if (!contains (pos_str0))
return;
size_t thislen = utf8_char_len (*line_chars);
if (thislen == 1 && line_chars[0] == '\t')
- (*column) = (*column / 8 + 1) * 8;
+ (*column) = (*column / 8 + 1) * 8;
else
- (*column)++;
+ (*column)++;
(*line_char)++;
/*
- To have decent output in UTF-8 aware terminals,
- we must keep track of the number of bytes from
- the left edge of the terminal.
+ To have decent output in UTF-8 aware terminals,
+ we must keep track of the number of bytes from
+ the left edge of the terminal.
*/
*byte_offset += thislen;
/* this will find the '\n' character at the end of our line */
vsize lo = lower_bound (newline_locations_,
- pos_str0,
- less<char const*> ());
+ pos_str0,
+ less<char const *> ());
/* the return value will be indexed from 1 */
return lo + 1 + line_offset_;
return sc->str_port_;
}
-
int
Source_file::print_smob (SCM smob, SCM port, scm_print_state *)
{
path_ = 0;
}
-
Sources::Sources (Sources const &)
{
assert (false);
}
-
void
Sources::set_path (File_path *f)
{
working directory.
*/
Source_file *
-Sources::get_file (string file_string, string const& current_dir)
-{
+Sources::get_file (string file_string, string const ¤t_dir)
+{
if (file_string != "-")
{
// First, check for a path relative to the directory of the
// file currently being parsed.
if (current_dir.length ()
- && file_string.length ()
- && !File_name (file_string).is_absolute ()
- && is_file (current_dir + DIRSEP + file_string))
- file_string = current_dir + DIRSEP + file_string;
+ && file_string.length ()
+ && !File_name (file_string).is_absolute ()
+ && is_file (current_dir + DIRSEP + file_string))
+ file_string = current_dir + DIRSEP + file_string;
// Otherwise, check the rest of the path.
else if (path_)
- {
- string file_string_o = path_->find (file_string);
- if ((file_string_o == "") && (file_string != ""))
- return 0;
+ {
+ string file_string_o = path_->find (file_string);
+ if ((file_string_o == "") && (file_string != ""))
+ return 0;
- file_string = file_string_o;
- }
+ file_string = file_string_o;
+ }
}
Source_file *f = new Source_file (file_string);
{
SCM dist = scm_car (s);
if (scm_car (dist) == p->self_scm ())
- {
- scm_set_cdr_x (dist, scm_max (scm_cdr (dist),
- newdist));
- return;
- }
+ {
+ scm_set_cdr_x (dist, scm_max (scm_cdr (dist),
+ newdist));
+ return;
+ }
}
if (Paper_column::get_rank (p) < Paper_column::get_rank (me))
s = scm_cdr (s))
{
if (scm_is_pair (scm_car (s))
- && unsmob_grob (scm_cdar (s)) == next_col
- && unsmob_spring (scm_caar (s)))
- spring = unsmob_spring (scm_caar (s));
+ && unsmob_grob (scm_cdar (s)) == next_col
+ && unsmob_spring (scm_caar (s)))
+ spring = unsmob_spring (scm_caar (s));
}
if (!spring)
programming_error (_f ("No spring between column %d and next one",
- Paper_column::get_rank (this_col)));
+ Paper_column::get_rank (this_col)));
return spring ? *spring : Spring ();
}
-
-
ADD_INTERFACE (Spaceable_grob,
- "A layout object that takes part in the spacing problem.",
-
- /* properties */
- "allow-loose-spacing "
- "ideal-distances "
- "keep-inside-line "
- "left-neighbor "
- "measure-length "
- "minimum-distances "
- "right-neighbor "
- "spacing-wishes "
- );
+ "A layout object that takes part in the spacing problem.",
+
+ /* properties */
+ "allow-loose-spacing "
+ "ideal-distances "
+ "keep-inside-line "
+ "left-neighbor "
+ "measure-length "
+ "minimum-distances "
+ "right-neighbor "
+ "spacing-wishes "
+ );
Moment *dt = unsmob_moment (l->get_property ("measure-length"));
Moment mlen (1);
if (dt)
- mlen = *dt;
+ mlen = *dt;
Real incr = robust_scm2double (me->get_property ("spacing-increment"), 1);
Real space = incr * double (mlen.main_part_ / options->global_shortest_) * 0.8;
Spring spring = Spring (min_dist + space, min_dist);
/*
- By default, the spring will have an inverse_stretch_strength of space+min_dist.
- However, we don't want stretchability to scale with min_dist or else an
- empty first measure on a line (which has a large min_dist because of the clef)
- will stretch much more than an empty measure later in the line.
+ By default, the spring will have an inverse_stretch_strength of space+min_dist.
+ However, we don't want stretchability to scale with min_dist or else an
+ empty first measure on a line (which has a large min_dist because of the clef)
+ will stretch much more than an empty measure later in the line.
*/
spring.set_inverse_stretch_strength (space);
return spring;
if (dt == Moment (0, 0))
{
/*
- In this case, Staff_spacing should handle the job,
- using dt when it is 0 is silly.
+ In this case, Staff_spacing should handle the job,
+ using dt when it is 0 is silly.
*/
ideal = min_dist + 0.5;
}
Moment *
get_measure_length (Grob *column)
{
- Grob * sys = column->get_parent (X_AXIS);
+ Grob *sys = column->get_parent (X_AXIS);
extract_grob_set (sys, "columns", cols);
vsize col_idx = Paper_column::get_rank (column);
-
+
do
{
if (Moment *len = unsmob_moment (cols[col_idx]->get_property ("measure-length")))
- {
- return len;
- }
+ {
+ return len;
+ }
}
while (col_idx-- != 0);
-
+
return 0;
}
Real
Spacing_spanner::note_spacing (Grob * /* me */,
- Grob *lc,
- Grob *rc,
- Spacing_options const *options)
+ Grob *lc,
+ Grob *rc,
+ Spacing_options const *options)
{
Moment shortest_playing_len = 0;
SCM s = lc->get_property ("shortest-playing-duration");
delta_t = min (delta_t, *measure_len);
/*
- The following is an extra safety measure, such that
- the length of a mmrest event doesn't cause havoc.
+ The following is an extra safety measure, such that
+ the length of a mmrest event doesn't cause havoc.
*/
shortest_playing_len = min (shortest_playing_len, *measure_len);
}
else if (delta_t.grace_part_)
{
/*
- Crude hack for spacing graces: we take the shortest space
- available (namely the space for the global shortest note), and
- multiply that by grace-space-factor
+ Crude hack for spacing graces: we take the shortest space
+ available (namely the space for the global shortest note), and
+ multiply that by grace-space-factor
*/
dist = options->get_duration_space (options->global_shortest_) / 2.0;
Grob *grace_spacing = unsmob_grob (lc->get_object ("grace-spacing"));
if (grace_spacing)
- {
- Spacing_options grace_opts;
- grace_opts.init_from_grob (grace_spacing);
- dist = grace_opts.get_duration_space (delta_t.grace_part_);
- }
-
+ {
+ Spacing_options grace_opts;
+ grace_opts.init_from_grob (grace_spacing);
+ dist = grace_opts.get_duration_space (delta_t.grace_part_);
+ }
+
}
return dist;
{
if (!to_boolean (col->get_property ("allow-loose-spacing")))
return false;
-
if ((options->float_nonmusical_columns_
|| options->float_grace_columns_)
return true;
}
-
if (Paper_column::is_musical (col))
return false;
its neighbor (ie. no funny polyphonic stuff), don't make it loose.
*/
if (l == l_neighbor && r == r_neighbor && col->extent (col, X_AXIS).length () > 0)
- return false;
+ return false;
/*
Only declare loose if the bounds make a little sense. This means
nicely folded, but hey, then don't do that.
*/
if (! ((Paper_column::is_musical (l_neighbor) || Paper_column::is_breakable (l_neighbor))
- && (Paper_column::is_musical (r_neighbor) || Paper_column::is_breakable (r_neighbor))))
+ && (Paper_column::is_musical (r_neighbor) || Paper_column::is_breakable (r_neighbor))))
return false;
/*
{
Grob *g = elts[i];
if (g && Break_alignment_interface::has_interface (g))
- {
- extract_grob_set (g, "elements", gelts);
- for (vsize j = gelts.size (); j--;)
- {
- Grob *h = gelts[j];
-
- if (h && h->get_property ("break-align-symbol") == ly_symbol2scm ("staff-bar"))
- {
- extract_grob_set (h, "elements", helts);
- for (vsize k = helts.size (); k--;)
- if ("" != robust_scm2string (helts[k]->get_property ("glyph-name"), ""))
- return false;
- }
- }
- }
+ {
+ extract_grob_set (g, "elements", gelts);
+ for (vsize j = gelts.size (); j--;)
+ {
+ Grob *h = gelts[j];
+
+ if (h && h->get_property ("break-align-symbol") == ly_symbol2scm ("staff-bar"))
+ {
+ extract_grob_set (h, "elements", helts);
+ for (vsize k = helts.size (); k--;)
+ if ("" != robust_scm2string (helts[k]->get_property ("glyph-name"), ""))
+ return false;
+ }
+ }
+ }
}
return true;
void
Spacing_spanner::set_distances_for_loose_col (Grob *me, Grob *c,
- Drul_array<Item *> next_door,
- Spacing_options const *options)
+ Drul_array<Item *> next_door,
+ Spacing_options const *options)
{
Direction d = LEFT;
Drul_array<Real> dists (0, 0);
extract_grob_set (lc, "spacing-wishes", wishes);
for (vsize k = wishes.size (); k--;)
- {
- Grob *sp = wishes[k];
- if (Spacing_interface::left_column (sp) != lc
- || Spacing_interface::right_column (sp) != rc)
- continue;
-
- if (Note_spacing::has_interface (sp))
- {
- /*
- The note spacing should be taken from the musical
- columns.
- */
- Real base = note_spacing (me, lc, rc, options);
- Spring spring = Note_spacing::get_spacing (sp, rc, base, options->increment_);
-
- dists[d] = max (dists[d], spring.min_distance ());
- }
- else if (Staff_spacing::has_interface (sp))
- {
- Spring spring = Staff_spacing::get_spacing (sp, rc);
-
- dists[d] = max (dists[d], spring.min_distance ());
- }
- else
- programming_error ("Subversive spacing wish");
- }
+ {
+ Grob *sp = wishes[k];
+ if (Spacing_interface::left_column (sp) != lc
+ || Spacing_interface::right_column (sp) != rc)
+ continue;
+
+ if (Note_spacing::has_interface (sp))
+ {
+ /*
+ The note spacing should be taken from the musical
+ columns.
+ */
+ Real base = note_spacing (me, lc, rc, options);
+ Spring spring = Note_spacing::get_spacing (sp, rc, base, options->increment_);
+
+ dists[d] = max (dists[d], spring.min_distance ());
+ }
+ else if (Staff_spacing::has_interface (sp))
+ {
+ Spring spring = Staff_spacing::get_spacing (sp, rc);
+
+ dists[d] = max (dists[d], spring.min_distance ());
+ }
+ else
+ programming_error ("Subversive spacing wish");
+ }
}
while (flip (&d) != LEFT);
Rod r;
r.distance_ = dists[LEFT] + dists[RIGHT];
r.item_drul_ = next_door;
-
- r.add_to_cols ();
-}
+ r.add_to_cols ();
+}
/*
Remove columns that are not tightly fitting from COLS. In the
*/
void
Spacing_spanner::prune_loose_columns (Grob *me,
- vector<Grob*> *cols,
- Spacing_options *options)
+ vector<Grob *> *cols,
+ Spacing_options *options)
{
- vector<Grob*> newcols;
+ vector<Grob *> newcols;
for (vsize i = 0; i < cols->size (); i++)
{
Grob *c = cols->at (i);
bool loose = (i > 0 && i + 1 < cols->size ())
- && is_loose_column (cols->at (i - 1), c, cols->at (i + 1), options);
+ && is_loose_column (cols->at (i - 1), c, cols->at (i + 1), options);
/* Breakable columns never get pruned; even if they are loose,
their broken pieces are not. However, we mark them so that
the spacing can take their mid-line looseness into account. */
if (loose && Paper_column::is_breakable (c))
- {
- loose = false;
- c->set_property ("maybe-loose", SCM_BOOL_T);
- }
+ {
+ loose = false;
+ c->set_property ("maybe-loose", SCM_BOOL_T);
+ }
/*
- Unbreakable columns which only contain page-labels also
- never get pruned, otherwise the labels are lost before they can
- be collected by the System: so we mark these columns too.
+ Unbreakable columns which only contain page-labels also
+ never get pruned, otherwise the labels are lost before they can
+ be collected by the System: so we mark these columns too.
*/
if (!loose && !Paper_column::is_breakable (c)
- && scm_is_pair (c->get_property ("labels")))
- {
- extract_grob_set (c, "elements", elts);
- if (elts.empty ())
- c->set_property ("maybe-loose", SCM_BOOL_T);
- }
+ && scm_is_pair (c->get_property ("labels")))
+ {
+ extract_grob_set (c, "elements", elts);
+ if (elts.empty ())
+ c->set_property ("maybe-loose", SCM_BOOL_T);
+ }
if (loose)
- {
- Grob *right_neighbor = unsmob_grob (c->get_object ("right-neighbor"));
- Grob *left_neighbor = unsmob_grob (c->get_object ("left-neighbor"));
-
- /*
- Either object can be non existent, if the score ends
- prematurely.
- */
- if (!right_neighbor || !left_neighbor)
- {
- c->programming_error ("Cannot determine neighbors for floating column. ");
- c->set_object ("between-cols", scm_cons (cols->at (i-1)->self_scm (),
- cols->at (i+1)->self_scm ()));
- }
- else
- {
- c->set_object ("between-cols", scm_cons (left_neighbor->self_scm (),
- right_neighbor->self_scm ()));
-
-
- /*
- Set distance constraints for loose columns
- */
- Drul_array<Item *> next_door (dynamic_cast<Item*> (cols->at (i - 1)),
- dynamic_cast<Item*> (cols->at (i + 1)));
-
- set_distances_for_loose_col (me, c, next_door, options);
- }
- }
+ {
+ Grob *right_neighbor = unsmob_grob (c->get_object ("right-neighbor"));
+ Grob *left_neighbor = unsmob_grob (c->get_object ("left-neighbor"));
+
+ /*
+ Either object can be non existent, if the score ends
+ prematurely.
+ */
+ if (!right_neighbor || !left_neighbor)
+ {
+ c->programming_error ("Cannot determine neighbors for floating column. ");
+ c->set_object ("between-cols", scm_cons (cols->at (i - 1)->self_scm (),
+ cols->at (i + 1)->self_scm ()));
+ }
+ else
+ {
+ c->set_object ("between-cols", scm_cons (left_neighbor->self_scm (),
+ right_neighbor->self_scm ()));
+
+ /*
+ Set distance constraints for loose columns
+ */
+ Drul_array<Item *> next_door (dynamic_cast<Item *> (cols->at (i - 1)),
+ dynamic_cast<Item *> (cols->at (i + 1)));
+
+ set_distances_for_loose_col (me, c, next_door, options);
+ }
+ }
if (!loose)
- newcols.push_back (c);
+ newcols.push_back (c);
}
*cols = newcols;
Set neighboring columns determined by the spacing-wishes grob property.
*/
void
-Spacing_spanner::set_explicit_neighbor_columns (vector<Grob*> const &cols)
+Spacing_spanner::set_explicit_neighbor_columns (vector<Grob *> const &cols)
{
for (vsize i = 0; i < cols.size (); i++)
{
extract_grob_set (cols[i], "spacing-wishes", wishes);
for (vsize j = wishes.size (); j--;)
- {
- Item *wish = dynamic_cast<Item*> (wishes[j]);
- Item *left_col = wish->get_column ();
- int left_rank = Paper_column::get_rank (left_col);
- int min_right_rank = INT_MAX;
-
- extract_grob_set (wish, "right-items", right_items);
- for (vsize k = right_items.size (); k--;)
- {
- Item *right_col = dynamic_cast<Item*> (right_items[k])->get_column ();
- int right_rank = Paper_column::get_rank (right_col);
-
- if (right_rank < min_right_rank)
- {
- left_col->set_object ("right-neighbor", right_col->self_scm ());
- min_right_rank = right_rank;
- }
-
- Grob *old_left_neighbor = unsmob_grob (right_col->get_object ("left-neighbor"));
- if (!old_left_neighbor || left_rank > Paper_column::get_rank (old_left_neighbor))
- right_col->set_object ("left-neighbor", left_col->self_scm ());
- }
- }
+ {
+ Item *wish = dynamic_cast<Item *> (wishes[j]);
+ Item *left_col = wish->get_column ();
+ int left_rank = Paper_column::get_rank (left_col);
+ int min_right_rank = INT_MAX;
+
+ extract_grob_set (wish, "right-items", right_items);
+ for (vsize k = right_items.size (); k--;)
+ {
+ Item *right_col = dynamic_cast<Item *> (right_items[k])->get_column ();
+ int right_rank = Paper_column::get_rank (right_col);
+
+ if (right_rank < min_right_rank)
+ {
+ left_col->set_object ("right-neighbor", right_col->self_scm ());
+ min_right_rank = right_rank;
+ }
+
+ Grob *old_left_neighbor = unsmob_grob (right_col->get_object ("left-neighbor"));
+ if (!old_left_neighbor || left_rank > Paper_column::get_rank (old_left_neighbor))
+ right_col->set_object ("left-neighbor", left_col->self_scm ());
+ }
+ }
}
}
Why only these? --jneem
*/
void
-Spacing_spanner::set_implicit_neighbor_columns (vector<Grob*> const &cols)
+Spacing_spanner::set_implicit_neighbor_columns (vector<Grob *> const &cols)
{
for (vsize i = 0; i < cols.size (); i++)
{
Item *it = dynamic_cast<Item *> (cols[i]);
if (!Paper_column::is_breakable (it) && !Paper_column::is_musical (it))
- continue;
+ continue;
if (i && !unsmob_grob (cols[i]->get_object ("left-neighbor")))
- cols[i]->set_object ("left-neighbor", cols[i-1]->self_scm ());
+ cols[i]->set_object ("left-neighbor", cols[i - 1]->self_scm ());
if (i + 1 < cols.size () && !unsmob_grob (cols[i]->get_object ("right-neighbor")))
- cols[i]->set_object ("right-neighbor", cols[i+1]->self_scm ());
+ cols[i]->set_object ("right-neighbor", cols[i + 1]->self_scm ());
}
}
int
Rhythmic_tuple::time_compare (Rhythmic_tuple const &h1,
- Rhythmic_tuple const &h2)
+ Rhythmic_tuple const &h2)
{
return (h1.end_ - h2.end_).main_part_.sign ();
}
Moment now_;
Spanner *spacing_;
Stream_event *start_section_;
-
+
TRANSLATOR_DECLARATIONS (Spacing_engraver);
protected:
{
if (start_section_ && spacing_)
stop_spanner ();
-
+
if (!spacing_)
start_spanner ();
}
{
assert (!spacing_);
-
spacing_ = make_spanner ("SpacingSpanner", SCM_EOL);
spacing_->set_bound (LEFT,
- unsmob_grob (get_property ("currentCommandColumn")));
+ unsmob_grob (get_property ("currentCommandColumn")));
}
void
void
Spacing_engraver::acknowledge_rhythmic_grob (Grob_info i)
{
- add_starter_duration (i);
+ add_starter_duration (i);
}
void
add_starter_duration (i);
}
-
void
Spacing_engraver::add_starter_duration (Grob_info i)
{
{
Stream_event *r = i.event_cause ();
if (r && r->in_event_class ("rhythmic-event"))
- {
- Moment len = get_event_length (r, now_);
- Rhythmic_tuple t (i, now_mom () + len);
- now_durations_.push_back (t);
- }
+ {
+ Moment len = get_event_length (r, now_);
+ Rhythmic_tuple t (i, now_mom () + len);
+ now_durations_.push_back (t);
+ }
}
}
Paper_column *musical_column
= dynamic_cast<Paper_column *> (unsmob_grob (get_property ("currentMusicalColumn")));
-
if (!spacing_)
start_spanner ();
musical_column->set_object ("spacing", spacing_->self_scm ());
unsmob_grob (get_property ("currentCommandColumn"))
- ->set_object ("spacing", spacing_->self_scm ());
-
+ ->set_object ("spacing", spacing_->self_scm ());
+
SCM proportional = get_property ("proportionalNotationDuration");
if (unsmob_moment (proportional))
{
{
Stream_event *ev = playing_durations_[i].info_.event_cause ();
if (ev)
- {
- Moment now = now_mom ();
- Moment m = get_event_length (ev);
- shortest_playing = min (shortest_playing, m);
- }
+ {
+ Moment now = now_mom ();
+ Moment m = get_event_length (ev);
+ shortest_playing = min (shortest_playing, m);
+ }
}
Moment starter;
starter.set_infinite (1);
{
Moment m = get_event_length (now_durations_[i].info_.event_cause ());
if (m.to_bool ())
- {
- starter = min (starter, m);
- playing_durations_.insert (now_durations_[i]);
- }
+ {
+ starter = min (starter, m);
+ playing_durations_.insert (now_durations_[i]);
+ }
}
now_durations_.clear ();
musical_column->set_property ("shortest-starter-duration", st);
}
-
-
void
Spacing_engraver::start_translation_timestep ()
{
now_ = now_mom ();
stopped_durations_.clear ();
-
+
while (playing_durations_.size () && playing_durations_.front ().end_ < now_)
playing_durations_.delmin ();
while (playing_durations_.size () && playing_durations_.front ().end_ == now_)
ADD_ACKNOWLEDGER (Spacing_engraver, rhythmic_grob);
ADD_TRANSLATOR (Spacing_engraver,
- /* doc */
- "Make a @code{SpacingSpanner} and do bookkeeping of shortest"
- " starting and playing notes.",
-
- /* create */
- "SpacingSpanner ",
-
- /* read */
- "currentMusicalColumn "
- "currentCommandColumn "
- "proportionalNotationDuration ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Make a @code{SpacingSpanner} and do bookkeeping of shortest"
+ " starting and playing notes.",
+
+ /* create */
+ "SpacingSpanner ",
+
+ /* read */
+ "currentMusicalColumn "
+ "currentCommandColumn "
+ "proportionalNotationDuration ",
+
+ /* write */
+ ""
+ );
*/
Grob *orig = me->original () ? me->original () : me;
- Drul_array<Direction> break_dirs (dynamic_cast<Item*> (me)->break_status_dir (),
- dynamic_cast<Item*> (right_col)->break_status_dir ());
+ Drul_array<Direction> break_dirs (dynamic_cast<Item *> (me)->break_status_dir (),
+ dynamic_cast<Item *> (right_col)->break_status_dir ());
Drul_array<Skyline> skylines = Drul_array<Skyline> (Skyline (RIGHT), Skyline (LEFT));
- Drul_array<vector<Grob*> > items (ly_scm2link_array (orig->get_object ("left-items")),
- ly_scm2link_array (orig->get_object ("right-items")));
+ Drul_array<vector<Grob *> > items (ly_scm2link_array (orig->get_object ("left-items")),
+ ly_scm2link_array (orig->get_object ("right-items")));
Grob *system = me->get_system ();
- Grob *left_col = dynamic_cast<Item*> (me)->get_column ();
+ Grob *left_col = dynamic_cast<Item *> (me)->get_column ();
- Drul_array<Grob*> columns (left_col, right_col);
+ Drul_array<Grob *> columns (left_col, right_col);
Direction d = LEFT;
do
{
for (vsize i = 0; i < items[d].size (); i++)
- {
- Item *g = dynamic_cast<Item*> (items[d][i]);
- if (g)
- if (Item *piece = g->find_prebroken_piece (break_dirs[d]))
- g = piece;
-
- if (g && Separation_item::has_interface (g) && g->get_column () == columns[d])
- {
- SCM sky_scm = g->get_property ("horizontal-skylines");
- Skyline_pair *sky = Skyline_pair::unsmob (sky_scm);
-
- extract_grob_set (g, "elements", elts);
- Grob *ycommon = common_refpoint_of_array (elts, g, Y_AXIS);
- Real shift = ycommon->pure_relative_y_coordinate (system, 0, INT_MAX);
-
- skylines[d].shift (-shift);
-
- if (sky)
- skylines[d].merge ((*sky)[-d]);
- else
- programming_error ("separation item has no skyline");
-
- if (d == RIGHT && items[LEFT].size ())
- skylines[d].merge (Separation_item::conditional_skyline (items[d][i], items[LEFT][0]));
-
- skylines[d].shift (shift);
- }
- }
+ {
+ Item *g = dynamic_cast<Item *> (items[d][i]);
+ if (g)
+ if (Item *piece = g->find_prebroken_piece (break_dirs[d]))
+ g = piece;
+
+ if (g && Separation_item::has_interface (g) && g->get_column () == columns[d])
+ {
+ SCM sky_scm = g->get_property ("horizontal-skylines");
+ Skyline_pair *sky = Skyline_pair::unsmob (sky_scm);
+
+ extract_grob_set (g, "elements", elts);
+ Grob *ycommon = common_refpoint_of_array (elts, g, Y_AXIS);
+ Real shift = ycommon->pure_relative_y_coordinate (system, 0, INT_MAX);
+
+ skylines[d].shift (-shift);
+
+ if (sky)
+ skylines[d].merge ((*sky)[-d]);
+ else
+ programming_error ("separation item has no skyline");
+
+ if (d == RIGHT && items[LEFT].size ())
+ skylines[d].merge (Separation_item::conditional_skyline (items[d][i], items[LEFT][0]));
+
+ skylines[d].shift (shift);
+ }
+ }
}
while (flip (&d) != LEFT);
int rank = Paper_column::get_rank (col);
if (rank < min_rank)
- {
- min_rank = rank;
- mincol = col;
- }
+ {
+ min_rank = rank;
+ mincol = col;
+ }
}
return mincol;
return dynamic_cast<Item *> (me)->get_column ();
}
-static vector<Item*>
-get_note_columns (vector<Grob*> const &elts)
+static vector<Item *>
+get_note_columns (vector<Grob *> const &elts)
{
- vector<Item*> ret;
+ vector<Item *> ret;
for (vsize i = 0; i < elts.size (); i++)
{
if (Note_column::has_interface (elts[i]))
- ret.push_back (dynamic_cast<Item*> (elts[i]));
+ ret.push_back (dynamic_cast<Item *> (elts[i]));
else if (Separation_item::has_interface (elts[i]))
- {
- extract_grob_set (elts[i], "elements", more_elts);
- vector<Item*> ncs = get_note_columns (more_elts);
+ {
+ extract_grob_set (elts[i], "elements", more_elts);
+ vector<Item *> ncs = get_note_columns (more_elts);
- ret.insert (ret.end (), ncs.begin (), ncs.end ());
- }
+ ret.insert (ret.end (), ncs.begin (), ncs.end ());
+ }
}
return ret;
}
-vector<Item*>
+vector<Item *>
Spacing_interface::right_note_columns (Grob *me)
{
extract_grob_set (me, "right-items", elts);
return get_note_columns (elts);
}
-vector<Item*>
+vector<Item *>
Spacing_interface::left_note_columns (Grob *me)
{
extract_grob_set (me, "left-items", elts);
*/
Grob *
Spacing_interface::extremal_break_aligned_grob (Grob *me,
- Direction d,
- Direction break_dir,
- Interval *last_ext)
+ Direction d,
+ Direction break_dir,
+ Interval *last_ext)
{
Grob *col = 0;
last_ext->set_empty ();
for (vsize i = elts.size (); i--;)
{
- Item *break_item = dynamic_cast<Item*> (elts[i]);
+ Item *break_item = dynamic_cast<Item *> (elts[i]);
if (break_item->break_status_dir () != break_dir)
- break_item = break_item->find_prebroken_piece (break_dir);
+ break_item = break_item->find_prebroken_piece (break_dir);
if (!break_item || !scm_is_pair (break_item->get_property ("space-alist")))
- continue;
+ continue;
if (!col)
- col = dynamic_cast<Item*> (elts[0])->get_column ()->find_prebroken_piece (break_dir);
+ col = dynamic_cast<Item *> (elts[0])->get_column ()->find_prebroken_piece (break_dir);
Interval ext = break_item->extent (col, X_AXIS);
if (ext.is_empty ())
- continue;
+ continue;
if (!last_grob
- || (last_grob && d * (ext[-d]- (*last_ext)[-d]) < 0))
- {
- *last_ext = ext;
- last_grob = break_item;
- }
+ || (last_grob && d * (ext[-d] - (*last_ext)[-d]) < 0))
+ {
+ *last_ext = ext;
+ last_grob = break_item;
+ }
}
return last_grob;
}
-
ADD_INTERFACE (Spacing_interface,
- "This object calculates the desired and minimum distances"
- " between two columns.",
+ "This object calculates the desired and minimum distances"
+ " between two columns.",
- /* properties */
- "left-items "
- "right-items "
- );
+ /* properties */
+ "left-items "
+ "right-items "
+ );
Item *left = 0;
Item *right = 0;
- vector<Item*> clique;
+ vector<Item *> clique;
while (1)
- {
- SCM between = loose->get_object ("between-cols");
- if (!scm_is_pair (between))
- break;
+ {
+ SCM between = loose->get_object ("between-cols");
+ if (!scm_is_pair (between))
+ break;
- /* If the line was broken at one of the loose columns, split
- the clique at that column. */
- if (!loose->get_system ())
- break;
+ /* If the line was broken at one of the loose columns, split
+ the clique at that column. */
+ if (!loose->get_system ())
+ break;
- Paper_column *le = dynamic_cast<Paper_column *> (unsmob_grob (scm_car (between)));
- Paper_column *re = dynamic_cast<Paper_column *> (unsmob_grob (scm_cdr (between)));
+ Paper_column *le = dynamic_cast<Paper_column *> (unsmob_grob (scm_car (between)));
+ Paper_column *re = dynamic_cast<Paper_column *> (unsmob_grob (scm_cdr (between)));
- if (! (le && re))
- break;
+ if (! (le && re))
+ break;
- if (!left && le)
- {
- left = le->get_column ();
- if (!left->get_system ())
- left = left->find_prebroken_piece (RIGHT);
+ if (!left && le)
+ {
+ left = le->get_column ();
+ if (!left->get_system ())
+ left = left->find_prebroken_piece (RIGHT);
- clique.push_back (left);
- }
+ clique.push_back (left);
+ }
- clique.push_back (loose);
+ clique.push_back (loose);
- divide_over++;
- loose = right = re->get_column ();
- }
+ divide_over++;
+ loose = right = re->get_column ();
+ }
if (!right)
- {
- programming_error ("Can't attach loose column sensibly. Attaching to end of system.");
- right = which->get_bound (RIGHT);
- }
+ {
+ programming_error ("Can't attach loose column sensibly. Attaching to end of system.");
+ right = which->get_bound (RIGHT);
+ }
if (right->get_system ())
- ; /* do nothing */
+ ; /* do nothing */
else if (right->find_prebroken_piece (LEFT)
- && right->find_prebroken_piece (LEFT)->get_system () == which)
- right = right->find_prebroken_piece (LEFT);
+ && right->find_prebroken_piece (LEFT)->get_system () == which)
+ right = right->find_prebroken_piece (LEFT);
else if (Paper_column::get_rank (which->get_bound (RIGHT)) < Paper_column::get_rank (right))
- right = which->get_bound (RIGHT);
+ right = which->get_bound (RIGHT);
else
- {
- clique.back ()->programming_error ("Loose column does not have right side to attach to.");
- System *base_system = dynamic_cast<System*> (which->original ());
- int j = Paper_column::get_rank (clique.back ()) + 1;
- int end_rank = Paper_column::get_rank (which->get_bound (RIGHT));
- extract_grob_set (base_system, "columns", base_cols);
- for (; j < end_rank; j++)
- {
- if (base_cols[j]->get_system () == which)
- right = dynamic_cast<Item*> ((Grob*)base_cols[j]);
- }
- }
-
+ {
+ clique.back ()->programming_error ("Loose column does not have right side to attach to.");
+ System *base_system = dynamic_cast<System *> (which->original ());
+ int j = Paper_column::get_rank (clique.back ()) + 1;
+ int end_rank = Paper_column::get_rank (which->get_bound (RIGHT));
+ extract_grob_set (base_system, "columns", base_cols);
+ for (; j < end_rank; j++)
+ {
+ if (base_cols[j]->get_system () == which)
+ right = dynamic_cast<Item *> ((Grob *)base_cols[j]);
+ }
+ }
+
Grob *common = right->common_refpoint (left, X_AXIS);
clique.push_back (right);
vector<Real> clique_spacing;
clique_spacing.push_back (0.0);
- for (vsize j = 1; j + 1 < clique.size (); j ++)
- {
- Grob *clique_col = clique[j];
-
- Paper_column *loose_col = dynamic_cast<Paper_column *> (clique[j]);
- Paper_column *next_col = dynamic_cast<Paper_column *> (clique[j + 1]);
-
- Grob *spacing = unsmob_grob (clique_col->get_object ("spacing"));
- if (Grob *grace_spacing = unsmob_grob (clique_col->get_object ("grace-spacing")))
- {
- spacing = grace_spacing;
- }
-
- Spacing_options options;
- if (spacing)
- options.init_from_grob (spacing);
- else
- programming_error ("Column without spacing object");
-
- Real base_note_space = 0.0;
-
- if (Paper_column::is_musical (next_col)
- && Paper_column::is_musical (loose_col))
- base_note_space = Spacing_spanner::note_spacing (spacing, loose_col, next_col,
- &options);
- else
- {
- Spring spring = Spacing_spanner::standard_breakable_column_spacing (spacing,
- loose_col, next_col,
- &options);
-
- base_note_space = spring.distance ();
- }
-
- base_note_space = max (base_note_space,
- robust_relative_extent (loose_col, loose_col, X_AXIS)[RIGHT]
- - robust_relative_extent (next_col, next_col, X_AXIS)[LEFT]);
-
- clique_spacing.push_back (base_note_space);
- }
+ for (vsize j = 1; j + 1 < clique.size (); j++)
+ {
+ Grob *clique_col = clique[j];
+
+ Paper_column *loose_col = dynamic_cast<Paper_column *> (clique[j]);
+ Paper_column *next_col = dynamic_cast<Paper_column *> (clique[j + 1]);
+
+ Grob *spacing = unsmob_grob (clique_col->get_object ("spacing"));
+ if (Grob *grace_spacing = unsmob_grob (clique_col->get_object ("grace-spacing")))
+ {
+ spacing = grace_spacing;
+ }
+
+ Spacing_options options;
+ if (spacing)
+ options.init_from_grob (spacing);
+ else
+ programming_error ("Column without spacing object");
+
+ Real base_note_space = 0.0;
+
+ if (Paper_column::is_musical (next_col)
+ && Paper_column::is_musical (loose_col))
+ base_note_space = Spacing_spanner::note_spacing (spacing, loose_col, next_col,
+ &options);
+ else
+ {
+ Spring spring = Spacing_spanner::standard_breakable_column_spacing (spacing,
+ loose_col, next_col,
+ &options);
+
+ base_note_space = spring.distance ();
+ }
+
+ base_note_space = max (base_note_space,
+ robust_relative_extent (loose_col, loose_col, X_AXIS)[RIGHT]
+ - robust_relative_extent (next_col, next_col, X_AXIS)[LEFT]);
+
+ clique_spacing.push_back (base_note_space);
+ }
Real default_padding = 1.0;
clique_spacing.push_back (default_padding);
Real right_point = robust_relative_extent (clique.back (), common, X_AXIS)[LEFT];
-
-
+
Grob *finished_right_column = clique.back ();
-
+
for (vsize j = clique.size () - 2; j > 0; j--)
- {
- Paper_column *clique_col = dynamic_cast<Paper_column *> (clique[j]);
-
- right_point = finished_right_column->relative_coordinate (common, X_AXIS);
+ {
+ Paper_column *clique_col = dynamic_cast<Paper_column *> (clique[j]);
+
+ right_point = finished_right_column->relative_coordinate (common, X_AXIS);
+
+ Real distance_to_next = clique_spacing[j];
- Real distance_to_next = clique_spacing[j];
-
- Real my_offset = right_point - distance_to_next;
+ Real my_offset = right_point - distance_to_next;
- clique_col->translate_axis (my_offset - clique_col->relative_coordinate (common, X_AXIS), X_AXIS);
+ clique_col->translate_axis (my_offset - clique_col->relative_coordinate (common, X_AXIS), X_AXIS);
- finished_right_column = clique_col;
- }
+ finished_right_column = clique_col;
+ }
}
}
= to_boolean (me->get_property ("strict-grace-spacing"));
shortest_duration_space_ = robust_scm2double (me->get_property ("shortest-duration-space"), 1);
-
Moment shortest_dur = robust_scm2moment (me->get_property ("common-shortest-duration"),
- Moment (Rational (1,8), Rational (1,16)));
+ Moment (Rational (1, 8), Rational (1, 16)));
if (shortest_dur.main_part_)
global_shortest_ = shortest_dur.main_part_;
global_shortest_ = Rational (1, 8);
}
-
-
/*
Get the measure wide ant for arithmetic spacing.
*/
if (d < global_shortest_)
{
/*
- We don't space really short notes using the log of the
- duration, since it would disproportionally stretches the long
- notes in a piece. In stead, we use geometric spacing with constant 0.5
- (i.e. linear.)
+ We don't space really short notes using the log of the
+ duration, since it would disproportionally stretches the long
+ notes in a piece. In stead, we use geometric spacing with constant 0.5
+ (i.e. linear.)
- This should probably be tunable, to use other base numbers.
+ This should probably be tunable, to use other base numbers.
- In Mozart hrn3 by EB., we have 8th note = 3.9 mm (total), 16th note =
- 3.6 mm (total). head-width = 2.4, so we 1.2mm for 16th, 1.5
- mm for 8th. (white space), suggesting that we use
+ In Mozart hrn3 by EB., we have 8th note = 3.9 mm (total), 16th note =
+ 3.6 mm (total). head-width = 2.4, so we 1.2mm for 16th, 1.5
+ mm for 8th. (white space), suggesting that we use
- (1.2 / 1.5)^{-log2(duration ratio)}
+ (1.2 / 1.5)^{-log2(duration ratio)}
*/
else
{
/*
- John S. Gourlay. ``Spacing a Line of Music, '' Technical
- Report OSU-CISRC-10/87-TR35, Department of Computer and
- Information Science, The Ohio State University, 1987.
+ John S. Gourlay. ``Spacing a Line of Music, '' Technical
+ Report OSU-CISRC-10/87-TR35, Department of Computer and
+ Information Science, The Ohio State University, 1987.
*/
Real log = log_2 (global_shortest_);
k -= log;
#include "system.hh"
#include "warn.hh"
-vector<Grob*>
+vector<Grob *>
Spacing_spanner::get_columns (Grob *me_grob)
{
- Spanner *me = dynamic_cast<Spanner*> (me_grob);
- vector<Grob*> all (get_root_system (me)->used_columns ());
- vsize start = binary_search (all, (Grob*)me->get_bound (LEFT),
- &Paper_column::less_than);
- vsize end = binary_search (all, (Grob*) me->get_bound (RIGHT),
- &Paper_column::less_than);
-
- all = vector<Grob*> (all.begin () + start,
- all.begin () + end + 1);
+ Spanner *me = dynamic_cast<Spanner *> (me_grob);
+ vector<Grob *> all (get_root_system (me)->used_columns ());
+ vsize start = binary_search (all, (Grob *)me->get_bound (LEFT),
+ &Paper_column::less_than);
+ vsize end = binary_search (all, (Grob *) me->get_bound (RIGHT),
+ &Paper_column::less_than);
+
+ all = vector<Grob *> (all.begin () + start,
+ all.begin () + end + 1);
return all;
}
*/
Spacing_options options;
options.init_from_grob (me);
- vector<Grob*> cols = Spacing_spanner::get_columns (me);
+ vector<Grob *> cols = Spacing_spanner::get_columns (me);
set_explicit_neighbor_columns (cols);
prune_loose_columns (me, &cols, &options);
*/
MAKE_SCHEME_CALLBACK (Spacing_spanner, calc_common_shortest_duration, 1);
-SCM
+SCM
Spacing_spanner::calc_common_shortest_duration (SCM grob)
{
Spanner *me = unsmob_spanner (grob);
- vector<Grob*> cols (get_columns (me));
-
+ vector<Grob *> cols (get_columns (me));
+
/*
ascending in duration
*/
for (vsize i = 0; i < cols.size (); i++)
{
if (Paper_column::is_musical (cols[i]))
- {
- Moment *when = unsmob_moment (cols[i]->get_property ("when"));
-
- /*
- ignore grace notes for shortest notes.
- */
- if (when && when->grace_part_)
- continue;
-
- SCM st = cols[i]->get_property ("shortest-starter-duration");
- Moment this_shortest = *unsmob_moment (st);
- assert (this_shortest.to_bool ());
- shortest_in_measure = min (shortest_in_measure, this_shortest.main_part_);
- }
+ {
+ Moment *when = unsmob_moment (cols[i]->get_property ("when"));
+
+ /*
+ ignore grace notes for shortest notes.
+ */
+ if (when && when->grace_part_)
+ continue;
+
+ SCM st = cols[i]->get_property ("shortest-starter-duration");
+ Moment this_shortest = *unsmob_moment (st);
+ assert (this_shortest.to_bool ());
+ shortest_in_measure = min (shortest_in_measure, this_shortest.main_part_);
+ }
else if (!shortest_in_measure.is_infinity ()
- && Paper_column::is_breakable (cols[i]))
- {
- vsize j = 0;
- for (; j < durations.size (); j++)
- {
- if (durations[j] > shortest_in_measure)
- {
- counts.insert (counts.begin () + j, 1);
- durations.insert (durations.begin () + j, shortest_in_measure);
- break;
- }
- else if (durations[j] == shortest_in_measure)
- {
- counts[j]++;
- break;
- }
- }
-
- if (durations.size () == j)
- {
- durations.push_back (shortest_in_measure);
- counts.push_back (1);
- }
-
- shortest_in_measure.set_infinite (1);
- }
+ && Paper_column::is_breakable (cols[i]))
+ {
+ vsize j = 0;
+ for (; j < durations.size (); j++)
+ {
+ if (durations[j] > shortest_in_measure)
+ {
+ counts.insert (counts.begin () + j, 1);
+ durations.insert (durations.begin () + j, shortest_in_measure);
+ break;
+ }
+ else if (durations[j] == shortest_in_measure)
+ {
+ counts[j]++;
+ break;
+ }
+ }
+
+ if (durations.size () == j)
+ {
+ durations.push_back (shortest_in_measure);
+ counts.push_back (1);
+ }
+
+ shortest_in_measure.set_infinite (1);
+ }
}
vsize max_idx = VPOS;
for (vsize i = durations.size (); i--;)
{
if (counts[i] >= max_count)
- {
- max_idx = i;
- max_count = counts[i];
- }
+ {
+ max_idx = i;
+ max_count = counts[i];
+ }
}
SCM bsd = me->get_property ("base-shortest-duration");
void
Spacing_spanner::generate_pair_spacing (Grob *me,
- Paper_column *left_col, Paper_column *right_col,
- Paper_column *after_right_col,
- Spacing_options const *options)
+ Paper_column *left_col, Paper_column *right_col,
+ Paper_column *after_right_col,
+ Spacing_options const *options)
{
if (Paper_column::is_musical (left_col))
{
if (!Paper_column::is_musical (right_col)
- && (options->float_nonmusical_columns_ || to_boolean (right_col->get_property ("maybe-loose")))
- && after_right_col
- && Paper_column::is_musical (after_right_col))
- {
- /*
- TODO: should generate rods to prevent collisions.
- */
- musical_column_spacing (me, left_col, after_right_col, options);
- right_col->set_object ("between-cols", scm_cons (left_col->self_scm (),
- after_right_col->self_scm ()));
- }
+ && (options->float_nonmusical_columns_ || to_boolean (right_col->get_property ("maybe-loose")))
+ && after_right_col
+ && Paper_column::is_musical (after_right_col))
+ {
+ /*
+ TODO: should generate rods to prevent collisions.
+ */
+ musical_column_spacing (me, left_col, after_right_col, options);
+ right_col->set_object ("between-cols", scm_cons (left_col->self_scm (),
+ after_right_col->self_scm ()));
+ }
else
- musical_column_spacing (me, left_col, right_col, options);
+ musical_column_spacing (me, left_col, right_col, options);
if (Item *rb = right_col->find_prebroken_piece (LEFT))
- musical_column_spacing (me, left_col, rb, options);
+ musical_column_spacing (me, left_col, rb, options);
}
else
{
/*
- The case that the right part is broken as well is rather
- rare, but it is possible, eg. with a single empty measure,
- or if one staff finishes a tad earlier than the rest.
+ The case that the right part is broken as well is rather
+ rare, but it is possible, eg. with a single empty measure,
+ or if one staff finishes a tad earlier than the rest.
*/
Item *lb = left_col->find_prebroken_piece (RIGHT);
Item *rb = right_col->find_prebroken_piece (LEFT);
if (left_col && right_col)
- breakable_column_spacing (me, left_col, right_col, options);
+ breakable_column_spacing (me, left_col, right_col, options);
if (lb && right_col)
- breakable_column_spacing (me, lb, right_col, options);
+ breakable_column_spacing (me, lb, right_col, options);
if (left_col && rb)
- breakable_column_spacing (me, left_col, rb, options);
+ breakable_column_spacing (me, left_col, rb, options);
if (lb && rb)
- breakable_column_spacing (me, lb, rb, options);
+ breakable_column_spacing (me, lb, rb, options);
}
}
static void
-set_column_rods (vector<Grob*> const &cols, Real padding)
+set_column_rods (vector<Grob *> const &cols, Real padding)
{
/* distances[i] will be the minimum distance between column i and column i+1 */
vector<Real> distances;
for (vsize i = 1; i < cols.size (); i++)
{
- assert (distances.size () == i-1);
+ assert (distances.size () == i - 1);
- Item *r = dynamic_cast<Item*> (cols[i]);
+ Item *r = dynamic_cast<Item *> (cols[i]);
Item *rb = r->find_prebroken_piece (LEFT);
if (Separation_item::is_empty (r) && (!rb || Separation_item::is_empty (rb)))
- {
- distances.push_back (0);
- continue;
- }
+ {
+ distances.push_back (0);
+ continue;
+ }
Skyline_pair *skys = Skyline_pair::unsmob (r->get_property ("horizontal-skylines"));
Real right_stickout = skys ? (*skys)[LEFT].max_height () : 0.0;
/* min rather than max because right-stickout will be negative if the right-hand column
- sticks out a lot to the left */
+ sticks out a lot to the left */
right_stickout = min (right_stickout,
- Separation_item::conditional_skyline (r, cols[i-1]).max_height ());
+ Separation_item::conditional_skyline (r, cols[i - 1]).max_height ());
- Drul_array<Item*> r_cols (r, rb);
+ Drul_array<Item *> r_cols (r, rb);
Drul_array<Real> cur_dist (0.0, 0.0);
/* This is an inner loop and hence it is potentially quadratic. However, we only continue
- as long as there is a rod to insert. Therefore, this loop will usually only execute
- a constant number of times per iteration of the outer loop. */
+ as long as there is a rod to insert. Therefore, this loop will usually only execute
+ a constant number of times per iteration of the outer loop. */
for (vsize j = i; j--;)
- {
- Item *l = dynamic_cast<Item*> (cols[j]);
- Item *lb = l->find_prebroken_piece (RIGHT);
- Skyline_pair *skys = Skyline_pair::unsmob (l->get_property ("horizontal-skylines"));
- Real left_stickout = skys ? (*skys)[RIGHT].max_height () : 0.0;
- bool done = true;
-
- Direction d = LEFT;
- do
- {
- if (j < i-1)
- cur_dist[d] += distances[j];
-
- Item *r_col = r_cols[d];
- bool touches = right_stickout - left_stickout + cur_dist[d] < 0.0;
- Real dist = 0.0;
-
- /* we set a distance for the line-starter column even if its non-broken counterpart
- doesn't touch the right column. */
- if (lb)
- Separation_item::set_distance (lb, r_col, padding);
-
- if (touches || j == i-1)
- dist = Separation_item::set_distance (l, r_col, padding);
-
- if (j == i-1 && d == LEFT)
- distances.push_back (dist);
-
- if (j == i-1)
- cur_dist[d] = distances[j];
-
- cur_dist[d] = max (cur_dist[d], dist);
- done = done && !touches;
- }
- while (flip (&d) != LEFT && rb);
-
- /* we need the empty check for gregorian notation, where there are a lot of
- extraneous paper-columns that we need to skip over */
- if (done && !Separation_item::is_empty (l))
- break;
- }
+ {
+ Item *l = dynamic_cast<Item *> (cols[j]);
+ Item *lb = l->find_prebroken_piece (RIGHT);
+ Skyline_pair *skys = Skyline_pair::unsmob (l->get_property ("horizontal-skylines"));
+ Real left_stickout = skys ? (*skys)[RIGHT].max_height () : 0.0;
+ bool done = true;
+
+ Direction d = LEFT;
+ do
+ {
+ if (j < i - 1)
+ cur_dist[d] += distances[j];
+
+ Item *r_col = r_cols[d];
+ bool touches = right_stickout - left_stickout + cur_dist[d] < 0.0;
+ Real dist = 0.0;
+
+ /* we set a distance for the line-starter column even if its non-broken counterpart
+ doesn't touch the right column. */
+ if (lb)
+ Separation_item::set_distance (lb, r_col, padding);
+
+ if (touches || j == i - 1)
+ dist = Separation_item::set_distance (l, r_col, padding);
+
+ if (j == i - 1 && d == LEFT)
+ distances.push_back (dist);
+
+ if (j == i - 1)
+ cur_dist[d] = distances[j];
+
+ cur_dist[d] = max (cur_dist[d], dist);
+ done = done && !touches;
+ }
+ while (flip (&d) != LEFT && rb);
+
+ /* we need the empty check for gregorian notation, where there are a lot of
+ extraneous paper-columns that we need to skip over */
+ if (done && !Separation_item::is_empty (l))
+ break;
+ }
}
}
-
void
Spacing_spanner::generate_springs (Grob *me,
- vector<Grob*> const &cols,
- Spacing_options const *options)
+ vector<Grob *> const &cols,
+ Spacing_options const *options)
{
- Paper_column *prev = dynamic_cast<Paper_column*> (cols[0]);
+ Paper_column *prev = dynamic_cast<Paper_column *> (cols[0]);
for (vsize i = 1; i < cols.size (); i++)
{
Paper_column *col = dynamic_cast<Paper_column *> (cols[i]);
- Paper_column *next = (i + 1 < cols.size ()) ? dynamic_cast<Paper_column *> (cols[i+1]) : 0;
-
+ Paper_column *next = (i + 1 < cols.size ()) ? dynamic_cast<Paper_column *> (cols[i + 1]) : 0;
+
generate_pair_spacing (me, prev, col, next, options);
prev = col;
*/
void
Spacing_spanner::musical_column_spacing (Grob *me,
- Item *left_col,
- Item *right_col,
- Spacing_options const *options)
+ Item *left_col,
+ Item *right_col,
+ Spacing_options const *options)
{
Real base_note_space = note_spacing (me, left_col, right_col, options);
Spring spring;
extract_grob_set (left_col, "spacing-wishes", wishes);
for (vsize i = 0; i < wishes.size (); i++)
- {
- Grob *wish = wishes[i];
- if (Spacing_interface::left_column (wish) != left_col)
- {
- /* This shouldn't really happen, but the ancient music
- stuff really messes up the spacing code, grrr
- */
- continue;
- }
-
- extract_grob_set (wish, "right-items", right_items);
- bool found_matching_column = false;
- for (vsize j = 0; j < right_items.size (); j++)
- {
- Item *it = dynamic_cast<Item*> (right_items[j]);
- if (it && (right_col == it->get_column ()
- || right_col->original () == it->get_column ()))
- found_matching_column = true;
- }
-
- /*
- This is probably a waste of time in the case of polyphonic
- music. */
- if (found_matching_column && Note_spacing::has_interface (wish))
- {
- Real inc = options->increment_;
- Grob *gsp = unsmob_grob (left_col->get_object ("grace-spacing"));
- if (gsp && Paper_column::when_mom (left_col).grace_part_)
- {
- Spacing_options grace_opts;
- grace_opts.init_from_grob (gsp);
- inc = grace_opts.increment_;
- }
- springs.push_back (Note_spacing::get_spacing (wish, right_col, base_note_space, inc));
- }
- }
+ {
+ Grob *wish = wishes[i];
+ if (Spacing_interface::left_column (wish) != left_col)
+ {
+ /* This shouldn't really happen, but the ancient music
+ stuff really messes up the spacing code, grrr
+ */
+ continue;
+ }
+
+ extract_grob_set (wish, "right-items", right_items);
+ bool found_matching_column = false;
+ for (vsize j = 0; j < right_items.size (); j++)
+ {
+ Item *it = dynamic_cast<Item *> (right_items[j]);
+ if (it && (right_col == it->get_column ()
+ || right_col->original () == it->get_column ()))
+ found_matching_column = true;
+ }
+
+ /*
+ This is probably a waste of time in the case of polyphonic
+ music. */
+ if (found_matching_column && Note_spacing::has_interface (wish))
+ {
+ Real inc = options->increment_;
+ Grob *gsp = unsmob_grob (left_col->get_object ("grace-spacing"));
+ if (gsp && Paper_column::when_mom (left_col).grace_part_)
+ {
+ Spacing_options grace_opts;
+ grace_opts.init_from_grob (gsp);
+ inc = grace_opts.increment_;
+ }
+ springs.push_back (Note_spacing::get_spacing (wish, right_col, base_note_space, inc));
+ }
+ }
if (springs.empty ())
- {
-
- if (!Paper_column::is_musical (right_col))
- {
- /*
- There used to be code that examined left_col->extent
- (X_AXIS), but this is resulted in unexpected wide
- spacing, because the width of s^"text" output is also
- taken into account here.
- */
- spring = Spring (max (base_note_space, options->increment_),
- options->increment_);
- }
- else
- {
- /*
- Min distance should be 0.0. If there are no spacing
- wishes, we're probably dealing with polyphonic spacing
- of hemiolas.
- */
- spring = Spring (base_note_space, 0.0);
- }
- }
+ {
+
+ if (!Paper_column::is_musical (right_col))
+ {
+ /*
+ There used to be code that examined left_col->extent
+ (X_AXIS), but this is resulted in unexpected wide
+ spacing, because the width of s^"text" output is also
+ taken into account here.
+ */
+ spring = Spring (max (base_note_space, options->increment_),
+ options->increment_);
+ }
+ else
+ {
+ /*
+ Min distance should be 0.0. If there are no spacing
+ wishes, we're probably dealing with polyphonic spacing
+ of hemiolas.
+ */
+ spring = Spring (base_note_space, 0.0);
+ }
+ }
else
- spring = merge_springs (springs);
+ spring = merge_springs (springs);
}
if (Paper_column::when_mom (right_col).grace_part_
&& !Paper_column::when_mom (left_col).grace_part_)
{
/*
- Ugh. 0.8 is arbitrary.
+ Ugh. 0.8 is arbitrary.
*/
spring *= 0.8;
}
if (options->packed_)
{
/*
- In packed mode, pack notes as tight as possible. This makes
- sense mostly in combination with ragged-right mode: the notes
- are then printed at minimum distance. This is mostly useful
- for ancient notation, but may also be useful for some flavours
- of contemporary music. If not in ragged-right mode, lily will
- pack as many bars of music as possible into a line, but the
- line will then be stretched to fill the whole linewidth.
-
- Note that we don't actually pack things as tightly as possible:
- we don't allow the next column to begin before this one ends.
+ In packed mode, pack notes as tight as possible. This makes
+ sense mostly in combination with ragged-right mode: the notes
+ are then printed at minimum distance. This is mostly useful
+ for ancient notation, but may also be useful for some flavours
+ of contemporary music. If not in ragged-right mode, lily will
+ pack as many bars of music as possible into a line, but the
+ line will then be stretched to fill the whole linewidth.
+
+ Note that we don't actually pack things as tightly as possible:
+ we don't allow the next column to begin before this one ends.
*/
/* FIXME: the else clause below is the "right" thing to do,
- but we can't do it because of all the empty columns that the
- ligature-engravers leave lying around. In that case, the extent of
- the column is incorrect because it includes note-heads that aren't
- there. We get around this by only including the column extent if
- the left-hand column is "genuine". This is a dirty hack and it
- should be fixed in the ligature-engravers. --jneem
+ but we can't do it because of all the empty columns that the
+ ligature-engravers leave lying around. In that case, the extent of
+ the column is incorrect because it includes note-heads that aren't
+ there. We get around this by only including the column extent if
+ the left-hand column is "genuine". This is a dirty hack and it
+ should be fixed in the ligature-engravers. --jneem
*/
if (Paper_column::is_extraneous_column_from_ligature (left_col))
- spring.set_distance (spring.min_distance ());
+ spring.set_distance (spring.min_distance ());
else
- spring.set_distance (max (left_col->extent (left_col, X_AXIS)[RIGHT],
- spring.min_distance ()));
+ spring.set_distance (max (left_col->extent (left_col, X_AXIS)[RIGHT],
+ spring.min_distance ()));
spring.set_inverse_stretch_strength (1.0);
}
|| !Paper_column::is_musical (col)
|| !Paper_column::is_used (next))
return false;
-
- Moment dt =
- Paper_column::when_mom (next) - Paper_column::when_mom (col);
-
+
+ Moment dt
+ = Paper_column::when_mom (next) - Paper_column::when_mom (col);
+
Moment *len = unsmob_moment (left->get_property ("measure-length"));
if (!len)
return false;
-
+
/*
Don't check for exact measure length, since ending measures are
often shortened due to pickups.
*/
if (dt.main_part_ > len->main_part_ / Rational (2)
&& (next->is_broken ()
- || next->break_status_dir ()))
+ || next->break_status_dir ()))
return true;
return false;
*/
void
Spacing_spanner::breakable_column_spacing (Grob *me, Item *l, Item *r,
- Spacing_options const *options)
+ Spacing_options const *options)
{
vector<Spring> springs;
Spring spring;
extract_grob_set (l, "spacing-wishes", wishes);
for (vsize i = 0; i < wishes.size (); i++)
- {
- Item *spacing_grob = dynamic_cast<Item *> (wishes[i]);
+ {
+ Item *spacing_grob = dynamic_cast<Item *> (wishes[i]);
- if (!spacing_grob || !Staff_spacing::has_interface (spacing_grob))
- continue;
+ if (!spacing_grob || !Staff_spacing::has_interface (spacing_grob))
+ continue;
- /*
- column for the left one settings should be ok due automatic
- pointer munging.
- */
- assert (spacing_grob->get_column () == l);
+ /*
+ column for the left one settings should be ok due automatic
+ pointer munging.
+ */
+ assert (spacing_grob->get_column () == l);
- springs.push_back (Staff_spacing::get_spacing (spacing_grob, r));
- }
+ springs.push_back (Staff_spacing::get_spacing (spacing_grob, r));
+ }
}
if (springs.empty ())
if (Paper_column::when_mom (r).grace_part_)
{
/*
- Correct for grace notes.
-
- Ugh. The 0.8 is arbitrary.
+ Correct for grace notes.
+
+ Ugh. The 0.8 is arbitrary.
*/
spring *= 0.8;
}
spring.set_distance (spring.distance () + full_measure_extra_space);
spring.set_default_compress_strength ();
}
-
+
if (options->stretch_uniformly_ && l->break_status_dir () != RIGHT)
{
spring.set_min_distance (0.0);
}
ADD_INTERFACE (Spacing_spanner,
- "The space taken by a note is dependent on its duration."
- " Doubling a duration adds @code{spacing-increment} to the"
- " space. The most common shortest note gets"
- " @code{shortest-duration-space}. Notes that are even shorter"
- " are spaced proportonial to their duration.\n"
- "\n"
- "Typically, the increment is the width of a black note head."
- " In a piece with lots of 8th notes, and some 16th notes, the"
- " eighth note gets a 2@tie{}note heads width (i.e., the space"
- " following a note is a 1@tie{}note head width). A 16th note"
- " is followed by 0.5 note head width. The quarter note is"
- " followed by 3@tie{}NHW, the half by 4@tie{}NHW, etc.",
-
- /* properties */
- "average-spacing-wishes "
- "base-shortest-duration "
- "common-shortest-duration "
- "packed-spacing "
- "shortest-duration-space "
- "spacing-increment "
- "strict-grace-spacing "
- "strict-note-spacing "
- "uniform-stretching "
- );
+ "The space taken by a note is dependent on its duration."
+ " Doubling a duration adds @code{spacing-increment} to the"
+ " space. The most common shortest note gets"
+ " @code{shortest-duration-space}. Notes that are even shorter"
+ " are spaced proportonial to their duration.\n"
+ "\n"
+ "Typically, the increment is the width of a black note head."
+ " In a piece with lots of 8th notes, and some 16th notes, the"
+ " eighth note gets a 2@tie{}note heads width (i.e., the space"
+ " following a note is a 1@tie{}note head width). A 16th note"
+ " is followed by 0.5 note head width. The quarter note is"
+ " followed by 3@tie{}NHW, the half by 4@tie{}NHW, etc.",
+
+ /* properties */
+ "average-spacing-wishes "
+ "base-shortest-duration "
+ "common-shortest-duration "
+ "packed-spacing "
+ "shortest-duration-space "
+ "spacing-increment "
+ "strict-grace-spacing "
+ "strict-note-spacing "
+ "uniform-stretching "
+ );
private:
Item *span_arpeggio_;
- vector<Grob*> arpeggios_;
+ vector<Grob *> arpeggios_;
};
Span_arpeggio_engraver::Span_arpeggio_engraver ()
void
Span_arpeggio_engraver::acknowledge_arpeggio (Grob_info info)
{
- if (info.origin_contexts (this).size ()) // huh? what's this test for?
+ if (info.origin_contexts (this).size ()) // huh? what's this test for?
arpeggios_.push_back (info.grob ());
}
if (span_arpeggio_)
{
/*
- we do this very late, to make sure we also catch `extra'
- side-pos support like accidentals.
+ we do this very late, to make sure we also catch `extra'
+ side-pos support like accidentals.
*/
for (vsize j = 0; j < arpeggios_.size (); j++)
- {
- extract_grob_set (arpeggios_[j], "stems", stems);
- for (vsize i = 0; i < stems.size (); i++)
- Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("stems"),
- stems[i]);
-
- extract_grob_set (arpeggios_[j], "side-support-elements", sses);
- for (vsize i = 0; i < sses.size (); i++)
- Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("side-support-elements"),
- sses[i]);
-
- /*
- we can't kill the children, since we don't want to the
- previous note to bump into the span arpeggio; so we make
- it transparent. */
- arpeggios_[j]->set_property ("transparent", SCM_BOOL_T);
- }
-
+ {
+ extract_grob_set (arpeggios_[j], "stems", stems);
+ for (vsize i = 0; i < stems.size (); i++)
+ Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("stems"),
+ stems[i]);
+
+ extract_grob_set (arpeggios_[j], "side-support-elements", sses);
+ for (vsize i = 0; i < sses.size (); i++)
+ Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("side-support-elements"),
+ sses[i]);
+
+ /*
+ we can't kill the children, since we don't want to the
+ previous note to bump into the span arpeggio; so we make
+ it transparent. */
+ arpeggios_[j]->set_property ("transparent", SCM_BOOL_T);
+ }
span_arpeggio_->set_parent (arpeggios_[0]->get_parent (Y_AXIS), Y_AXIS);
span_arpeggio_ = 0;
ADD_ACKNOWLEDGER (Span_arpeggio_engraver, arpeggio);
ADD_TRANSLATOR (Span_arpeggio_engraver,
- /* doc */
- "Make arpeggios that span multiple staves.",
+ /* doc */
+ "Make arpeggios that span multiple staves.",
- /* create */
- "Arpeggio ",
+ /* create */
+ "Arpeggio ",
- /* read */
- "connectArpeggios ",
+ /* read */
+ "connectArpeggios ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
class Span_bar_engraver : public Engraver
{
Item *spanbar_;
- vector<Item*> bars_;
+ vector<Item *> bars_;
public:
TRANSLATOR_DECLARATIONS (Span_bar_engraver);
bars_.push_back (it);
if (bars_.size () >= 2 && !spanbar_)
- {
- spanbar_ = make_item ("SpanBar", SCM_EOL);
+ {
+ spanbar_ = make_item ("SpanBar", SCM_EOL);
- spanbar_->set_parent (bars_[0], X_AXIS);
- }
+ spanbar_->set_parent (bars_[0], X_AXIS);
+ }
}
}
if (spanbar_)
{
for (vsize i = 0; i < bars_.size (); i++)
- Span_bar::add_bar (spanbar_, bars_[i]);
+ Span_bar::add_bar (spanbar_, bars_[i]);
SCM vissym = ly_symbol2scm ("break-visibility");
SCM vis = bars_[0]->internal_get_property (vissym);
if (ly_is_equal (spanbar_->internal_get_property (vissym), vis))
- spanbar_->set_property (vissym, vis);
+ spanbar_->set_property (vissym, vis);
spanbar_ = 0;
}
ADD_ACKNOWLEDGER (Span_bar_engraver, bar_line);
ADD_TRANSLATOR (Span_bar_engraver,
- /* doc */
- "Make cross-staff bar lines: It catches all normal bar lines"
- " and draws a single span bar across them.",
+ /* doc */
+ "Make cross-staff bar lines: It catches all normal bar lines"
+ " and draws a single span bar across them.",
- /* create */
- "SpanBar ",
+ /* create */
+ "SpanBar ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "pointer-group-interface.hh"
#include "staff-symbol-referencer.hh"
-
void
Span_bar::add_bar (Grob *me, Grob *b)
{
Grob *bar = elements[i];
Interval ext = Bar_line::bar_y_extent (bar, refp);
if (Grob *staff = Staff_symbol_referencer::get_staff_symbol (bar))
- ext.unite (staff->extent (refp, Y_AXIS));
+ ext.unite (staff->extent (refp, Y_AXIS));
if (ext.is_empty ())
- continue;
+ continue;
extents.push_back (ext);
make_span_bar.push_back (to_boolean (bar->get_property ("allow-span-bar")));
Interval prev_extent = extents[i - 1];
Interval ext = extents[i];
if (!prev_extent.is_empty ())
- {
- Interval l (prev_extent [UP],
- ext[DOWN]);
-
- if (l.is_empty () || !make_span_bar[i])
- {
- /* There is overlap between the bar lines. Do nothing. */
- }
- else
- {
- Stencil interbar = Bar_line::compound_barline (model_bar,
- glyph_string,
- l,
- false);
- span_bar.add_stencil (interbar);
- }
- }
+ {
+ Interval l (prev_extent [UP],
+ ext[DOWN]);
+
+ if (l.is_empty () || !make_span_bar[i])
+ {
+ /* There is overlap between the bar lines. Do nothing. */
+ }
+ else
+ {
+ Stencil interbar = Bar_line::compound_barline (model_bar,
+ glyph_string,
+ l,
+ false);
+ span_bar.add_stencil (interbar);
+ }
+ }
prev_extent = ext;
}
span_bar.translate_axis (- me->relative_coordinate (refp, Y_AXIS),
- Y_AXIS);
+ Y_AXIS);
return span_bar.smobbed_copy ();
}
/*
urg.
*/
- Stencil m =
- Bar_line::compound_barline (me, gl, Interval (-20 PT, 20 PT), false);
+ Stencil m
+ = Bar_line::compound_barline (me, gl, Interval (-20 PT, 20 PT), false);
return ly_interval2scm (m.extent (X_AXIS));
}
return scm_from_double (i.center ());
}
-
-
-MAKE_SCHEME_CALLBACK(Span_bar, calc_glyph_name, 1);
+MAKE_SCHEME_CALLBACK (Span_bar, calc_glyph_name, 1);
SCM
Span_bar::calc_glyph_name (SCM smob)
{
type = ".|";
else if (type == ":|S" || type == ":|S.")
type = "|.";
- else if (type == ":|S|:" || type == ":|S.|:")
+ else if (type == ":|S|:" || type == ":|S.|:")
type = "|._.|";
else if (type == "'")
type = "";
}
ADD_INTERFACE (Span_bar,
- "A bar line that is spanned between other barlines. This"
- " interface is used for bar lines that connect different"
- " staves.",
-
- /* properties */
- "glyph-name "
- "elements "
- "pure-Y-common "
- "pure-relevant-grobs "
- "pure-relevant-items "
- "pure-relevant-spanners "
- );
+ "A bar line that is spanned between other barlines. This"
+ " interface is used for bar lines that connect different"
+ " staves.",
+
+ /* properties */
+ "glyph-name "
+ "elements "
+ "pure-Y-common "
+ "pure-relevant-grobs "
+ "pure-relevant-items "
+ "pure-relevant-spanners "
+ );
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
-
#include "engraver.hh"
#include "international.hh"
#include "spanner.hh"
class Spanner_break_forbid_engraver : public Engraver
{
TRANSLATOR_DECLARATIONS (Spanner_break_forbid_engraver);
- vector<Spanner*> running_spanners_;
+ vector<Spanner *> running_spanners_;
protected:
DECLARE_ACKNOWLEDGER (unbreakable_spanner);
DECLARE_END_ACKNOWLEDGER (unbreakable_spanner);
void process_music ();
};
-
void
Spanner_break_forbid_engraver::process_music ()
{
void
Spanner_break_forbid_engraver::acknowledge_end_unbreakable_spanner (Grob_info gi)
{
- vector<Spanner*>::iterator i = find (running_spanners_.begin (), running_spanners_.end (),
- gi.spanner ());
+ vector<Spanner *>::iterator i = find (running_spanners_.begin (), running_spanners_.end (),
+ gi.spanner ());
if (i != running_spanners_.end ())
running_spanners_.erase (i);
}
{
}
-
ADD_END_ACKNOWLEDGER (Spanner_break_forbid_engraver, unbreakable_spanner);
ADD_ACKNOWLEDGER (Spanner_break_forbid_engraver, unbreakable_spanner);
ADD_TRANSLATOR (Spanner_break_forbid_engraver,
- /* doc */
- "Forbid breaks in certain spanners.",
+ /* doc */
+ "Forbid breaks in certain spanners.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
This file is part of LilyPond, the GNU music typesetter.
Copyright (C) 2007--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
-
+
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "item.hh"
LY_DEFINE (ly_spanner_bound, "ly:spanner-bound",
- 2, 0, 0, (SCM spanner, SCM dir),
- "Get one of the bounds of @var{spanner}. @var{dir} is @code{-1}"
- " for left, and @code{1} for right.")
+ 2, 0, 0, (SCM spanner, SCM dir),
+ "Get one of the bounds of @var{spanner}. @var{dir} is @code{-1}"
+ " for left, and @code{1} for right.")
{
LY_ASSERT_TYPE (unsmob_spanner, spanner, 1);
LY_ASSERT_TYPE (is_direction, dir, 2);
}
LY_DEFINE (ly_spanner_set_bound_x, "ly:spanner-set-bound!",
- 3, 0, 0, (SCM spanner, SCM dir, SCM item),
- "Set grob @var{item} as bound in direction @var{dir} for"
- " @var{spanner}.")
+ 3, 0, 0, (SCM spanner, SCM dir, SCM item),
+ "Set grob @var{item} as bound in direction @var{dir} for"
+ " @var{spanner}.")
{
LY_ASSERT_TYPE (unsmob_spanner, spanner, 1);
LY_ASSERT_TYPE (is_direction, dir, 2);
/* TODO: maybe we should return a vector -- random access is more
logical for this list? */
LY_DEFINE (ly_spanner_broken_into, "ly:spanner-broken-into",
- 1, 0, 0, (SCM spanner),
- "Return broken-into list for @var{spanner}.")
+ 1, 0, 0, (SCM spanner),
+ "Return broken-into list for @var{spanner}.")
{
LY_ASSERT_TYPE (unsmob_spanner, spanner, 1);
Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (spanner));
}
LY_DEFINE (ly_spanner_p, "ly:spanner?",
- 1, 0, 0, (SCM g),
- "Is @var{g} a spanner object?")
+ 1, 0, 0, (SCM g),
+ "Is @var{g} a spanner object?")
{
Grob *me = unsmob_grob (g);
bool b = dynamic_cast<Spanner *> (me);
if (!left || !right)
return;
-
if (get_system () || is_broken ())
return;
if (left == right)
{
/*
- If we have a spanner spanning one column, we must break it
- anyway because it might provide a parent for another item. */
+ If we have a spanner spanning one column, we must break it
+ anyway because it might provide a parent for another item. */
Direction d = LEFT;
do
- {
- Item *bound = left->find_prebroken_piece (d);
- if (!bound)
- programming_error ("no broken bound");
- else if (bound->get_system ())
- {
- Spanner *span = dynamic_cast<Spanner *> (clone ());
- span->set_bound (LEFT, bound);
- span->set_bound (RIGHT, bound);
-
- assert (span->get_system ());
- span->get_system ()->typeset_grob (span);
- broken_intos_.push_back (span);
- }
- }
+ {
+ Item *bound = left->find_prebroken_piece (d);
+ if (!bound)
+ programming_error ("no broken bound");
+ else if (bound->get_system ())
+ {
+ Spanner *span = dynamic_cast<Spanner *> (clone ());
+ span->set_bound (LEFT, bound);
+ span->set_bound (RIGHT, bound);
+
+ assert (span->get_system ());
+ span->get_system ()->typeset_grob (span);
+ broken_intos_.push_back (span);
+ }
+ }
while ((flip (&d)) != LEFT);
}
else
{
- System *root = get_root_system (this);
- vector<Item*> break_points = root->broken_col_range (left, right);
+ System *root = get_root_system (this);
+ vector<Item *> break_points = root->broken_col_range (left, right);
break_points.insert (break_points.begin () + 0, left);
break_points.push_back (right);
parent_rank_slice.set_full ();
/*
- Check if our parent in X-direction spans equally wide
- or wider than we do.
+ Check if our parent in X-direction spans equally wide
+ or wider than we do.
*/
for (int a = X_AXIS; a < NO_AXES; a++)
- {
- if (Spanner *parent = dynamic_cast<Spanner *> (get_parent ((Axis)a)))
- parent_rank_slice.intersect (parent->spanned_rank_interval ());
- }
+ {
+ if (Spanner *parent = dynamic_cast<Spanner *> (get_parent ((Axis)a)))
+ parent_rank_slice.intersect (parent->spanned_rank_interval ());
+ }
for (vsize i = 1; i < break_points.size (); i++)
- {
- Drul_array<Item *> bounds;
- bounds[LEFT] = break_points[i - 1];
- bounds[RIGHT] = break_points[i];
- Direction d = LEFT;
- do
- {
- if (!bounds[d]->get_system ())
- bounds[d] = bounds[d]->find_prebroken_piece (- d);
- }
- while ((flip (&d)) != LEFT);
-
- if (!bounds[LEFT] || ! bounds[RIGHT])
- {
- programming_error ("bounds of this piece aren't breakable. ");
- continue;
- }
-
- bool ok = parent_rank_slice.contains (bounds[LEFT]->get_column ()->get_rank ());
- ok = ok && parent_rank_slice.contains (bounds[RIGHT]->get_column ()->get_rank ());
-
- if (!ok)
- {
- programming_error (to_string ("Spanner `%s' is not fully contained in parent spanner. Ignoring orphaned part",
- name ().c_str ()));
- continue;
- }
-
-
- Spanner *span = dynamic_cast<Spanner *> (clone ());
- span->set_bound (LEFT, bounds[LEFT]);
- span->set_bound (RIGHT, bounds[RIGHT]);
-
- if (!bounds[LEFT]->get_system ()
- || !bounds[RIGHT]->get_system ()
- || bounds[LEFT]->get_system () != bounds[RIGHT]->get_system ())
- {
- programming_error ("bounds of spanner are invalid");
- span->suicide ();
- }
- else
- {
- bounds[LEFT]->get_system ()->typeset_grob (span);
- broken_intos_.push_back (span);
- }
- }
+ {
+ Drul_array<Item *> bounds;
+ bounds[LEFT] = break_points[i - 1];
+ bounds[RIGHT] = break_points[i];
+ Direction d = LEFT;
+ do
+ {
+ if (!bounds[d]->get_system ())
+ bounds[d] = bounds[d]->find_prebroken_piece (- d);
+ }
+ while ((flip (&d)) != LEFT);
+
+ if (!bounds[LEFT] || ! bounds[RIGHT])
+ {
+ programming_error ("bounds of this piece aren't breakable. ");
+ continue;
+ }
+
+ bool ok = parent_rank_slice.contains (bounds[LEFT]->get_column ()->get_rank ());
+ ok = ok && parent_rank_slice.contains (bounds[RIGHT]->get_column ()->get_rank ());
+
+ if (!ok)
+ {
+ programming_error (to_string ("Spanner `%s' is not fully contained in parent spanner. Ignoring orphaned part",
+ name ().c_str ()));
+ continue;
+ }
+
+ Spanner *span = dynamic_cast<Spanner *> (clone ());
+ span->set_bound (LEFT, bounds[LEFT]);
+ span->set_bound (RIGHT, bounds[RIGHT]);
+
+ if (!bounds[LEFT]->get_system ()
+ || !bounds[RIGHT]->get_system ()
+ || bounds[LEFT]->get_system () != bounds[RIGHT]->get_system ())
+ {
+ programming_error ("bounds of spanner are invalid");
+ span->suicide ();
+ }
+ else
+ {
+ bounds[LEFT]->get_system ()->typeset_grob (span);
+ broken_intos_.push_back (span);
+ }
+ }
}
vector_sort (broken_intos_, Spanner::less);
for (vsize i = broken_intos_.size (); i--;)
do
{
if (!spanned_drul_[i]->get_system ())
- set_bound (i, spanned_drul_[i]->find_prebroken_piece ((Direction) -i));
+ set_bound (i, spanned_drul_[i]->find_prebroken_piece ((Direction) - i));
}
while (flip (&i) != LEFT);
}
Spanner::spanned_time () const
{
return spanned_time_interval (spanned_drul_[LEFT],
- spanned_drul_[RIGHT]);
+ spanned_drul_[RIGHT]);
}
-
Item *
Spanner::get_bound (Direction d) const
{
Item *i = dynamic_cast<Item *> (s);
if (!i)
{
- programming_error ("must have Item for spanner bound of " + name());
+ programming_error ("must have Item for spanner bound of " + name ());
return;
}
Drul_array<SCM> bounds (get_property ("left-bound-info"),
get_property ("right-bound-info"));
- Direction d = LEFT;
+ Direction d = LEFT;
do
lr[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("X"),
bounds[d], SCM_BOOL_F), -d);
return 0;
vsize k = get_break_index ();
- Spanner *orig = dynamic_cast<Spanner*> (original_);
+ Spanner *orig = dynamic_cast<Spanner *> (original_);
int j = int (k) + d;
if (j < 0 || vsize (j) >= orig->broken_intos_.size ())
return 0;
&& sc->break_status_dir () == RIGHT)
{
/*
- We used to do a full search for the Break_align_item.
- But that doesn't make a difference, since the Paper_column
- is likely to contain only a Break_align_item.
+ We used to do a full search for the Break_align_item.
+ But that doesn't make a difference, since the Paper_column
+ is likely to contain only a Break_align_item.
*/
return sc->extent (sc, X_AXIS)[RIGHT];
}
Rod r;
Spanner *sp = dynamic_cast<Spanner *> (me);
System *root = get_root_system (me);
- Drul_array<Item*> bounds (sp->get_bound (LEFT),
- sp->get_bound (RIGHT));
+ Drul_array<Item *> bounds (sp->get_bound (LEFT),
+ sp->get_bound (RIGHT));
if (!bounds[LEFT] || !bounds[RIGHT])
- return SCM_UNSPECIFIED;
+ return SCM_UNSPECIFIED;
- vector<Item*> cols (root->broken_col_range (bounds[LEFT]->get_column (),
- bounds[RIGHT]->get_column ()));
+ vector<Item *> cols (root->broken_col_range (bounds[LEFT]->get_column (),
+ bounds[RIGHT]->get_column ()));
if (cols.size ())
- {
- Rod r ;
- r.item_drul_[LEFT] = sp->get_bound (LEFT);
- r.item_drul_[RIGHT] = cols[0]->find_prebroken_piece (LEFT);
- r.distance_ = robust_scm2double (num_length, 0);
- r.add_to_cols ();
-
- r.item_drul_[LEFT] = cols.back ()->find_prebroken_piece (RIGHT);
- r.item_drul_[RIGHT] = sp->get_bound (RIGHT);
- r.add_to_cols ();
- }
+ {
+ Rod r;
+ r.item_drul_[LEFT] = sp->get_bound (LEFT);
+ r.item_drul_[RIGHT] = cols[0]->find_prebroken_piece (LEFT);
+ r.distance_ = robust_scm2double (num_length, 0);
+ r.add_to_cols ();
+
+ r.item_drul_[LEFT] = cols.back ()->find_prebroken_piece (RIGHT);
+ r.item_drul_[RIGHT] = sp->get_bound (RIGHT);
+ r.add_to_cols ();
+ }
r.distance_ = robust_scm2double (num_length, 0);
r.item_drul_[LEFT] = sp->get_bound (LEFT);
Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
Interval w (me->get_bound (LEFT)->relative_coordinate (common, X_AXIS),
- me->get_bound (RIGHT)->relative_coordinate (common, X_AXIS));
+ me->get_bound (RIGHT)->relative_coordinate (common, X_AXIS));
w -= me->relative_coordinate (common, X_AXIS);
}
ADD_INTERFACE (Spanner,
- "Some objects are horizontally spanned between objects. For"
- " example, slurs, beams, ties, etc. These grobs form a subtype"
- " called @code{Spanner}. All spanners have two span points"
- " (these must be @code{Item} objects), one on the left and one"
- " on the right. The left bound is also the X@tie{}reference"
- " point of the spanner.",
-
- /* properties */
- "normalized-endpoints "
- "minimum-length "
+ "Some objects are horizontally spanned between objects. For"
+ " example, slurs, beams, ties, etc. These grobs form a subtype"
+ " called @code{Spanner}. All spanners have two span points"
+ " (these must be @code{Item} objects), one on the left and one"
+ " on the right. The left bound is also the X@tie{}reference"
+ " point of the spanner.",
+
+ /* properties */
+ "normalized-endpoints "
+ "minimum-length "
"spanner-broken "
"spanner-id "
- "to-barline "
- );
+ "to-barline "
+ );
SCM
Spring::equal_p (SCM a, SCM b)
{
- return a == b? SCM_BOOL_T : SCM_BOOL_F;
+ return a == b ? SCM_BOOL_T : SCM_BOOL_F;
}
// Conceptually, this should be +inf, but 0.0 meets the requirements
// of Simple_spacer and creates fewer cases of 0.0*inf to handle.
blocking_force_ = 0.0;
+ else if (inverse_compress_strength_ > 0.0)
+ blocking_force_ = (min_distance_ - distance_) / inverse_compress_strength_;
else
- if (inverse_compress_strength_ > 0.0)
- blocking_force_ = (min_distance_ - distance_) / inverse_compress_strength_;
- else
- blocking_force_ = 0.0;
+ blocking_force_ = 0.0;
}
/* scale a spring, but in a way that doesn't violate min_distance */
void
-Spring::operator*= (Real r)
+Spring::operator *= (Real r)
{
distance_ = max (min_distance_, distance_ * r);
inverse_compress_strength_ = max (0.0, distance_ - min_distance_);
}
bool
-Spring::operator> (Spring const &other) const
+Spring::operator > (Spring const &other) const
{
return blocking_force_ > other.blocking_force_;
}
Real force = max (f, blocking_force_);
Real inv_k = force < 0.0 ? inverse_compress_strength_ : inverse_stretch_strength_;
- if (isinf(force))
+ if (isinf (force))
{
programming_error ("cruelty to springs");
force = 0.0;
ADD_END_ACKNOWLEDGER (Staff_collecting_engraver, staff_symbol);
ADD_TRANSLATOR (Staff_collecting_engraver,
- /* doc */
- "Maintain the @code{stavesFound} variable.",
+ /* doc */
+ "Maintain the @code{stavesFound} variable.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "stavesFound ",
+ /* read */
+ "stavesFound ",
- /* write */
- "stavesFound "
- );
+ /* write */
+ "stavesFound "
+ );
{
extract_grob_set (me, "elements", elts);
- vector<Grob*>::const_iterator i = find (elts, child);
+ vector<Grob *>::const_iterator i = find (elts, child);
if (i == elts.end ())
return false;
for (++i; i != elts.end (); ++i)
if (Page_layout_problem::is_spaceable (*i)
- && ((pure && !Hara_kiri_group_spanner::request_suicide (*i, start, end))
- || (!pure && (*i)->is_live ())))
+ && ((pure && !Hara_kiri_group_spanner::request_suicide (*i, start, end))
+ || (!pure && (*i)->is_live ())))
return me == unsmob_grob ((*i)->get_object ("staff-grouper"));
// If there was no spaceable, living child after me, I don't
}
ADD_INTERFACE (Staff_grouper_interface,
- "A grob that collects staves together.",
+ "A grob that collects staves together.",
- /* properties */
- "staff-staff-spacing "
- "staffgroup-staff-spacing "
- );
+ /* properties */
+ "staff-staff-spacing "
+ "staffgroup-staff-spacing "
+ );
void set_instrument_name (string voice);
void set_instrument (int channel, string voice);
int get_channel (string instrument);
- Audio_staff* get_audio_staff (string voice);
- Audio_staff* new_audio_staff (string voice);
- Audio_dynamic* get_dynamic (string voice);
+ Audio_staff *get_audio_staff (string voice);
+ Audio_staff *new_audio_staff (string voice);
+ Audio_dynamic *get_dynamic (string voice);
string instrument_string_;
int channel_;
Audio_text *instrument_name_;
Audio_text *name_;
Audio_tempo *tempo_;
- map<string, Audio_staff*> staff_map_;
+ map<string, Audio_staff *> staff_map_;
map<string, int> channel_map_;
- map<string, Audio_dynamic*> dynamic_map_;
+ map<string, Audio_dynamic *> dynamic_map_;
// Would prefer to have the following two items be
// members of the containing class Performance,
// so they can be reset for each new midi file output.
#include "translator.icc"
ADD_TRANSLATOR (Staff_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- "");
+ /* write */
+ "");
Staff_performer::Staff_performer ()
- : channel_ (-1)
- , instrument_ (0)
- , instrument_name_ (0)
- , name_ (0)
- , tempo_ (0)
+ : channel_ (-1),
+ instrument_ (0),
+ instrument_name_ (0),
+ name_ (0),
+ tempo_ (0)
{
}
void
Staff_performer::initialize ()
{
- ++staff_performer_count_;
+ ++staff_performer_count_;
}
-Audio_staff*
+Audio_staff *
Staff_performer::new_audio_staff (string voice)
{
- Audio_staff* audio_staff = new Audio_staff;
+ Audio_staff *audio_staff = new Audio_staff;
audio_staff->merge_unisons_
= to_boolean (get_property ("midiMergeUnisons"));
string track_name = context ()->id_string () + ":" + voice;
if (track_name != ":")
{
name_ = new Audio_text (Audio_text::TRACK_NAME, context ()->id_string ()
- + ":" + voice);
+ + ":" + voice);
audio_staff->add_audio_item (name_);
announce_element (Audio_element_info (name_, 0));
}
return audio_staff;
}
-Audio_staff*
+Audio_staff *
Staff_performer::get_audio_staff (string voice)
{
SCM channel_mapping = get_property ("midiChannelMapping");
&& staff_map_.size ())
return staff_map_.begin ()->second;
- map<string, Audio_staff*>::const_iterator i = staff_map_.find (voice);
+ map<string, Audio_staff *>::const_iterator i = staff_map_.find (voice);
if (i != staff_map_.end ())
return i->second;
- map<string, Audio_staff*>::const_iterator e = staff_map_.find ("");
+ map<string, Audio_staff *>::const_iterator e = staff_map_.find ("");
if (staff_map_.size () == 1 && e != staff_map_.end ())
{
staff_map_[voice] = e->second;
return new_audio_staff (voice);
}
-Audio_dynamic*
+Audio_dynamic *
Staff_performer::get_dynamic (string voice)
{
- map<string, Audio_dynamic*>::const_iterator i = dynamic_map_.find (voice);
+ map<string, Audio_dynamic *>::const_iterator i = dynamic_map_.find (voice);
if (i != dynamic_map_.end ())
return i->second;
return 0;
instrument_ = new Audio_instrument (instrument_string_);
instrument_->channel_ = channel;
announce_element (Audio_element_info (instrument_, 0));
- Audio_staff* audio_staff = get_audio_staff (voice);
+ Audio_staff *audio_staff = get_audio_staff (voice);
audio_staff->add_audio_item (instrument_);
SCM proc = ly_lily_module_constant ("percussion?");
SCM drums = scm_call_1 (proc, ly_symbol2scm (instrument_string_.c_str ()));
Staff_performer::set_instrument_name (string voice)
{
instrument_name_ = new Audio_text (Audio_text::INSTRUMENT_NAME,
- instrument_string_);
+ instrument_string_);
announce_element (Audio_element_info (instrument_name_, 0));
get_audio_staff (voice)->add_audio_item (instrument_name_);
}
SCM channel_mapping = get_property ("midiChannelMapping");
map<string, int>& channel_map
= (channel_mapping != ly_symbol2scm ("instrument"))
- ? channel_map_
- : static_channel_map_;
+ ? channel_map_
+ : static_channel_map_;
if (channel_mapping == ly_symbol2scm ("staff")
&& channel_ >= 0)
map<string, int>::const_iterator i = channel_map.find (instrument);
if (i != channel_map.end ())
return i->second;
-
+
int channel = (channel_mapping == ly_symbol2scm ("staff"))
- ? channel_count_++
- : channel_map.size ();
+ ? channel_count_++
+ : channel_map.size ();
/* MIDI players tend to ignore instrument settings on channel
10, the percussion channel. */
{
warning (_ ("MIDI channel wrapped around"));
warning (_ ("remapping modulo 16"));
- channel = channel % 16;
+ channel = channel % 16;
}
channel_map[instrument] = channel;
if (Audio_item *ai = dynamic_cast<Audio_item *> (inf.elem_))
{
/* map each context (voice) to its own track */
- Context* c = inf.origin_contexts (this)[0];
+ Context *c = inf.origin_contexts (this)[0];
string voice;
if (c->is_alias (ly_symbol2scm ("Voice")))
- voice = c->id_string ();
+ voice = c->id_string ();
SCM channel_mapping = get_property ("midiChannelMapping");
string str = new_instrument_string ();
if (channel_mapping != ly_symbol2scm ("instrument"))
- channel_ = get_channel (voice);
+ channel_ = get_channel (voice);
else if (channel_ < 0 && str.empty ())
- channel_ = get_channel (str);
+ channel_ = get_channel (str);
if (str.length ())
- {
- if (channel_mapping != ly_symbol2scm ("voice"))
- channel_ = get_channel (str);
- set_instrument (channel_, voice);
- set_instrument_name (voice);
- }
+ {
+ if (channel_mapping != ly_symbol2scm ("voice"))
+ channel_ = get_channel (str);
+ set_instrument (channel_, voice);
+ set_instrument_name (voice);
+ }
ai->channel_ = channel_;
bool encode_dynamics_as_velocity_ = true;
if (encode_dynamics_as_velocity_)
- {
- if (Audio_dynamic *d = dynamic_cast<Audio_dynamic *> (inf.elem_))
- {
- dynamic_map_[voice] = d;
- // Output volume as velocity: must disable Midi_dynamic output
- d->silent_ = true;
- }
- if (Audio_dynamic *d = get_dynamic (voice))
- if (Audio_note *n = dynamic_cast<Audio_note *> (inf.elem_))
- n->dynamic_ = d;
- }
- Audio_staff* audio_staff = get_audio_staff (voice);
+ {
+ if (Audio_dynamic *d = dynamic_cast<Audio_dynamic *> (inf.elem_))
+ {
+ dynamic_map_[voice] = d;
+ // Output volume as velocity: must disable Midi_dynamic output
+ d->silent_ = true;
+ }
+ if (Audio_dynamic *d = get_dynamic (voice))
+ if (Audio_note *n = dynamic_cast<Audio_note *> (inf.elem_))
+ n->dynamic_ = d;
+ }
+ Audio_staff *audio_staff = get_audio_staff (voice);
audio_staff->add_audio_item (ai);
}
}
{
Direction d = get_grob_direction (stem);
if (Stem::is_normal_stem (stem) && d == DOWN)
- {
-
- /*
- can't look at stem-end-position, since that triggers
- beam slope computations.
- */
- Real stem_start = Stem::head_positions (stem) [d];
- Real stem_end = stem_start +
- d * robust_scm2double (stem->get_property ("length"), 7);
-
- Interval stem_posns (min (stem_start, stem_end),
- max (stem_end, stem_start));
-
- stem_posns.intersect (bar_height);
-
- ret = min (abs (stem_posns.length () / 7.0), 1.0);
- ret *= robust_scm2double (me->get_property ("stem-spacing-correction"), 1);
- }
+ {
+
+ /*
+ can't look at stem-end-position, since that triggers
+ beam slope computations.
+ */
+ Real stem_start = Stem::head_positions (stem) [d];
+ Real stem_end = stem_start
+ + d * robust_scm2double (stem->get_property ("length"), 7);
+
+ Interval stem_posns (min (stem_start, stem_end),
+ max (stem_end, stem_start));
+
+ stem_posns.intersect (bar_height);
+
+ ret = min (abs (stem_posns.length () / 7.0), 1.0);
+ ret *= robust_scm2double (me->get_property ("stem-spacing-correction"), 1);
+ }
}
return ret;
}
string glyph_string = scm_is_string (glyph) ? ly_scm2string (glyph) : "";
if (glyph_string.substr (0, 1) == "|"
- || glyph_string.substr (0, 1) == ".")
- {
- Grob *common = bar_grob->common_refpoint (staff_sym, Y_AXIS);
- bar_size = bar_grob->extent (common, Y_AXIS);
- bar_size *= 1.0 / Staff_symbol_referencer::staff_space (bar_grob);
- }
+ || glyph_string.substr (0, 1) == ".")
+ {
+ Grob *common = bar_grob->common_refpoint (staff_sym, Y_AXIS);
+ bar_size = bar_grob->extent (common, Y_AXIS);
+ bar_size *= 1.0 / Staff_symbol_referencer::staff_space (bar_grob);
+ }
}
return bar_size;
}
Real
Staff_spacing::next_notes_correction (Grob *me,
- Grob *last_grob)
+ Grob *last_grob)
{
Interval bar_size = bar_y_positions (last_grob);
Grob *orig = me->original () ? me->original () : me;
- vector<Item*> note_columns = Spacing_interface::right_note_columns (orig);
+ vector<Item *> note_columns = Spacing_interface::right_note_columns (orig);
Real max_optical = 0.0;
Interval last_ext;
Direction break_dir = me_item->break_status_dir ();
Grob *last_grob = Spacing_interface::extremal_break_aligned_grob (me, LEFT,
- break_dir,
- &last_ext);
+ break_dir,
+ &last_ext);
if (!last_grob)
{
/*
- TODO:
+ TODO:
- Should insert a adjustable space here? For excercises, you might want to
- use a staff without a clef in the beginning.
+ Should insert a adjustable space here? For excercises, you might want to
+ use a staff without a clef in the beginning.
*/
/*
- we used to have a warning here, but it generates a lot of
- spurious error messages.
+ we used to have a warning here, but it generates a lot of
+ spurious error messages.
*/
return Spring ();
}
{
SCM nndef = scm_sloppy_assq (ly_symbol2scm ("next-note"), alist);
if (scm_is_pair (nndef))
- space_def = nndef;
+ space_def = nndef;
}
if (!scm_is_pair (space_def))
ideal = fixed;
}
-
Real optical_correction = next_notes_correction (me, last_grob);
Real min_dist = Paper_column::minimum_distance (left_col, right_col);
}
ADD_INTERFACE (Staff_spacing,
- "This object calculates spacing details from a breakable"
- " symbol (left) to another object. For example, it takes care"
- " of optical spacing from a bar line to a note.",
+ "This object calculates spacing details from a breakable"
+ " symbol (left) to another object. For example, it takes care"
+ " of optical spacing from a bar line to a note.",
- /* properties */
- "stem-spacing-correction "
- );
+ /* properties */
+ "stem-spacing-correction "
+ );
finished_span_ = span_;
span_ = 0;
if (first_start_)
- first_start_ = false;
+ first_start_ = false;
}
if (span_events_[START]
{
span_ = make_spanner ("StaffSymbol", SCM_EOL);
span_->set_bound (LEFT,
- unsmob_grob (get_property ("currentCommandColumn")));
+ unsmob_grob (get_property ("currentCommandColumn")));
}
}
finished_span_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
announce_end_grob (finished_span_,
- span_events_[STOP]
- ? span_events_[STOP]->self_scm ()
- : SCM_EOL);
+ span_events_[STOP]
+ ? span_events_[STOP]->self_scm ()
+ : SCM_EOL);
finished_span_ = 0;
}
ADD_ACKNOWLEDGER (Staff_symbol_engraver, grob);
ADD_TRANSLATOR (Staff_symbol_engraver,
- /* doc */
- "Create the constellation of five (default) staff lines.",
+ /* doc */
+ "Create the constellation of five (default) staff lines.",
- /* create */
- "StaffSymbol ",
+ /* create */
+ "StaffSymbol ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Grob *g = unsmob_grob (sg);
Real pos = Staff_symbol_referencer::get_position (g);
- if (fabs (rint (pos) -pos) < 1e-6) // ugh.
+ if (fabs (rint (pos) - pos) < 1e-6) // ugh.
return scm_from_int ((int) my_round (pos));
else
return scm_from_double (pos);
if (st && c)
{
Real y = me->relative_coordinate (c, Y_AXIS)
- - st->relative_coordinate (c, Y_AXIS);
+ - st->relative_coordinate (c, Y_AXIS);
Real space = Staff_symbol::staff_space (st);
p = (space == 0) ? 0 : 2.0 * y / space;
return p;
return robust_scm2double (me->get_property ("staff-position"), p);
}
-
Interval
Staff_symbol_referencer::extent_in_staff (Grob *me)
{
Interval retval;
if (st && c)
{
- retval = me->extent (c, Y_AXIS)
- - st->relative_coordinate (c, Y_AXIS);
+ retval = me->extent (c, Y_AXIS)
+ - st->relative_coordinate (c, Y_AXIS);
}
return retval;
}
Real ss = Staff_symbol_referencer::staff_space (me);
- me->translate_axis ((p - oldpos) * ss * 0.5, Y_AXIS);
+ me->translate_axis ((p - oldpos) * ss * 0.5, Y_AXIS);
}
/* Half of the height, in staff space, i.e. 2.0 for a normal staff. */
compare_position (Grob *const &a, Grob *const &b)
{
return sign (Staff_symbol_referencer::get_position ((Grob *)a)
- - Staff_symbol_referencer::get_position ((Grob *) b));
+ - Staff_symbol_referencer::get_position ((Grob *) b));
}
bool
position_less (Grob *const &a, Grob *const &b)
{
return Staff_symbol_referencer::get_position (a)
- < Staff_symbol_referencer::get_position (b);
+ < Staff_symbol_referencer::get_position (b);
}
ADD_INTERFACE (Staff_symbol_referencer,
- "An object whose Y@tie{}position is meant relative to a staff"
- " symbol. These usually"
- " have @code{Staff_symbol_referencer::callback} in their"
- " @code{Y-offset-callbacks}.",
-
- /* properties */
- "staff-position "
- );
+ "An object whose Y@tie{}position is meant relative to a staff"
+ " symbol. These usually"
+ " have @code{Staff_symbol_referencer::callback} in their"
+ " @code{Y-offset-callbacks}.",
+
+ /* properties */
+ "staff-position "
+ );
{
SCM width_scm = me->get_property ("width");
if (d == RIGHT && scm_is_number (width_scm))
- {
- /*
- don't multiply by Staff_symbol_referencer::staff_space (me),
- since that would make aligning staff symbols of different sizes to
- one right margin hell.
- */
- span_points[RIGHT] = scm_to_double (width_scm);
- }
+ {
+ /*
+ don't multiply by Staff_symbol_referencer::staff_space (me),
+ since that would make aligning staff symbols of different sizes to
+ one right margin hell.
+ */
+ span_points[RIGHT] = scm_to_double (width_scm);
+ }
else
- {
- Item *x = sp->get_bound (d);
+ {
+ Item *x = sp->get_bound (d);
- span_points[d] = x->relative_coordinate (common, X_AXIS);
- if (!x->break_status_dir ()
- && !x->extent (x, X_AXIS).is_empty ())
- span_points[d] += x->extent (x, X_AXIS)[d];
- }
+ span_points[d] = x->relative_coordinate (common, X_AXIS);
+ if (!x->break_status_dir ()
+ && !x->extent (x, X_AXIS).is_empty ())
+ span_points[d] += x->extent (x, X_AXIS)[d];
+ }
- span_points[d] -= d* t / 2;
+ span_points[d] -= d * t / 2;
}
while (flip (&d) != LEFT);
SCM line_positions = me->get_property ("line-positions");
Stencil line
= Lookup::horizontal_line (span_points
- -me->relative_coordinate (common, X_AXIS),
- t);
+ - me->relative_coordinate (common, X_AXIS),
+ t);
Real space = staff_space (me);
if (scm_is_pair (line_positions))
{
for (SCM s = line_positions; scm_is_pair (s);
- s = scm_cdr (s))
- {
- Stencil b (line);
- b.translate_axis (scm_to_double (scm_car (s))
- * 0.5 * space, Y_AXIS);
- m.add_stencil (b);
- }
+ s = scm_cdr (s))
+ {
+ Stencil b (line);
+ b.translate_axis (scm_to_double (scm_car (s))
+ * 0.5 * space, Y_AXIS);
+ m.add_stencil (b);
+ }
}
else
{
int l = Staff_symbol::line_count (me);
Real height = (l - 1) * staff_space (me) / 2;
for (int i = 0; i < l; i++)
- {
- Stencil b (line);
- b.translate_axis (height - i * space, Y_AXIS);
- m.add_stencil (b);
- }
+ {
+ Stencil b (line);
+ b.translate_axis (height - i * space, Y_AXIS);
+ m.add_stencil (b);
+ }
}
return m.smobbed_copy ();
}
-
int
Staff_symbol::get_steps (Grob *me)
{
return z[X_AXIS] * get_line_thickness (me) + z[Y_AXIS] * staff_space (me);
}
-MAKE_SCHEME_CALLBACK (Staff_symbol, height,1);
+MAKE_SCHEME_CALLBACK (Staff_symbol, height, 1);
SCM
-Staff_symbol::height (SCM smob)
+Staff_symbol::height (SCM smob)
{
Grob *me = unsmob_grob (smob);
Real t = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
t *= robust_scm2double (me->get_property ("thickness"), 1.0);
-
+
SCM line_positions = me->get_property ("line-positions");
Interval y_ext;
if (scm_is_pair (line_positions))
{
for (SCM s = line_positions; scm_is_pair (s);
- s = scm_cdr (s))
- y_ext.add_point (scm_to_double (scm_car (s)) * 0.5 * space);
+ s = scm_cdr (s))
+ y_ext.add_point (scm_to_double (scm_car (s)) * 0.5 * space);
}
else
{
Real height = (l - 1) * staff_space (me) / 2;
y_ext = Interval (-height, height);
}
- y_ext.widen (t/2);
+ y_ext.widen (t / 2);
return ly_interval2scm (y_ext);
}
Real min_line = HUGE_VAL;
Real max_line = -HUGE_VAL;
for (SCM s = line_positions; scm_is_pair (s); s = scm_cdr (s))
- {
- Real current_line = scm_to_double (scm_car (s));
- if (pos == current_line)
- return true;
- if (current_line > max_line)
- max_line = current_line;
- if (current_line < min_line)
- min_line = current_line;
-
- }
+ {
+ Real current_line = scm_to_double (scm_car (s));
+ if (pos == current_line)
+ return true;
+ if (current_line > max_line)
+ max_line = current_line;
+ if (current_line < min_line)
+ min_line = current_line;
+
+ }
if (pos < min_line)
- return (( (int) (rint (pos - min_line)) % 2) == 0);
+ return (( (int) (rint (pos - min_line)) % 2) == 0);
if (pos > max_line)
- return (( (int) (rint (pos - max_line)) % 2) == 0);
+ return (( (int) (rint (pos - max_line)) % 2) == 0);
return false;
}
}
ADD_INTERFACE (Staff_symbol,
- "This spanner draws the lines of a staff. A staff symbol"
- " defines a vertical unit, the @emph{staff space}. Quantities"
- " that go by a half staff space are called @emph{positions}."
- " The center (i.e., middle line or space) is position@tie{}0."
- " The length of the symbol may be set by hand through the"
- " @code{width} property.",
-
- /* properties */
- "ledger-line-thickness "
- "line-count "
- "line-positions "
- "staff-space "
- "thickness "
- "width "
- );
+ "This spanner draws the lines of a staff. A staff symbol"
+ " defines a vertical unit, the @emph{staff space}. Quantities"
+ " that go by a half staff space are called @emph{positions}."
+ " The center (i.e., middle line or space) is position@tie{}0."
+ " The length of the symbol may be set by hand through the"
+ " @code{width} property.",
+
+ /* properties */
+ "ledger-line-thickness "
+ "line-count "
+ "line-positions "
+ "staff-space "
+ "thickness "
+ "width "
+ );
TRANSLATOR_DECLARATIONS (Stanza_number_align_engraver);
protected:
- vector<Grob*> lyrics_;
- vector<Grob*> stanza_numbers_;
+ vector<Grob *> lyrics_;
+ vector<Grob *> stanza_numbers_;
DECLARE_ACKNOWLEDGER (lyric_syllable);
DECLARE_ACKNOWLEDGER (stanza_number);
ADD_ACKNOWLEDGER (Stanza_number_align_engraver, stanza_number);
ADD_TRANSLATOR (Stanza_number_align_engraver,
- /* doc */
- "This engraver ensures that stanza numbers are neatly"
- " aligned.",
+ /* doc */
+ "This engraver ensures that stanza numbers are neatly"
+ " aligned.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- "");
+ /* write */
+ "");
ADD_ACKNOWLEDGER (Stanza_number_engraver, lyric_syllable);
ADD_TRANSLATOR (Stanza_number_engraver,
- /* doc */
- "Engrave stanza numbers.",
+ /* doc */
+ "Engrave stanza numbers.",
- /* create */
- "StanzaNumber ",
+ /* create */
+ "StanzaNumber ",
- /* read */
- "stanza ",
+ /* read */
+ "stanza ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
if (tremolo_ev_)
{
/* Stem tremolo is never applied to a note by default,
- it must be requested. But there is a default for the
- tremolo value:
+ it must be requested. But there is a default for the
+ tremolo value:
- c4:8 c c:
+ c4:8 c c:
- the first and last (quarter) note both get one tremolo flag. */
+ the first and last (quarter) note both get one tremolo flag. */
int requested_type
- = robust_scm2int (tremolo_ev_->get_property ("tremolo-type"), 0);
+ = robust_scm2int (tremolo_ev_->get_property ("tremolo-type"), 0);
SCM f = get_property ("tremoloFlags");
if (!requested_type)
- {
- if (scm_is_number (f))
- requested_type = scm_to_int (f);
- else
- requested_type = 8;
- }
+ {
+ if (scm_is_number (f))
+ requested_type = scm_to_int (f);
+ else
+ requested_type = 8;
+ }
else
- context ()->set_property ("tremoloFlags", scm_from_int (requested_type));
-
+ context ()->set_property ("tremoloFlags", scm_from_int (requested_type));
/*
- we take the duration log from the Event, since the duration-log
- for a note head is always <= 2.
+ we take the duration log from the Event, since the duration-log
+ for a note head is always <= 2.
*/
Stream_event *ev = gi.event_cause ();
Duration *dur = unsmob_duration (ev->get_property ("duration"));
-
+
int tremolo_flags = intlog2 (requested_type) - 2
- - (dur->duration_log () > 2 ? dur->duration_log () - 2 : 0);
+ - (dur->duration_log () > 2 ? dur->duration_log () - 2 : 0);
if (tremolo_flags <= 0)
- {
- tremolo_ev_->origin ()->warning (_ ("tremolo duration is too long"));
- tremolo_flags = 0;
- }
+ {
+ tremolo_ev_->origin ()->warning (_ ("tremolo duration is too long"));
+ tremolo_flags = 0;
+ }
if (tremolo_flags)
- {
- tremolo_ = make_item ("StemTremolo", tremolo_ev_->self_scm ());
-
- /* The number of tremolo flags is the number of flags of the
- tremolo-type minus the number of flags of the note itself. */
- tremolo_->set_property ("flag-count", scm_from_int (tremolo_flags));
- tremolo_->set_parent (stem_, X_AXIS);
- stem_->set_object ("tremolo-flag", tremolo_->self_scm ());
- tremolo_->set_object ("stem", stem_->self_scm ());
- }
+ {
+ tremolo_ = make_item ("StemTremolo", tremolo_ev_->self_scm ());
+
+ /* The number of tremolo flags is the number of flags of the
+ tremolo-type minus the number of flags of the note itself. */
+ tremolo_->set_property ("flag-count", scm_from_int (tremolo_flags));
+ tremolo_->set_parent (stem_, X_AXIS);
+ stem_->set_object ("tremolo-flag", tremolo_->self_scm ());
+ tremolo_->set_object ("stem", stem_->self_scm ());
+ }
}
}
if (dc == -1)
dc = 0;
- if (ds != dc)
+ if (ds != dc)
{
gi.event_cause ()->origin ()->warning (_f ("adding note head to incompatible stem (type = %d/%d)",
- ds < 0 ? 1 << -ds : 1,
- ds > 0 ? 1 << ds : 1));
+ ds < 0 ? 1 << -ds : 1,
+ ds > 0 ? 1 << ds : 1));
gi.event_cause ()->origin ()->warning (_ ("maybe input should specify polyphonic voices"));
}
/* FIXME: junk these properties. */
SCM prop = get_property ("stemLeftBeamCount");
if (scm_is_number (prop))
- {
- Stem::set_beaming (stem_, scm_to_int (prop), LEFT);
- context ()->unset_property (ly_symbol2scm ("stemLeftBeamCount"));
- }
+ {
+ Stem::set_beaming (stem_, scm_to_int (prop), LEFT);
+ context ()->unset_property (ly_symbol2scm ("stemLeftBeamCount"));
+ }
prop = get_property ("stemRightBeamCount");
if (scm_is_number (prop))
- {
- Stem::set_beaming (stem_, scm_to_int (prop), RIGHT);
- context ()->unset_property (ly_symbol2scm ("stemRightBeamCount"));
- }
+ {
+ Stem::set_beaming (stem_, scm_to_int (prop), RIGHT);
+ context ()->unset_property (ly_symbol2scm ("stemRightBeamCount"));
+ }
stem_ = 0;
}
tremolo_ev_ = 0;
ADD_ACKNOWLEDGER (Stem_engraver, rhythmic_head);
ADD_TRANSLATOR (Stem_engraver,
- /* doc */
- "Create stems and single-stem tremolos. It also works"
- " together with the beam engraver for overriding beaming.",
-
- /* create */
- "Stem "
- "StemTremolo ",
-
- /* read */
- "tremoloFlags "
- "stemLeftBeamCount "
- "stemRightBeamCount ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create stems and single-stem tremolos. It also works"
+ " together with the beam engraver for overriding beaming.",
+
+ /* create */
+ "Stem "
+ "StemTremolo ",
+
+ /* read */
+ "tremoloFlags "
+ "stemLeftBeamCount "
+ "stemRightBeamCount ",
+
+ /* write */
+ ""
+ );
Real dy = 0;
SCM s = beam->get_property ("quantized-positions");
if (is_number_pair (s))
- dy = - scm_to_double (scm_car (s)) + scm_to_double (scm_cdr (s));
+ dy = - scm_to_double (scm_car (s)) + scm_to_double (scm_cdr (s));
Grob *s2 = Beam::last_normal_stem (beam);
Grob *s1 = Beam::first_normal_stem (beam);
-
+
Grob *common = s1->common_refpoint (s2, X_AXIS);
- Real dx = s2->relative_coordinate (common, X_AXIS) -
- s1->relative_coordinate (common, X_AXIS);
+ Real dx = s2->relative_coordinate (common, X_AXIS)
+ - s1->relative_coordinate (common, X_AXIS);
return scm_from_double (dx ? dy / dx : 0);
}
else
/* down stems with flags should have more sloped trems (helps avoid
flag/stem collisions without making the stem very long) */
- return scm_from_double (
- (Stem::duration_log (stem) >= 3 && get_grob_direction (stem) == DOWN) ?
- 0.40 : 0.25);
+ return scm_from_double ((Stem::duration_log (stem) >= 3 && get_grob_direction (stem) == DOWN)
+ ? 0.40 : 0.25);
}
MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_width, 1)
bool flag = Stem::duration_log (stem) >= 3 && !beam;
/* beamed stems and up-stems with flags have shorter tremolos */
- return scm_from_double (((stemdir == UP && flag) || beam)? 1.0 : 1.5);
+ return scm_from_double (((stemdir == UP && flag) || beam) ? 1.0 : 1.5);
}
MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_style, 1)
Spanner *beam = Stem::get_beam (stem);
return (beam && beam->is_live ())
- ? Beam::get_beam_translation (beam)
- : (Staff_symbol_referencer::staff_space (me)
- * robust_scm2double (me->get_property ("length-fraction"), 1.0) * 0.81);
+ ? Beam::get_beam_translation (beam)
+ : (Staff_symbol_referencer::staff_space (me)
+ * robust_scm2double (me->get_property ("length-fraction"), 1.0) * 0.81);
}
Stencil
return mol;
}
-
-
MAKE_SCHEME_CALLBACK (Stem_tremolo, pure_height, 3);
SCM
Stem_tremolo::pure_height (SCM smob, SCM, SCM)
{
return untranslated_stencil (me, 0.35).extent (Y_AXIS).length ();
}
-
+
Stencil
Stem_tremolo::untranslated_stencil (Grob *me, Real slope)
{
return raw_stencil (me, slope, stencil_dir);
}
-
Stencil
Stem_tremolo::translated_stencil (Grob *me, Real slope)
{
Grob *stem = unsmob_grob (me->get_object ("stem"));
if (!stem)
return Stencil ();
-
+
Direction stemdir = get_grob_direction (stem);
if (stemdir == 0)
stemdir = UP;
Real end_y
= Stem::stem_end_position (stem) * ss / 2
- - stemdir * max (beam_count, 1) * beam_translation;
+ - stemdir * max (beam_count, 1) * beam_translation;
if (!beam && Stem::duration_log (stem) >= 3)
{
Stem_tremolo::print (SCM grob)
{
Grob *me = unsmob_grob (grob);
-
+
Stencil s = translated_stencil (me, robust_scm2double (me->get_property ("slope"), 0.25));
return s.smobbed_copy ();
}
ADD_INTERFACE (Stem_tremolo,
- "A beam slashing a stem to indicate a tremolo. The property"
- " @code{style} can be @code{default} or @code{rectangle}.",
+ "A beam slashing a stem to indicate a tremolo. The property"
+ " @code{style} can be @code{default} or @code{rectangle}.",
/* properties */
- "beam-thickness "
- "beam-width "
- "flag-count "
- "length-fraction "
- "stem "
+ "beam-thickness "
+ "beam-width "
+ "flag-count "
+ "length-fraction "
+ "stem "
"style "
- "slope "
- );
+ "slope "
+ );
#include "stem.hh"
#include "spanner.hh"
-#include <cmath> // rint
+#include <cmath> // rint
using namespace std;
#include "beam.hh"
lst = scm_cons (scm_from_int (i), lst);
else
lst = SCM_BOOL_F;
-
+
index_set_cell (pair, d, lst);
}
{
Drul_array<Grob *> e (extremal_heads (me));
return Interval (Staff_symbol_referencer::get_position (e[DOWN]),
- Staff_symbol_referencer::get_position (e[UP]));
+ Staff_symbol_referencer::get_position (e[UP]));
}
return Interval ();
}
Interval hp = head_positions (me);
if (!hp.is_empty ())
return hp[get_grob_direction (me)] * Staff_symbol_referencer::staff_space (me)
- * 0.5;
+ * 0.5;
return 0;
}
-
-
void
Stem::set_stemend (Grob *me, Real se)
{
Direction d = LEFT;
do
- {
- if (d * p > d * extpos[d])
- {
- exthead[d] = n;
- extpos[d] = p;
- }
- }
+ {
+ if (d * p > d * extpos[d])
+ {
+ exthead[d] = n;
+ extpos[d] = p;
+ }
+ }
while (flip (&d) != DOWN);
}
return exthead;
Stem::is_invisible (Grob *me)
{
return !is_normal_stem (me)
- && (robust_scm2double (me->get_property ("stemlet-length"),
- 0.0) == 0.0);
+ && (robust_scm2double (me->get_property ("stemlet-length"),
+ 0.0) == 0.0);
}
-
bool
Stem::is_normal_stem (Grob *me)
{
return head_count (me) && scm_to_int (me->get_property ("duration-log")) >= 1;
}
-
MAKE_SCHEME_CALLBACK (Stem, pure_height, 3)
SCM
Stem::pure_height (SCM smob,
- SCM /* start */,
- SCM /* end */)
+ SCM /* start */,
+ SCM /* end */)
{
Grob *me = unsmob_grob (smob);
Interval iv;
Real len_in_halfspaces;
SCM user_set_len_scm = me->get_property_data ("length");
if (scm_is_number (user_set_len_scm))
- len_in_halfspaces = scm_to_double (user_set_len_scm);
+ len_in_halfspaces = scm_to_double (user_set_len_scm);
else
- len_in_halfspaces = scm_to_double (calc_length (smob));
+ len_in_halfspaces = scm_to_double (calc_length (smob));
Real len = len_in_halfspaces * ss / 2;
Direction dir = get_grob_direction (me);
Interval hp = head_positions (me);
if (dir == UP)
- iv = Interval (0, len);
+ iv = Interval (0, len);
else
- iv = Interval (-len, 0);
+ iv = Interval (-len, 0);
if (!hp.is_empty ())
- {
- iv.translate (hp[dir] * ss / 2);
- iv.add_point (hp[-dir] * ss / 2);
- }
+ {
+ iv.translate (hp[dir] * ss / 2);
+ iv.add_point (hp[-dir] * ss / 2);
+ }
/* extend the stem (away from the head) to cover the staff */
if (dir == UP)
- iv[UP] = max (iv[UP], rad * ss);
+ iv[UP] = max (iv[UP], rad * ss);
else
- iv[DOWN] = min (iv[DOWN], -rad * ss);
+ iv[DOWN] = min (iv[DOWN], -rad * ss);
}
else
iv = Interval (-rad * ss, rad * ss);
(void) beam->get_property ("quantized-positions");
return me->get_property ("stem-end-position");
}
-
+
vector<Real> a;
/* WARNING: IN HALF SPACES */
Stem::calc_length (SCM smob)
{
Grob *me = unsmob_grob (smob);
-
+
SCM details = me->get_property ("details");
int durlog = duration_log (me);
{
SCM sshorten = ly_assoc_get (ly_symbol2scm ("stem-shorten"), details, SCM_EOL);
SCM scm_shorten = scm_is_pair (sshorten)
- ? robust_list_ref (max (duration_log (me) - 2, 0), sshorten) : SCM_EOL;
+ ? robust_list_ref (max (duration_log (me) - 2, 0), sshorten) : SCM_EOL;
Real shorten_property = 2 * robust_scm2double (scm_shorten, 0);
/* change in length between full-size and shortened stems is executed gradually.
"transition area" = stems between full-sized and fully-shortened.
Shortening of flagged stems begins in the same moment as unflagged ones,
but not earlier than on the middle line note.
*/
- Real which_step = (min (1.0, quarter_stem_length - (2 * staff_rad) - 2.0)) + abs(hp[dir]);
+ Real which_step = (min (1.0, quarter_stem_length - (2 * staff_rad) - 2.0)) + abs (hp[dir]);
Real shorten = min (max (0.0, (shortening_step * which_step)), shorten_property);
length -= shorten;
(Stem_tremolo::raw_stencil () looks at the beam.) --hwn */
Real minlen = 1.0
- + 2 * Stem_tremolo::vertical_length (t_flag) / ss;
+ + 2 * Stem_tremolo::vertical_length (t_flag) / ss;
/* We don't want to add the whole extent of the flag because the trem
and the flag can overlap partly. beam_translation gives a good
}
length = max (length, minlen + 1.0);
}
-
+
return scm_from_double (length);
}
/* The log of the duration (Number of hooks on the flag minus two) */
SCM
Stem::calc_positioning_done (SCM smob)
{
- Grob *me = unsmob_grob (smob);
+ Grob *me = unsmob_grob (smob);
if (!head_count (me))
return SCM_BOOL_T;
me->set_property ("positioning-done", SCM_BOOL_T);
-
+
extract_grob_set (me, "note-heads", ro_heads);
- vector<Grob*> heads (ro_heads);
+ vector<Grob *> heads (ro_heads);
vector_sort (heads, position_less);
Direction dir = get_grob_direction (me);
bool is_harmonic_centered = false;
for (vsize i = 0; i < heads.size (); i++)
- is_harmonic_centered = is_harmonic_centered
- || heads[i]->get_property ("style") == ly_symbol2scm ("harmonic");
+ is_harmonic_centered = is_harmonic_centered
+ || heads[i]->get_property ("style") == ly_symbol2scm ("harmonic");
is_harmonic_centered = is_harmonic_centered && is_invisible (me);
Real w = hed->extent (hed, X_AXIS)[dir];
Real amount = w - heads[i]->extent (heads[i], X_AXIS)[dir];
if (is_harmonic_centered)
- amount =
- hed->extent (hed, X_AXIS).linear_combination (CENTER)
- - heads[i]->extent (heads[i], X_AXIS).linear_combination (CENTER);
-
+ amount
+ = hed->extent (hed, X_AXIS).linear_combination (CENTER)
+ - heads[i]->extent (heads[i], X_AXIS).linear_combination (CENTER);
+
heads[i]->translate_axis (amount, X_AXIS);
}
bool parity = true;
for (vsize i = 1; i < heads.size (); i++)
{
Real p = Staff_symbol_referencer::get_position (heads[i]);
- Real dy = fabs (lastpos- p);
+ Real dy = fabs (lastpos - p);
/*
- dy should always be 0.5, 0.0, 1.0, but provide safety margin
- for rounding errors.
+ dy should always be 0.5, 0.0, 1.0, but provide safety margin
+ for rounding errors.
*/
if (dy < 1.1)
- {
- if (parity)
- {
- Real ell = heads[i]->extent (heads[i], X_AXIS).length ();
+ {
+ if (parity)
+ {
+ Real ell = heads[i]->extent (heads[i], X_AXIS).length ();
- Direction d = get_grob_direction (me);
- /*
- Reversed head should be shifted ell-thickness, but this
- looks too crowded, so we only shift ell-0.5*thickness.
+ Direction d = get_grob_direction (me);
+ /*
+ Reversed head should be shifted ell-thickness, but this
+ looks too crowded, so we only shift ell-0.5*thickness.
- This leads to assymetry: Normal heads overlap the
- stem 100% whereas reversed heads only overlaps the
- stem 50%
- */
+ This leads to assymetry: Normal heads overlap the
+ stem 100% whereas reversed heads only overlaps the
+ stem 50%
+ */
- Real reverse_overlap = 0.5;
- heads[i]->translate_axis ((ell - thick * reverse_overlap) * d,
- X_AXIS);
+ Real reverse_overlap = 0.5;
+ heads[i]->translate_axis ((ell - thick * reverse_overlap) * d,
+ X_AXIS);
- if (is_invisible (me))
- heads[i]->translate_axis (-thick * (2 - reverse_overlap) * d,
- X_AXIS);
+ if (is_invisible (me))
+ heads[i]->translate_axis (-thick * (2 - reverse_overlap) * d,
+ X_AXIS);
- /* TODO:
+ /* TODO:
- For some cases we should kern some more: when the
- distance between the next or prev note is too large, we'd
- get large white gaps, eg.
+ For some cases we should kern some more: when the
+ distance between the next or prev note is too large, we'd
+ get large white gaps, eg.
- |
+ |
X|
- |X <- kern this.
- |
- X
-
- */
- }
- parity = !parity;
- }
+ |X <- kern this.
+ |
+ X
+
+ */
+ }
+ parity = !parity;
+ }
else
- parity = true;
+ parity = true;
lastpos = int (p);
}
SCM dd = me->get_property ("default-direction");
dir = to_dir (dd);
if (!dir)
- return me->get_property ("neutral-direction");
+ return me->get_property ("neutral-direction");
}
-
+
return scm_from_int (dir);
}
{
int udistance = (int) (UP * hp[UP] - staff_center);
int ddistance = (int) (DOWN * hp[DOWN] - staff_center);
-
+
dir = Direction (sign (ddistance - udistance));
}
-
+
return scm_from_int (dir);
}
-
MAKE_SCHEME_CALLBACK (Stem, height, 1);
SCM
Stem::height (SCM smob)
Grob *me = unsmob_grob (smob);
if (!is_normal_stem (me))
return ly_interval2scm (Interval ());
-
+
Direction dir = get_grob_direction (me);
-
+
Grob *beam = get_beam (me);
if (beam)
{
if (beam)
{
if (dir == CENTER)
- {
- programming_error ("no stem direction");
- dir = UP;
- }
+ {
+ programming_error ("no stem direction");
+ dir = UP;
+ }
iv[dir] += dir * Beam::get_beam_thickness (beam) * 0.5;
}
'() or "grace"). */
string flag_style;
- SCM flag_style_scm = me->get_property ("flag-style");
+ SCM flag_style_scm = me->get_property ("flag-style");
if (scm_is_symbol (flag_style_scm))
flag_style = ly_symbol2string (flag_style_scm);
}
else
staffline_offs = "2";
- }
+ }
else
staffline_offs = "";
char dir = (get_grob_direction (me) == UP) ? 'u' : 'd';
string font_char = flag_style
- + to_string (dir) + staffline_offs + to_string (log);
+ + to_string (dir) + staffline_offs + to_string (log);
Font_metric *fm = Font_interface::get_default_font (me);
Stencil flag = fm->find_by_name ("flags." + font_char);
if (flag.is_empty ())
else
flag.add_stencil (stroke);
}
- }
+ }
return flag.smobbed_copy ();
}
-
Stencil
Stem::flag (Grob *me)
{
// the grob passed as argument! Thus, we only have to check if a valid
// stencil is returned.
SCM flag_style_scm = me->get_property ("flag");
- if (Stencil *flag = unsmob_stencil (flag_style_scm)) {
- return *flag;
- } else {
- return Stencil ();
- }
+ if (Stencil *flag = unsmob_stencil (flag_style_scm))
+ {
+ return *flag;
+ }
+ else
+ {
+ return Stencil ();
+ }
}
MAKE_SCHEME_CALLBACK (Stem, width, 1);
if (is_invisible (me))
r.set_empty ();
else if (unsmob_grob (me->get_object ("beam"))
- || abs (duration_log (me)) <= 2)
+ || abs (duration_log (me)) <= 2)
{
r = Interval (-1, 1);
r *= thickness (me) / 2;
Stem::thickness (Grob *me)
{
return scm_to_double (me->get_property ("thickness"))
- * Staff_symbol_referencer::line_thickness (me);
+ * Staff_symbol_referencer::line_thickness (me);
}
MAKE_SCHEME_CALLBACK (Stem, calc_stem_begin_position, 1);
Real half_space = Staff_symbol_referencer::staff_space (me) * 0.5;
Grob *lh
= to_boolean (me->get_property ("avoid-note-head"))
- ? last_head (me)
- : first_head (me);
+ ? last_head (me)
+ : first_head (me);
Real pos = Staff_symbol_referencer::get_position (lh);
{
Grob *me = unsmob_grob (smob);
Grob *beam = get_beam (me);
-
+
Stencil mol;
Direction d = get_grob_direction (me);
Real stemlet_length = robust_scm2double (me->get_property ("stemlet-length"),
- 0.0);
+ 0.0);
bool stemlet = stemlet_length > 0.0;
/* TODO: make the stem start a direction ?
This is required to avoid stems passing in tablature chords. */
Grob *lh
= to_boolean (me->get_property ("avoid-note-head"))
- ? last_head (me)
- : first_head (me);
+ ? last_head (me)
+ : first_head (me);
if (!lh && !stemlet)
return SCM_EOL;
if (!lh && stemlet && !beam)
return SCM_EOL;
- if (lh && robust_scm2int (lh->get_property ("duration-log"), 0) < 1)
+ if (lh && robust_scm2int (lh->get_property ("duration-log"), 0) < 1)
return SCM_EOL;
if (is_invisible (me))
int beam_count = beam_multiplicity (me).length () + 1;
y2 -= d
- * (0.5 * beam_thickness
- + beam_translation * max (0, (beam_count - 1))
- + stemlet_length) / half_space;
+ * (0.5 * beam_thickness
+ + beam_translation * max (0, (beam_count - 1))
+ + stemlet_length) / half_space;
}
Interval stem_y (min (y1, y2), max (y2, y1));
= me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
Box b = Box (Interval (-stem_width / 2, stem_width / 2),
- Interval (stem_y[DOWN] * half_space, stem_y[UP] * half_space));
+ Interval (stem_y[DOWN] * half_space, stem_y[UP] * half_space));
Stencil ss = Lookup::round_filled_box (b, blot);
mol.add_stencil (ss);
{
Direction d = get_grob_direction (me);
Real blot
- = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
+ = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
Real stem_width = thickness (me);
Real half_space = Staff_symbol_referencer::staff_space (me) * 0.5;
Real y2 = robust_scm2double (me->get_property ("stem-end-position"), 0.0);
return fl;
}
-
/*
move the stem to right of the notehead if it is up.
*/
return scm_from_double (r);
}
-
if (Grob *f = first_head (me))
{
Interval head_wid = f->extent (f, X_AXIS);
Real attach = 0.0;
if (is_invisible (me))
- attach = 0.0;
+ attach = 0.0;
else
- attach = Note_head::stem_attachment_coordinate (f, X_AXIS);
+ attach = Note_head::stem_attachment_coordinate (f, X_AXIS);
Direction d = get_grob_direction (me);
Real real_attach = head_wid.linear_combination (d * attach);
/* If not centered: correct for stem thickness. */
if (attach)
- {
- Real rule_thick = thickness (me);
- r += -d * rule_thick * 0.5;
- }
+ {
+ Real rule_thick = thickness (me);
+ r += -d * rule_thick * 0.5;
+ }
return scm_from_double (r);
}
{
Stem_info si;
si.dir_ = get_grob_direction (me);
-
+
SCM scm_info = me->get_property ("stem-info");
si.ideal_y_ = scm_to_double (scm_car (scm_info));
si.shortest_y_ = scm_to_double (scm_cadr (scm_info));
{
(void) beam->get_property ("beaming");
}
-
+
Real beam_translation = Beam::get_beam_translation (beam);
Real beam_thickness = Beam::get_beam_thickness (beam);
int beam_count = Beam::get_direction_beam_count (beam, my_dir);
/* Simple standard stem length */
SCM details = me->get_property ("details");
SCM lengths = ly_assoc_get (ly_symbol2scm ("beamed-lengths"), details, SCM_EOL);
-
+
Real ideal_length
= (scm_is_pair (lengths)
? (scm_to_double (robust_list_ref (beam_count - 1, lengths))
- * staff_space
- * length_fraction
- /*
- stem only extends to center of beam
- */
- - 0.5 * beam_thickness)
+ * staff_space
+ * length_fraction
+ /*
+ stem only extends to center of beam
+ */
+ - 0.5 * beam_thickness)
: 0.0);
/* Condition: sane minimum free stem length (chord to beams) */
lengths = ly_assoc_get (ly_symbol2scm ("beamed-minimum-free-lengths"),
- details, SCM_EOL);
+ details, SCM_EOL);
Real ideal_minimum_free
= (scm_is_pair (lengths)
? (scm_to_double (robust_list_ref (beam_count - 1, lengths))
- * staff_space
- * length_fraction)
+ * staff_space
+ * length_fraction)
: 0.0);
Real height_of_my_trem = 0.0;
if (trem)
{
height_of_my_trem
- = Stem_tremolo::vertical_length (trem)
- /* hack a bit of space around the trem. */
- + beam_translation;
+ = Stem_tremolo::vertical_length (trem)
+ /* hack a bit of space around the trem. */
+ + beam_translation;
}
-
/* UGH
It seems that also for ideal minimum length, we must use
the maximum beam count (for this direction):
must be horizontal. */
Real height_of_my_beams = beam_thickness
- + (beam_count - 1) * beam_translation;
+ + (beam_count - 1) * beam_translation;
Real ideal_minimum_length = ideal_minimum_free
- + height_of_my_beams
- + height_of_my_trem
- /* stem only extends to center of beam */
- - 0.5 * beam_thickness;
+ + height_of_my_beams
+ + height_of_my_trem
+ /* stem only extends to center of beam */
+ - 0.5 * beam_thickness;
ideal_length = max (ideal_length, ideal_minimum_length);
/* Convert to Y position, calculate for dir == UP */
Real note_start
= /* staff positions */
- head_positions (me)[my_dir] * 0.5
- * my_dir * staff_space;
+ head_positions (me)[my_dir] * 0.5
+ * my_dir * staff_space;
Real ideal_y = note_start + ideal_length;
/* Conditions for Y position */
if (!no_extend && !is_knee)
{
/* Highest beam of (UP) beam must never be lower than middle
- staffline */
+ staffline */
ideal_y = max (ideal_y, 0.0);
/* Lowest beam of (UP) beam must never be lower than second staffline */
ideal_y = max (ideal_y, (-staff_space
- - beam_thickness + height_of_my_beams));
+ - beam_thickness + height_of_my_beams));
}
ideal_y -= robust_scm2double (beam->get_property ("shorten"), 0);
SCM bemfl = ly_assoc_get (ly_symbol2scm ("beamed-extreme-minimum-free-lengths"),
- details, SCM_EOL);
-
+ details, SCM_EOL);
+
Real minimum_free
= (scm_is_pair (bemfl)
? (scm_to_double (robust_list_ref (beam_count - 1, bemfl))
- * staff_space
- * length_fraction)
+ * staff_space
+ * length_fraction)
: 0.0);
Real minimum_length = max (minimum_free, height_of_my_trem)
- + height_of_my_beams
- /* stem only extends to center of beam */
- - 0.5 * beam_thickness;
+ + height_of_my_beams
+ /* stem only extends to center of beam */
+ - 0.5 * beam_thickness;
ideal_y *= my_dir;
Real minimum_y = note_start + minimum_length;
Real shortest_y = minimum_y * my_dir;
return scm_list_2 (scm_from_double (ideal_y),
- scm_from_double (shortest_y));
+ scm_from_double (shortest_y));
}
Slice
/* FIXME: Too many properties */
ADD_INTERFACE (Stem,
- "The stem represents the graphical stem. In addition, it"
- " internally connects note heads, beams, and tremolos. Rests"
- " and whole notes have invisible stems.\n"
- "\n"
- "The following properties may be set in the @code{details}"
- " list.\n"
- "\n"
- "@table @code\n"
- "@item beamed-lengths\n"
- "List of stem lengths given beam multiplicity.\n"
- "@item beamed-minimum-free-lengths\n"
- "List of normal minimum free stem lengths (chord to beams)"
- " given beam multiplicity.\n"
- "@item beamed-extreme-minimum-free-lengths\n"
- "List of extreme minimum free stem lengths (chord to beams)"
- " given beam multiplicity.\n"
- "@item lengths\n"
- "Default stem lengths. The list gives a length for each"
- " flag count.\n"
- "@item stem-shorten\n"
- "How much a stem in a forced direction should be shortened."
- " The list gives an amount depending on the number of flags"
- " and beams.\n"
- "@end table\n",
-
- /* properties */
- "avoid-note-head "
- "beam "
- "beaming "
- "beamlet-default-length "
- "beamlet-max-length-proportion "
- "default-direction "
- "details "
- "direction "
- "duration-log "
- "flag "
- "flag-style "
- "french-beaming "
- "length "
- "length-fraction "
- "max-beam-connect "
- "neutral-direction "
- "no-stem-extend "
- "note-heads "
- "positioning-done "
- "rests "
- "stem-begin-position "
- "stem-end-position "
- "stem-info "
- "stemlet-length "
- "stroke-style "
- "thickness "
- "tremolo-flag "
- );
+ "The stem represents the graphical stem. In addition, it"
+ " internally connects note heads, beams, and tremolos. Rests"
+ " and whole notes have invisible stems.\n"
+ "\n"
+ "The following properties may be set in the @code{details}"
+ " list.\n"
+ "\n"
+ "@table @code\n"
+ "@item beamed-lengths\n"
+ "List of stem lengths given beam multiplicity.\n"
+ "@item beamed-minimum-free-lengths\n"
+ "List of normal minimum free stem lengths (chord to beams)"
+ " given beam multiplicity.\n"
+ "@item beamed-extreme-minimum-free-lengths\n"
+ "List of extreme minimum free stem lengths (chord to beams)"
+ " given beam multiplicity.\n"
+ "@item lengths\n"
+ "Default stem lengths. The list gives a length for each"
+ " flag count.\n"
+ "@item stem-shorten\n"
+ "How much a stem in a forced direction should be shortened."
+ " The list gives an amount depending on the number of flags"
+ " and beams.\n"
+ "@end table\n",
+
+ /* properties */
+ "avoid-note-head "
+ "beam "
+ "beaming "
+ "beamlet-default-length "
+ "beamlet-max-length-proportion "
+ "default-direction "
+ "details "
+ "direction "
+ "duration-log "
+ "flag "
+ "flag-style "
+ "french-beaming "
+ "length "
+ "length-fraction "
+ "max-beam-connect "
+ "neutral-direction "
+ "no-stem-extend "
+ "note-heads "
+ "positioning-done "
+ "rests "
+ "stem-begin-position "
+ "stem-end-position "
+ "stem-info "
+ "stemlet-length "
+ "stroke-style "
+ "thickness "
+ "tremolo-flag "
+ );
/****************************************************************/
{
if (!heads)
heads = scm_permanent_object (scm_cons (SCM_EOL, SCM_EOL));
-
+
scm_set_object_property_x (symbol, ly_symbol2scm ("stencil-head?"), SCM_BOOL_T);
- scm_set_cdr_x (heads, scm_cons (symbol, scm_cdr (heads)));
+ scm_set_cdr_x (heads, scm_cons (symbol, scm_cdr (heads)));
}
bool
is_stencil_head (SCM symbol)
{
return scm_object_property (symbol, ly_symbol2scm ("stencil-head?"))
- == SCM_BOOL_T;
+ == SCM_BOOL_T;
}
SCM
void
interpret_stencil_expression (SCM expr,
- void (*func) (void *, SCM),
- void *func_arg,
- Offset o)
+ void (*func) (void *, SCM),
+ void *func_arg,
+ Offset o)
{
while (1)
{
if (!scm_is_pair (expr))
- return;
+ return;
SCM head = scm_car (expr);
if (head == ly_symbol2scm ("delay-stencil-evaluation"))
- {
- interpret_stencil_expression (scm_force (scm_cadr (expr)), func, func_arg, o);
- return;
- }
+ {
+ interpret_stencil_expression (scm_force (scm_cadr (expr)), func, func_arg, o);
+ return;
+ }
if (head == ly_symbol2scm ("footnote"))
return;
if (head == ly_symbol2scm ("translate-stencil"))
- {
- o += ly_scm2offset (scm_cadr (expr));
- expr = scm_caddr (expr);
- }
+ {
+ o += ly_scm2offset (scm_cadr (expr));
+ expr = scm_caddr (expr);
+ }
else if (head == ly_symbol2scm ("combine-stencil"))
- {
+ {
- for (SCM x = scm_cdr (expr); scm_is_pair (x); x = scm_cdr (x))
- interpret_stencil_expression (scm_car (x), func, func_arg, o);
- return;
- }
+ for (SCM x = scm_cdr (expr); scm_is_pair (x); x = scm_cdr (x))
+ interpret_stencil_expression (scm_car (x), func, func_arg, o);
+ return;
+ }
else if (head == ly_symbol2scm ("grob-cause"))
- {
- SCM grob = scm_cadr (expr);
-
- (*func) (func_arg, scm_list_3 (head,
- ly_quote_scm (ly_offset2scm (o)), grob));
- interpret_stencil_expression (scm_caddr (expr), func, func_arg, o);
- (*func) (func_arg, scm_list_1 (ly_symbol2scm ("no-origin")));
- return;
- }
+ {
+ SCM grob = scm_cadr (expr);
+
+ (*func) (func_arg, scm_list_3 (head,
+ ly_quote_scm (ly_offset2scm (o)), grob));
+ interpret_stencil_expression (scm_caddr (expr), func, func_arg, o);
+ (*func) (func_arg, scm_list_1 (ly_symbol2scm ("no-origin")));
+ return;
+ }
else if (head == ly_symbol2scm ("color"))
- {
- SCM color = scm_cadr (expr);
- SCM r = scm_car (color);
- SCM g = scm_cadr (color);
- SCM b = scm_caddr (color);
-
- (*func) (func_arg, scm_list_4 (ly_symbol2scm ("setcolor"), r, g, b));
- interpret_stencil_expression (scm_caddr (expr), func, func_arg, o);
- (*func) (func_arg, scm_list_1 (ly_symbol2scm ("resetcolor")));
-
- return;
- }
+ {
+ SCM color = scm_cadr (expr);
+ SCM r = scm_car (color);
+ SCM g = scm_cadr (color);
+ SCM b = scm_caddr (color);
+
+ (*func) (func_arg, scm_list_4 (ly_symbol2scm ("setcolor"), r, g, b));
+ interpret_stencil_expression (scm_caddr (expr), func, func_arg, o);
+ (*func) (func_arg, scm_list_1 (ly_symbol2scm ("resetcolor")));
+
+ return;
+ }
else if (head == ly_symbol2scm ("rotate-stencil"))
- {
- SCM args = scm_cadr (expr);
- SCM angle = scm_car (args);
- Offset tmp = o + robust_scm2offset (scm_cadr (args), Offset (0.0, 0.0));
+ {
+ SCM args = scm_cadr (expr);
+ SCM angle = scm_car (args);
+ Offset tmp = o + robust_scm2offset (scm_cadr (args), Offset (0.0, 0.0));
- SCM offset = ly_offset2scm (tmp);
- SCM x = scm_car (offset);
- SCM y = scm_cdr (offset);
+ SCM offset = ly_offset2scm (tmp);
+ SCM x = scm_car (offset);
+ SCM y = scm_cdr (offset);
- (*func) (func_arg, scm_list_4 (ly_symbol2scm ("setrotation"), angle, x, y));
- interpret_stencil_expression (scm_caddr (expr), func, func_arg, o);
- (*func) (func_arg, scm_list_4 (ly_symbol2scm ("resetrotation"), angle, x, y));
+ (*func) (func_arg, scm_list_4 (ly_symbol2scm ("setrotation"), angle, x, y));
+ interpret_stencil_expression (scm_caddr (expr), func, func_arg, o);
+ (*func) (func_arg, scm_list_4 (ly_symbol2scm ("resetrotation"), angle, x, y));
- return;
- }
+ return;
+ }
else if (head == ly_symbol2scm ("scale-stencil"))
- {
- SCM args = scm_cadr (expr);
- SCM x_scale = scm_car (args);
- SCM y_scale = scm_cadr (args);
- Offset unscaled = o.scale (Offset (1 / scm_to_double (x_scale),
- 1 / scm_to_double (y_scale)));
-
- (*func) (func_arg, scm_list_3 (ly_symbol2scm ("setscale"), x_scale,
- y_scale));
- interpret_stencil_expression (scm_caddr (expr), func, func_arg,
- unscaled);
- (*func) (func_arg, scm_list_1 (ly_symbol2scm ("resetscale")));
-
- return;
- }
+ {
+ SCM args = scm_cadr (expr);
+ SCM x_scale = scm_car (args);
+ SCM y_scale = scm_cadr (args);
+ Offset unscaled = o.scale (Offset (1 / scm_to_double (x_scale),
+ 1 / scm_to_double (y_scale)));
+
+ (*func) (func_arg, scm_list_3 (ly_symbol2scm ("setscale"), x_scale,
+ y_scale));
+ interpret_stencil_expression (scm_caddr (expr), func, func_arg,
+ unscaled);
+ (*func) (func_arg, scm_list_1 (ly_symbol2scm ("resetscale")));
+
+ return;
+ }
else
- {
- (*func) (func_arg,
- scm_list_4 (ly_symbol2scm ("placebox"),
- scm_from_double (o[X_AXIS]),
- scm_from_double (o[Y_AXIS]),
- expr));
- return;
- }
+ {
+ (*func) (func_arg,
+ scm_list_4 (ly_symbol2scm ("placebox"),
+ scm_from_double (o[X_AXIS]),
+ scm_from_double (o[Y_AXIS]),
+ expr));
+ return;
+ }
}
}
SCM what = scm_caddr (args);
if (scm_is_pair (what))
- {
- SCM head = scm_car (what);
- if (ly_symbol2scm ("text") == head)
- me->fonts_ = scm_cons (scm_cadr (what), me->fonts_);
- else if (head == ly_symbol2scm ("char"))
- me->fonts_ = scm_cons (scm_cadr (what), me->fonts_);
- }
+ {
+ SCM head = scm_car (what);
+ if (ly_symbol2scm ("text") == head)
+ me->fonts_ = scm_cons (scm_cadr (what), me->fonts_);
+ else if (head == ly_symbol2scm ("char"))
+ me->fonts_ = scm_cons (scm_cadr (what), me->fonts_);
+ }
}
}
fl.fonts_ = SCM_EOL;
interpret_stencil_expression (expr, &find_font_function,
- (void *) & fl, Offset (0, 0));
+ (void *) & fl, Offset (0, 0));
return fl.fonts_;
}
along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "font-metric.hh"
#include "libc-extension.hh"
#include "lookup.hh"
*/
LY_DEFINE (ly_stencil_translate_axis, "ly:stencil-translate-axis",
- 3, 0, 0, (SCM stil, SCM amount, SCM axis),
- "Return a copy of @var{stil} but translated by @var{amount}"
- " in @var{axis} direction.")
+ 3, 0, 0, (SCM stil, SCM amount, SCM axis),
+ "Return a copy of @var{stil} but translated by @var{amount}"
+ " in @var{axis} direction.")
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
}
LY_DEFINE (ly_stencil_translate, "ly:stencil-translate",
- 2, 0, 0, (SCM stil, SCM offset),
- "Return a @var{stil}, but translated by @var{offset}"
- " (a pair of numbers).")
+ 2, 0, 0, (SCM stil, SCM offset),
+ "Return a @var{stil}, but translated by @var{offset}"
+ " (a pair of numbers).")
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
}
LY_DEFINE (ly_stencil_expr, "ly:stencil-expr",
- 1, 0, 0, (SCM stil),
- "Return the expression of @var{stil}.")
+ 1, 0, 0, (SCM stil),
+ "Return the expression of @var{stil}.")
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
}
LY_DEFINE (ly_stencil_extent, "ly:stencil-extent",
- 2, 0, 0, (SCM stil, SCM axis),
- "Return a pair of numbers signifying the extent of @var{stil} in"
- " @var{axis} direction (@code{0} or @code{1} for x and"
- " y@tie{}axis, respectively).")
+ 2, 0, 0, (SCM stil, SCM axis),
+ "Return a pair of numbers signifying the extent of @var{stil} in"
+ " @var{axis} direction (@code{0} or @code{1} for x and"
+ " y@tie{}axis, respectively).")
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
}
LY_DEFINE (ly_stencil_empty_p, "ly:stencil-empty?",
- 1, 0, 0, (SCM stil),
- "Return whether @var{stil} is empty.")
+ 1, 0, 0, (SCM stil),
+ "Return whether @var{stil} is empty.")
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
}
LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge",
- 4, 2, 0, (SCM first, SCM axis, SCM direction,
- SCM second,
- SCM padding,
- SCM minimum),
- "Construct a stencil by putting @var{second} next to @var{first}."
- " @var{axis} can be 0 (x-axis) or@tie{}1 (y-axis)."
- " @var{direction} can be -1 (left or down) or@tie{}1 (right or"
- " up). The stencils are juxtaposed with @var{padding} as extra"
- " space. If this puts the reference points closer than"
- " @var{minimum}, they are moved by the latter amount."
- " @var{first} and @var{second} may also be @code{'()} or"
- " @code{#f}.")
+ 4, 2, 0, (SCM first, SCM axis, SCM direction,
+ SCM second,
+ SCM padding,
+ SCM minimum),
+ "Construct a stencil by putting @var{second} next to @var{first}."
+ " @var{axis} can be 0 (x-axis) or@tie{}1 (y-axis)."
+ " @var{direction} can be -1 (left or down) or@tie{}1 (right or"
+ " up). The stencils are juxtaposed with @var{padding} as extra"
+ " space. If this puts the reference points closer than"
+ " @var{minimum}, they are moved by the latter amount."
+ " @var{first} and @var{second} may also be @code{'()} or"
+ " @code{#f}.")
{
Stencil *s1 = unsmob_stencil (first);
Stencil *s2 = unsmob_stencil (second);
Stencil result;
SCM_ASSERT_TYPE (s1 || first == SCM_BOOL_F || first == SCM_EOL,
- first, SCM_ARG1, __FUNCTION__, "Stencil, #f or ()");
+ first, SCM_ARG1, __FUNCTION__, "Stencil, #f or ()");
SCM_ASSERT_TYPE (s2 || second == SCM_BOOL_F || second == SCM_EOL,
- second, SCM_ARG4, __FUNCTION__, "Stencil, #f or ()");
- LY_ASSERT_TYPE (is_axis, axis, 2);
+ second, SCM_ARG4, __FUNCTION__, "Stencil, #f or ()");
+ LY_ASSERT_TYPE (is_axis, axis, 2);
LY_ASSERT_TYPE (is_direction, direction, 3);
Real p = 0.0;
if (s2)
result.add_at_edge (Axis (scm_to_int (axis)),
- Direction (scm_to_int (direction)), *s2, p);
+ Direction (scm_to_int (direction)), *s2, p);
return result.smobbed_copy ();
}
LY_DEFINE (ly_stencil_add, "ly:stencil-add",
- 0, 0, 1, (SCM args),
- "Combine stencils. Takes any number of arguments.")
+ 0, 0, 1, (SCM args),
+ "Combine stencils. Takes any number of arguments.")
{
#define FUNC_NAME __FUNCTION__
SCM_VALIDATE_REST_ARGUMENT (args);
{
Stencil *s = unsmob_stencil (scm_car (args));
if (!s)
- SCM_ASSERT_TYPE (s, scm_car (args), SCM_ARGn, __FUNCTION__, "Stencil");
+ SCM_ASSERT_TYPE (s, scm_car (args), SCM_ARGn, __FUNCTION__, "Stencil");
extent.unite (s->extent_box ());
*tail = scm_cons (s->expr (), SCM_EOL);
}
LY_DEFINE (ly_make_stencil, "ly:make-stencil",
- 1, 2, 0, (SCM expr, SCM xext, SCM yext),
- "Stencils are device independent output expressions."
- " They carry two pieces of information:\n"
- "\n"
- "@enumerate\n"
- "@item\n"
- "A specification of how to print this object."
- " This specification is processed by the output backends,"
- " for example @file{scm/output-ps.scm}.\n"
- "\n"
- "@item\n"
- "The vertical and horizontal extents of the object, given as"
- " pairs. If an extent is unspecified (or if you use"
- " @code{(1000 . -1000)} as its value), it is taken to be empty.\n"
- "@end enumerate\n")
+ 1, 2, 0, (SCM expr, SCM xext, SCM yext),
+ "Stencils are device independent output expressions."
+ " They carry two pieces of information:\n"
+ "\n"
+ "@enumerate\n"
+ "@item\n"
+ "A specification of how to print this object."
+ " This specification is processed by the output backends,"
+ " for example @file{scm/output-ps.scm}.\n"
+ "\n"
+ "@item\n"
+ "The vertical and horizontal extents of the object, given as"
+ " pairs. If an extent is unspecified (or if you use"
+ " @code{(1000 . -1000)} as its value), it is taken to be empty.\n"
+ "@end enumerate\n")
{
SCM_ASSERT_TYPE (!scm_is_pair (expr)
- || is_stencil_head (scm_car (expr)),
- expr, SCM_ARG1, __FUNCTION__, "registered stencil expression");
-
+ || is_stencil_head (scm_car (expr)),
+ expr, SCM_ARG1, __FUNCTION__, "registered stencil expression");
- Interval x;
+ Interval x;
if (xext != SCM_UNDEFINED)
{
LY_ASSERT_TYPE (is_number_pair, xext, 2);
x = ly_scm2interval (xext);
}
- Interval y;
+ Interval y;
if (yext != SCM_UNDEFINED)
{
LY_ASSERT_TYPE (is_number_pair, yext, 3);
}
LY_DEFINE (ly_stencil_aligned_to, "ly:stencil-aligned-to",
- 3, 0, 0, (SCM stil, SCM axis, SCM dir),
- "Align @var{stil} using its own extents. @var{dir} is a number."
- " @code{-1} and @code{1} are left and right, respectively."
- " Other values are interpolated (so @code{0} means the center).")
+ 3, 0, 0, (SCM stil, SCM axis, SCM dir),
+ "Align @var{stil} using its own extents. @var{dir} is a number."
+ " @code{-1} and @code{1} are left and right, respectively."
+ " Other values are interpolated (so @code{0} means the center).")
{
LY_ASSERT_SMOB (Stencil, stil, 1);
LY_ASSERT_TYPE (is_axis, axis, 2);
Stencil target = *unsmob_stencil (stil);
target.align_to ((Axis)scm_to_int (axis),
- scm_to_double (dir));
+ scm_to_double (dir));
return target.smobbed_copy ();
}
LY_DEFINE (ly_stencil_fonts, "ly:stencil-fonts",
- 1, 0, 0, (SCM s),
- "Analyze @var{s}, and return a list of fonts used"
- " in@tie{}@var{s}.")
+ 1, 0, 0, (SCM s),
+ "Analyze @var{s}, and return a list of fonts used"
+ " in@tie{}@var{s}.")
{
LY_ASSERT_SMOB (Stencil, s, 1);
Stencil *stil = unsmob_stencil (s);
}
LY_DEFINE (ly_stencil_in_color, "ly:stencil-in-color",
- 4, 0, 0, (SCM stc, SCM r, SCM g, SCM b),
- "Put @var{stc} in a different color.")
+ 4, 0, 0, (SCM stc, SCM r, SCM g, SCM b),
+ "Put @var{stc} in a different color.")
{
LY_ASSERT_SMOB (Stencil, stc, 1);
Stencil *stil = unsmob_stencil (stc);
return Stencil (stil->extent_box (),
- scm_list_3 (ly_symbol2scm ("color"),
- scm_list_3 (r, g, b),
- stil->expr ())).smobbed_copy ();
+ scm_list_3 (ly_symbol2scm ("color"),
+ scm_list_3 (r, g, b),
+ stil->expr ())).smobbed_copy ();
}
struct Stencil_interpret_arguments
}
LY_DEFINE (ly_interpret_stencil_expression, "ly:interpret-stencil-expression",
- 4, 0, 0, (SCM expr, SCM func, SCM arg1, SCM offset),
- "Parse @var{expr}, feed bits to @var{func} with first arg"
- " @var{arg1} having offset @var{offset}.")
+ 4, 0, 0, (SCM expr, SCM func, SCM arg1, SCM offset),
+ "Parse @var{expr}, feed bits to @var{func} with first arg"
+ " @var{arg1} having offset @var{offset}.")
{
LY_ASSERT_TYPE (ly_is_procedure, func, 2);
}
LY_DEFINE (ly_bracket, "ly:bracket",
- 4, 0, 0,
- (SCM a, SCM iv, SCM t, SCM p),
- "Make a bracket in direction@tie{}@var{a}. The extent of the"
- " bracket is given by @var{iv}. The wings protrude by an amount"
- " of@tie{}@var{p}, which may be negative. The thickness is given"
- " by@tie{}@var{t}.")
+ 4, 0, 0,
+ (SCM a, SCM iv, SCM t, SCM p),
+ "Make a bracket in direction@tie{}@var{a}. The extent of the"
+ " bracket is given by @var{iv}. The wings protrude by an amount"
+ " of@tie{}@var{p}, which may be negative. The thickness is given"
+ " by@tie{}@var{t}.")
{
LY_ASSERT_TYPE (is_axis, a, 1);
LY_ASSERT_TYPE (is_number_pair, iv, 2);
LY_ASSERT_TYPE (scm_is_number, p, 4);
return Lookup::bracket ((Axis)scm_to_int (a), ly_scm2interval (iv),
- scm_to_double (t),
- scm_to_double (p),
- 0.95 * scm_to_double (t)).smobbed_copy ();
+ scm_to_double (t),
+ scm_to_double (p),
+ 0.95 * scm_to_double (t)).smobbed_copy ();
}
LY_DEFINE (ly_stencil_rotate, "ly:stencil-rotate",
- 4, 0, 0, (SCM stil, SCM angle, SCM x, SCM y),
- "Return a stencil @var{stil} rotated @var{angle} degrees around"
- " the relative offset (@var{x}, @var{y}). E.g. an offset of"
- " (-1, 1) will rotate the stencil around the left upper corner.")
+ 4, 0, 0, (SCM stil, SCM angle, SCM x, SCM y),
+ "Return a stencil @var{stil} rotated @var{angle} degrees around"
+ " the relative offset (@var{x}, @var{y}). E.g. an offset of"
+ " (-1, 1) will rotate the stencil around the left upper corner.")
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
}
LY_DEFINE (ly_stencil_rotate_absolute, "ly:stencil-rotate-absolute",
- 4, 0, 0, (SCM stil, SCM angle, SCM x, SCM y),
- "Return a stencil @var{stil} rotated @var{angle} degrees around"
- " point (@var{x}, @var{y}), given in absolute coordinates.")
+ 4, 0, 0, (SCM stil, SCM angle, SCM x, SCM y),
+ "Return a stencil @var{stil} rotated @var{angle} degrees around"
+ " point (@var{x}, @var{y}), given in absolute coordinates.")
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
}
LY_DEFINE (ly_round_filled_box, "ly:round-filled-box",
- 3, 0, 0,
- (SCM xext, SCM yext, SCM blot),
- "Make a @code{Stencil} object that prints a black box of"
- " dimensions @var{xext}, @var{yext} and roundness @var{blot}.")
+ 3, 0, 0,
+ (SCM xext, SCM yext, SCM blot),
+ "Make a @code{Stencil} object that prints a black box of"
+ " dimensions @var{xext}, @var{yext} and roundness @var{blot}.")
{
LY_ASSERT_TYPE (is_number_pair, xext, 1);
LY_ASSERT_TYPE (is_number_pair, yext, 2);
LY_ASSERT_TYPE (scm_is_number, blot, 3);
return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)),
- scm_to_double (blot)).smobbed_copy ();
+ scm_to_double (blot)).smobbed_copy ();
}
LY_DEFINE (ly_round_filled_polygon, "ly:round-filled-polygon",
- 2, 0, 0,
- (SCM points, SCM blot),
- "Make a @code{Stencil} object that prints a black polygon with"
- " corners at the points defined by @var{points} (list of coordinate"
- " pairs) and roundness @var{blot}.")
+ 2, 0, 0,
+ (SCM points, SCM blot),
+ "Make a @code{Stencil} object that prints a black polygon with"
+ " corners at the points defined by @var{points} (list of coordinate"
+ " pairs) and roundness @var{blot}.")
{
SCM_ASSERT_TYPE (scm_ilength (points) > 0, points, SCM_ARG1, __FUNCTION__, "list of coordinate pairs");
LY_ASSERT_TYPE (scm_is_number, blot, 2);
for (SCM p = points; scm_is_pair (p); p = scm_cdr (p))
{
SCM scm_pt = scm_car (p);
- if (scm_is_pair (scm_pt)) {
- pts.push_back (ly_scm2offset (scm_pt));
- } else {
- // TODO: Print out warning
- }
+ if (scm_is_pair (scm_pt))
+ {
+ pts.push_back (ly_scm2offset (scm_pt));
+ }
+ else
+ {
+ // TODO: Print out warning
+ }
}
return Lookup::round_filled_polygon (pts, scm_to_double (blot)).smobbed_copy ();
}
LY_DEFINE (ly_register_stencil_expression, "ly:register-stencil-expression",
- 1, 0, 0,
- (SCM symbol),
- "Add @var{symbol} as head of a stencil expression.")
+ 1, 0, 0,
+ (SCM symbol),
+ "Add @var{symbol} as head of a stencil expression.")
{
LY_ASSERT_TYPE (ly_is_symbol, symbol, 1);
register_stencil_head (symbol);
}
LY_DEFINE (ly_all_stencil_expressions, "ly:all-stencil-expressions",
- 0, 0, 0,
- (),
- "Return all symbols recognized as stencil expressions.")
+ 0, 0, 0,
+ (),
+ "Return all symbols recognized as stencil expressions.")
{
return all_stencil_heads ();
}
LY_DEFINE (ly_stencil_scale, "ly:stencil-scale",
- 3, 0, 0, (SCM stil, SCM x, SCM y),
- "Scale @var{stil} using the horizontal and vertical scaling"
- " factors @var{x} and @var{y}.")
+ 3, 0, 0, (SCM stil, SCM x, SCM y),
+ "Scale @var{stil} using the horizontal and vertical scaling"
+ " factors @var{x} and @var{y}.")
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
Stencil::is_empty () const
{
return (expr_ == SCM_EOL
- || dim_[X_AXIS].is_empty ()
- || dim_[Y_AXIS].is_empty ());
+ || dim_[X_AXIS].is_empty ()
+ || dim_[Y_AXIS].is_empty ());
}
SCM
void
Stencil::rotate (Real a, Offset off)
{
- rotate_degrees (a * 180/M_PI, off);
+ rotate_degrees (a * 180 / M_PI, off);
}
/*
*/
expr_ = scm_list_n (ly_symbol2scm ("rotate-stencil"),
- scm_list_2 (scm_from_double (a),
- scm_cons (scm_from_double (x), scm_from_double (y))),
- expr_, SCM_UNDEFINED);
+ scm_list_2 (scm_from_double (a),
+ scm_cons (scm_from_double (x), scm_from_double (y))),
+ expr_, SCM_UNDEFINED);
/*
* Calculate the new bounding box
shifted_box.translate (-absolute_off);
vector<Offset> pts;
- pts.push_back (Offset (shifted_box.x ().at(LEFT), shifted_box.y ().at(DOWN)));
- pts.push_back (Offset (shifted_box.x ().at(RIGHT), shifted_box.y ().at(DOWN)));
- pts.push_back (Offset (shifted_box.x ().at(RIGHT), shifted_box.y ().at(UP)));
- pts.push_back (Offset (shifted_box.x ().at(LEFT), shifted_box.y ().at(UP)));
+ pts.push_back (Offset (shifted_box.x ().at (LEFT), shifted_box.y ().at (DOWN)));
+ pts.push_back (Offset (shifted_box.x ().at (RIGHT), shifted_box.y ().at (DOWN)));
+ pts.push_back (Offset (shifted_box.x ().at (RIGHT), shifted_box.y ().at (UP)));
+ pts.push_back (Offset (shifted_box.x ().at (LEFT), shifted_box.y ().at (UP)));
const Offset rot = complex_exp (Offset (0, a * M_PI / 180.0));
dim_.set_empty ();
while (a < NO_AXES)
{
if (isinf (o[a])
- || isnan (o[a])
-
- // ugh, hardcoded.
- || fabs (o[a]) > 1e6)
- {
- programming_error (String_convert::form_string ("Improbable offset for stencil: %f staff space", o[a])
- + "\n"
- + "Setting to zero.");
- o[a] = 0.0;
- if (strict_infinity_checking)
- scm_misc_error (__FUNCTION__, "Improbable offset.", SCM_EOL);
- }
+ || isnan (o[a])
+
+ // ugh, hardcoded.
+ || fabs (o[a]) > 1e6)
+ {
+ programming_error (String_convert::form_string ("Improbable offset for stencil: %f staff space", o[a])
+ + "\n"
+ + "Setting to zero.");
+ o[a] = 0.0;
+ if (strict_infinity_checking)
+ scm_misc_error (__FUNCTION__, "Improbable offset.", SCM_EOL);
+ }
incr (a);
}
expr_ = scm_list_n (ly_symbol2scm ("translate-stencil"),
- ly_offset2scm (o),
- expr_, SCM_UNDEFINED);
+ ly_offset2scm (o),
+ expr_, SCM_UNDEFINED);
if (!is_empty ())
dim_.translate (o);
}
Stencil::scale (Real x, Real y)
{
expr_ = scm_list_3 (ly_symbol2scm ("scale-stencil"),
- scm_list_2 (scm_from_double (x),
- scm_from_double (y)),
- expr_);
+ scm_list_2 (scm_from_double (x),
+ scm_from_double (y)),
+ expr_);
dim_[X_AXIS] *= x;
dim_[Y_AXIS] *= y;
}
his_extent = i[-d];
Real offset = (my_extent.is_empty () ? 0.0 : my_extent[d] - his_extent)
- + d * padding;
+ + d * padding;
Stencil toadd (s);
toadd.translate_axis (offset, a);
Stencil::in_color (Real r, Real g, Real b) const
{
Stencil new_stencil (extent_box (),
- scm_list_3 (ly_symbol2scm ("color"),
- scm_list_3 (scm_from_double (r),
- scm_from_double (g),
- scm_from_double (b)),
- expr ()));
+ scm_list_3 (ly_symbol2scm ("color"),
+ scm_list_3 (scm_from_double (r),
+ scm_from_double (g),
+ scm_from_double (b)),
+ expr ()));
return new_stencil;
}
#include "stream-event.hh"
LY_DEFINE (ly_stream_event_p, "ly:stream-event?",
- 1, 0, 0, (SCM obj),
- "Is @code{@var{obj}} a @code{Stream_event} object?")
+ 1, 0, 0, (SCM obj),
+ "Is @code{@var{obj}} a @code{Stream_event} object?")
{
return scm_from_bool (unsmob_stream_event (obj));
}
LY_DEFINE (ly_make_stream_event, "ly:make-stream-event",
- 1, 1, 0, (SCM cl, SCM proplist),
- "Create a stream event of class @var{cl} with the given"
- " mutable property list.")
+ 1, 1, 0, (SCM cl, SCM proplist),
+ "Create a stream event of class @var{cl} with the given"
+ " mutable property list.")
{
LY_ASSERT_TYPE (ly_is_symbol, cl, 1);
/* should be scm_list_p, but scm_list_p is expensive. */
LY_ASSERT_TYPE (scm_is_pair, proplist, 2);
-
+
if (proplist == SCM_UNDEFINED)
proplist = SCM_EOL;
return e->unprotect ();
}
-LY_DEFINE (ly_event_property, "ly:event-property",
+LY_DEFINE (ly_event_property, "ly:event-property",
2, 0, 0, (SCM sev, SCM sym),
- "Get the property @var{sym} of stream event @var{mus}."
- " If @var{sym} is undefined, return @code{'()}.")
+ "Get the property @var{sym} of stream event @var{mus}."
+ " If @var{sym} is undefined, return @code{'()}.")
{
LY_ASSERT_TYPE (unsmob_stream_event, sev, 1);
LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
{
LY_ASSERT_TYPE (unsmob_stream_event, ev, 1);
LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
-
+
return ly_prob_set_property_x (ev, sym, val);
}
LY_DEFINE (ly_event_deep_copy, "ly:event-deep-copy",
- 1, 0, 0, (SCM m),
- "Copy @var{m} and all sub expressions of@tie{}@var{m}.")
+ 1, 0, 0, (SCM m),
+ "Copy @var{m} and all sub expressions of@tie{}@var{m}.")
{
SCM copy = m;
if (Stream_event *ev = unsmob_stream_event (m))
}
else if (scm_is_pair (m))
copy = scm_cons (ly_event_deep_copy (scm_car (m)),
- ly_event_deep_copy (scm_cdr (m)));
+ ly_event_deep_copy (scm_cdr (m)));
return copy;
}
Stream_event::Stream_event (SCM event_class, SCM mutable_props)
: Prob (ly_symbol2scm ("Stream_event"),
- scm_list_1 (scm_cons (ly_symbol2scm ("class"), event_class)))
+ scm_list_1 (scm_cons (ly_symbol2scm ("class"), event_class)))
{
mutable_property_alist_ = mutable_props;
}
Stream_event::Stream_event (SCM class_name, Input *origin)
: Prob (ly_symbol2scm ("Stream_event"),
- scm_list_1 (scm_cons (ly_symbol2scm ("class"), class_name)))
+ scm_list_1 (scm_cons (ly_symbol2scm ("class"), class_name)))
{
if (origin)
set_spot (origin);
Stream_event *ev = unsmob_stream_event (self);
// Reversed alists look prettier.
return scm_cons (scm_reverse (ev->immutable_property_alist_),
- scm_reverse (ev->mutable_property_alist_));
+ scm_reverse (ev->mutable_property_alist_));
}
SCM
Stream_event *
unsmob_stream_event (SCM m)
{
- return dynamic_cast<Stream_event*> (unsmob_prob (m));
+ return dynamic_cast<Stream_event *> (unsmob_prob (m));
}
#include "stencil.hh"
#include "font-interface.hh"
-// update comment --hwn
+// update comment --hwn
/*
Urg.
This is almost text
{
string idx ("pedal.");
if (text.substr (i, 3) == "Ped")
- {
- idx += "Ped";
- i += 2;
- }
+ {
+ idx += "Ped";
+ i += 2;
+ }
else
- idx += string (&text.c_str ()[i], 1);
+ idx += string (&text.c_str ()[i], 1);
Stencil m = Font_interface::get_default_font (e)->find_by_name (idx);
if (!m.is_empty ())
- mol.add_at_edge (X_AXIS, RIGHT, m, 0);
+ mol.add_at_edge (X_AXIS, RIGHT, m, 0);
}
return mol.smobbed_copy ();
struct Bracket_nesting_group : public Bracket_nesting_node
{
Spanner *delimiter_;
- vector<Bracket_nesting_node*> children_;
+ vector<Bracket_nesting_node *> children_;
SCM symbol_;
void from_list (SCM);
Bracket_nesting_group ();
};
-
struct Bracket_nesting_staff : public Bracket_nesting_node
{
Grob *staff_;
virtual bool add_staff (Grob *);
};
-
Bracket_nesting_group::Bracket_nesting_group ()
{
symbol_ = SCM_EOL;
{
SCM type = scm_is_symbol (symbol_) ? symbol_ : default_type;
delimiter_ = engraver->make_spanner (ly_symbol2string (type).c_str (),
- SCM_EOL);
+ SCM_EOL);
- for (vsize i = 0 ; i < children_.size (); i++)
+ for (vsize i = 0; i < children_.size (); i++)
children_[i]->create_grobs (engraver, default_type);
}
Bracket_nesting_group::add_support (Grob *g)
{
Side_position_interface::add_support (g, delimiter_);
- for (vsize i = 0 ; i < children_.size (); i++)
+ for (vsize i = 0; i < children_.size (); i++)
children_[i]->add_support (g);
}
Bracket_nesting_group::set_bound (Direction d, Grob *g)
{
delimiter_->set_bound (d, g);
- for (vsize i = 0 ; i < children_.size (); i++)
+ for (vsize i = 0; i < children_.size (); i++)
children_[i]->set_bound (d, g);
}
if (parent)
Side_position_interface::add_support (delimiter_, parent);
- for (vsize i = 0 ; i < children_.size (); i++)
+ for (vsize i = 0; i < children_.size (); i++)
children_[i]->set_nesting_support (delimiter_);
}
-
void
Bracket_nesting_group::from_list (SCM x)
{
{
SCM entry = scm_car (s);
if (scm_is_pair (entry))
- {
- Bracket_nesting_group *node = new Bracket_nesting_group;
- node->from_list (entry);
- children_.push_back (node);
- }
+ {
+ Bracket_nesting_group *node = new Bracket_nesting_group;
+ node->from_list (entry);
+ children_.push_back (node);
+ }
else if (entry == ly_symbol2scm ("SystemStartBrace")
- || entry == ly_symbol2scm ("SystemStartBracket")
- || entry == ly_symbol2scm ("SystemStartBar")
- || entry == ly_symbol2scm ("SystemStartSquare"))
- symbol_ = entry;
+ || entry == ly_symbol2scm ("SystemStartBracket")
+ || entry == ly_symbol2scm ("SystemStartBar")
+ || entry == ly_symbol2scm ("SystemStartSquare"))
+ symbol_ = entry;
else
- children_.push_back (new Bracket_nesting_staff (0));
+ children_.push_back (new Bracket_nesting_staff (0));
}
}
for (vsize i = 0; i < children_.size (); i++)
{
if (children_[i]->add_staff (grob))
- {
- Pointer_group_interface::add_grob (delimiter_,
- ly_symbol2scm ("elements"), grob);
- return true;
- }
+ {
+ Pointer_group_interface::add_grob (delimiter_,
+ ly_symbol2scm ("elements"), grob);
+ return true;
+ }
}
return false;
}
-
-
-
/****************/
class System_start_delimiter_engraver : public Engraver
nesting_->from_list (hierarchy);
nesting_->create_grobs (this, delimiter_name);
nesting_->set_bound (LEFT,
- unsmob_grob (get_property ("currentCommandColumn")));
+ unsmob_grob (get_property ("currentCommandColumn")));
}
}
if (nesting_)
{
nesting_->set_bound (RIGHT,
- unsmob_grob (get_property ("currentCommandColumn")));
+ unsmob_grob (get_property ("currentCommandColumn")));
nesting_->set_nesting_support (0);
delete nesting_;
ADD_ACKNOWLEDGER (System_start_delimiter_engraver, system_start_delimiter);
ADD_TRANSLATOR (System_start_delimiter_engraver,
- /* doc */
- "Create a system start delimiter (i.e., a"
- " @code{SystemStartBar}, @code{SystemStartBrace},"
- " @code{SystemStartBracket} or @code{SystemStartSquare}"
- " spanner).",
-
- /* create */
- "SystemStartSquare "
- "SystemStartBrace "
- "SystemStartBracket "
- "SystemStartBar ",
-
- /* read */
- "systemStartDelimiter "
- "systemStartDelimiterHierarchy "
- "currentCommandColumn ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create a system start delimiter (i.e., a"
+ " @code{SystemStartBar}, @code{SystemStartBrace},"
+ " @code{SystemStartBracket} or @code{SystemStartSquare}"
+ " spanner).",
+
+ /* create */
+ "SystemStartSquare "
+ "SystemStartBrace "
+ "SystemStartBracket "
+ "SystemStartBar ",
+
+ /* read */
+ "systemStartDelimiter "
+ "systemStartDelimiterHierarchy "
+ "currentCommandColumn ",
+
+ /* write */
+ ""
+ );
Font_metric *fm = Font_interface::get_default_font (me);
Drul_array<Stencil> tips (fm->find_by_name ("brackettips.down"),
- fm->find_by_name ("brackettips.up"));
+ fm->find_by_name ("brackettips.up"));
Real thickness = robust_scm2double (me->get_property ("thickness"), 0.25);
Real overlap = 0.1 * thickness;
Box box (Interval (0, thickness),
- Interval (-1, 1)
- * (height / 2 + overlap));
-
+ Interval (-1, 1)
+ * (height / 2 + overlap));
+
Stencil bracket = Lookup::filled_box (box);
Direction d = DOWN;
do
bracket = Stencil (box, bracket.expr ());
bracket.translate_axis (-0.8, X_AXIS);
-
+
return bracket;
}
{
Real thick
= me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"))
- * robust_scm2double (me->get_property ("thickness"), 1);
+ * robust_scm2double (me->get_property ("thickness"), 1);
Real w = 0.8;
-
+
Stencil tip1 = Line_interface::make_line (thick,
- Offset (0, -height/2),
- Offset (w, -height/2));
+ Offset (0, -height / 2),
+ Offset (w, -height / 2));
Stencil tip2 = Line_interface::make_line (thick,
- Offset (0, height/2),
- Offset (w, height/2));
+ Offset (0, height / 2),
+ Offset (w, height / 2));
Stencil vline = Line_interface::make_line (thick,
- Offset (0, -height/2),
- Offset (0, height/2));
+ Offset (0, -height / 2),
+ Offset (0, height / 2));
vline.add_stencil (tip1);
vline.add_stencil (tip2);
Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
Real w = lt * robust_scm2double (me->get_property ("thickness"), 1);
return Lookup::round_filled_box (Box (Interval (0, w), Interval (-h / 2, h / 2)),
- lt);
+ lt);
}
MAKE_SCHEME_CALLBACK (System_start_delimiter, print, 1);
Spanner *sp = dynamic_cast<Spanner *> (elts[i]);
if (sp
- && sp->get_bound (LEFT) == me->get_bound (LEFT))
- {
- Interval dims = sp->extent (common, Y_AXIS);
- if (!dims.is_empty ())
- {
- non_empty_count ++;
- ext.unite (dims);
+ && sp->get_bound (LEFT) == me->get_bound (LEFT))
+ {
+ Interval dims = sp->extent (common, Y_AXIS);
+ if (!dims.is_empty ())
+ {
+ non_empty_count++;
+ ext.unite (dims);
staffspace = Staff_symbol_referencer::staff_space (sp);
- }
- }
+ }
+ }
}
SCM glyph_sym = me->get_property ("style");
fm = Font_interface::get_default_font (me);
int
- lo = 0;
+ lo = 0;
int hi = max ((int) fm->count () - 1, 2);
/* do a binary search for each Y, not very efficient, but passable? */
int cmp = (lo + hi) / 2;
b = fm->get_indexed_char_dimensions (cmp);
if (b[Y_AXIS].is_empty () || b[Y_AXIS].length () > y)
- hi = cmp;
+ hi = cmp;
else
- lo = cmp;
+ lo = cmp;
}
while (hi - lo > 1);
Stencil stil (fm->find_by_name ("brace" + to_string (lo)));
- stil.translate_axis (-b[X_AXIS].length ()/2, X_AXIS);
+ stil.translate_axis (-b[X_AXIS].length () / 2, X_AXIS);
stil.translate_axis (-0.2, X_AXIS);
-
+
return stil;
}
ADD_INTERFACE (System_start_delimiter,
- "The brace, bracket or bar in front of the system. The"
- " following values for @code{style} are recognized:\n"
- "\n"
- "@table @code\n"
- "@item bracket\n"
- "A thick bracket, normally used to group similar"
- " instruments in a score. Default for @code{StaffGroup}."
- " @code{SystemStartBracket} uses this style.\n"
- "@item brace\n"
- "A @q{piano style} brace normally used for an instrument"
- " that uses two staves. The default style for"
- " @code{GrandStaff}. @code{SystemStartBrace} uses this"
- " style.\n"
- "@item bar-line\n"
- "A simple line between the staves in a score. Default"
- " for staves enclosed in @code{<<} and @code{>>}."
- " @code{SystemStartBar} uses this style.\n"
- "@item line-bracket\n"
- "A simple square, normally used for subgrouping"
- " instruments in a score. @code{SystemStartSquare} uses"
- " this style.\n"
- "@end table\n"
- "\n"
- "See also @file{input/regression/system-start-nesting.ly}.",
-
- /* properties */
- "collapse-height "
- "style "
- "thickness "
- );
+ "The brace, bracket or bar in front of the system. The"
+ " following values for @code{style} are recognized:\n"
+ "\n"
+ "@table @code\n"
+ "@item bracket\n"
+ "A thick bracket, normally used to group similar"
+ " instruments in a score. Default for @code{StaffGroup}."
+ " @code{SystemStartBracket} uses this style.\n"
+ "@item brace\n"
+ "A @q{piano style} brace normally used for an instrument"
+ " that uses two staves. The default style for"
+ " @code{GrandStaff}. @code{SystemStartBrace} uses this"
+ " style.\n"
+ "@item bar-line\n"
+ "A simple line between the staves in a score. Default"
+ " for staves enclosed in @code{<<} and @code{>>}."
+ " @code{SystemStartBar} uses this style.\n"
+ "@item line-bracket\n"
+ "A simple square, normally used for subgrouping"
+ " instruments in a score. @code{SystemStartSquare} uses"
+ " this style.\n"
+ "@end table\n"
+ "\n"
+ "See also @file{input/regression/system-start-nesting.ly}.",
+
+ /* properties */
+ "collapse-height "
+ "style "
+ "thickness "
+ );
Grob **ptr = &all_elements_->array_reference ()[0];
Grob **end = ptr + all_elements_->size ();
while (ptr < end)
- {
- scm_gc_mark ((*ptr)->self_scm ());
- ptr++;
- }
+ {
+ scm_gc_mark ((*ptr)->self_scm ());
+ ptr++;
+ }
}
if (pscore_)
{
Grob *g = all_elements_->grob (i);
if (g->internal_has_interface (ly_symbol2scm ("only-prebreak-interface")))
- {
- /*
- Kill no longer needed grobs.
- */
- Item *it = dynamic_cast<Item *> (g);
- if (it && Item::is_non_musical (it))
- {
- it->find_prebroken_piece (LEFT)->suicide ();
- it->find_prebroken_piece (RIGHT)->suicide ();
- }
- g->suicide ();
- }
+ {
+ /*
+ Kill no longer needed grobs.
+ */
+ Item *it = dynamic_cast<Item *> (g);
+ if (it && Item::is_non_musical (it))
+ {
+ it->find_prebroken_piece (LEFT)->suicide ();
+ it->find_prebroken_piece (RIGHT)->suicide ();
+ }
+ g->suicide ();
+ }
else if (g->is_live ())
- g->do_break_processing ();
+ g->do_break_processing ();
}
/*
extract_grob_set (se, "all-elements", all_elts);
for (vsize j = 0; j < all_elts.size (); j++)
- {
- Grob *g = all_elts[j];
- g->fixup_refpoint ();
- }
-
+ {
+ Grob *g = all_elts[j];
+ g->fixup_refpoint ();
+ }
+
count += all_elts.size ();
}
System *child = dynamic_cast<System *> (broken_intos_[i]);
child->all_elements_->remove_duplicates ();
for (vsize j = 0; j < child->all_elements_->size (); j++)
- {
- Grob *g = child->all_elements_->grob (j);
+ {
+ Grob *g = child->all_elements_->grob (j);
- (void) g->get_property ("after-line-breaking");
- }
+ (void) g->get_property ("after-line-breaking");
+ }
}
if (be_verbose_global)
for (vsize i = 0; i < broken_intos_.size (); i++)
{
if (be_verbose_global)
- progress_indication ("[");
+ progress_indication ("[");
System *system = dynamic_cast<System *> (broken_intos_[i]);
scm_vector_set_x (lines, scm_from_int (i),
- system->get_paper_system ());
+ system->get_paper_system ());
if (be_verbose_global)
- progress_indication (to_string (i) + "]");
+ progress_indication (to_string (i) + "]");
}
return lines;
}
bool end_of_line_visible = true;
if (Spanner *s = dynamic_cast<Spanner *>(footnote_grobs_[i]))
{
- Direction spanner_placement = robust_scm2dir (s->get_property ("spanner-placement"), LEFT);
+ Direction spanner_placement = robust_scm2dir (s->get_property ("spanner-placement"), LEFT);
if (spanner_placement == CENTER)
spanner_placement = LEFT;
pos = s->spanned_rank_interval ()[spanner_placement];
}
-
+
if (Item *item = dynamic_cast<Item *>(footnote_grobs_[i]))
{
if (!Item::break_visible (item))
system->set_bound (RIGHT, c.back ());
SCM system_labels = SCM_EOL;
for (vsize j = 0; j < c.size (); j++)
- {
- c[j]->translate_axis (breaking[i].config_[j], X_AXIS);
- dynamic_cast<Paper_column *> (c[j])->set_system (system);
- /* collect the column labels */
- collect_labels (c[j], &system_labels);
- }
+ {
+ c[j]->translate_axis (breaking[i].config_[j], X_AXIS);
+ dynamic_cast<Paper_column *> (c[j])->set_system (system);
+ /* collect the column labels */
+ collect_labels (c[j], &system_labels);
+ }
/*
- Collect labels from any loose columns too: theses will be set on
- an empty bar line or a column which is otherwise unused mid-line
+ Collect labels from any loose columns too: theses will be set on
+ an empty bar line or a column which is otherwise unused mid-line
*/
vector<Grob *> loose (breaking[i].loose_cols_);
for (vsize j = 0; j < loose.size (); j++)
- collect_labels (loose[j], &system_labels);
+ collect_labels (loose[j], &system_labels);
system->set_property ("labels", system_labels);
};
bool
-operator< (Layer_entry const &a,
- Layer_entry const &b)
+operator < (Layer_entry const &a,
+ Layer_entry const &b)
{
return a.layer_ < b.layer_;
}
Stencil st = g->get_print_stencil ();
if (st.expr () == SCM_EOL)
- continue;
+ continue;
Offset o;
for (int a = X_AXIS; a < NO_AXES; a++)
- o[Axis (a)] = g->relative_coordinate (this, Axis (a));
+ o[Axis (a)] = g->relative_coordinate (this, Axis (a));
Offset extra = robust_scm2offset (g->get_property ("extra-offset"),
- Offset (0, 0))
- * Staff_symbol_referencer::staff_space (g);
+ Offset (0, 0))
+ * Staff_symbol_referencer::staff_space (g);
/* Must copy the stencil, for we cannot change the stencil
- cached in G. */
+ cached in G. */
st.translate (o + extra);
Interval x (extent (this, X_AXIS));
Interval y (extent (this, Y_AXIS));
Stencil sys_stencil (Box (x, y),
- scm_cons (ly_symbol2scm ("combine-stencil"),
- exprs));
+ scm_cons (ly_symbol2scm ("combine-stencil"),
+ exprs));
if (debug_skylines)
{
Skyline_pair *skylines = Skyline_pair::unsmob (get_property ("vertical-skylines"));
if (skylines)
- {
- Stencil up
- = Lookup::points_to_line_stencil (0.1, (*skylines)[UP].to_points (X_AXIS));
- Stencil down
- = Lookup::points_to_line_stencil (0.1, (*skylines)[DOWN].to_points (X_AXIS));
- sys_stencil.add_stencil (up.in_color (255, 0, 0));
- sys_stencil.add_stencil (down.in_color (0, 255, 0));
- }
+ {
+ Stencil up
+ = Lookup::points_to_line_stencil (0.1, (*skylines)[UP].to_points (X_AXIS));
+ Stencil down
+ = Lookup::points_to_line_stencil (0.1, (*skylines)[DOWN].to_points (X_AXIS));
+ sys_stencil.add_stencil (up.in_color (255, 0, 0));
+ sys_stencil.add_stencil (down.in_color (0, 255, 0));
+ }
}
Grob *left_bound = this->get_bound (LEFT);
{
extract_grob_set (align, "elements", staves);
for (vsize i = 0; i < staves.size (); i++)
- if (staves[i]->is_live ()
- && Page_layout_problem::is_spaceable (staves[i]))
- staff_refpoints.add_point (staves[i]->relative_coordinate (this,
- Y_AXIS));
+ if (staves[i]->is_live ()
+ && Page_layout_problem::is_spaceable (staves[i]))
+ staff_refpoints.add_point (staves[i]->relative_coordinate (this,
+ Y_AXIS));
}
pl->set_property ("staff-refpoint-extent", ly_interval2scm (staff_refpoints));
i++;
while (i < cols.size ()
- && Paper_column::get_rank (cols[i]) < end_rank)
+ && Paper_column::get_rank (cols[i]) < end_rank)
{
Paper_column *c = dynamic_cast<Paper_column *> (cols[i]);
if (Paper_column::is_breakable (c) && !c->get_system ())
- ret.push_back (c);
+ ret.push_back (c);
i++;
}
while (last_breakable--)
{
if (Paper_column::is_breakable (ro_columns [last_breakable]))
- break;
+ break;
}
vector<Grob *> columns;
for (int i = 0; i <= last_breakable; i++)
{
if (Paper_column::is_used (ro_columns[i]))
- columns.push_back (ro_columns[i]);
+ columns.push_back (ro_columns[i]);
}
return columns;
for (vsize i = 0; i < elts.size (); i++)
if (Align_interface::has_interface (elts[i]))
{
- if (ret)
- programming_error ("found multiple vertical alignments in this system");
- ret = elts[i];
+ if (ret)
+ programming_error ("found multiple vertical alignments in this system");
+ ret = elts[i];
}
if (!ret)
for (vsize i = start; i != end; i += dir)
{
if (Hara_kiri_group_spanner::has_interface (elts[i]))
- Hara_kiri_group_spanner::consider_suicide (elts[i]);
+ Hara_kiri_group_spanner::consider_suicide (elts[i]);
Interval intersection = elts[i]->extent (this, X_AXIS);
intersection.intersect (iv);
if (elts[i]->is_live () && !intersection.is_empty ())
- return elts[i];
+ return elts[i];
}
return 0;
}
for (vsize i = 0; i < offsets.size (); ++i)
if (Page_layout_problem::is_spaceable (staves[i]))
{
- ret[UP] = offsets[i];
- break;
+ ret[UP] = offsets[i];
+ break;
}
for (vsize i = offsets.size (); i--;)
if (Page_layout_problem::is_spaceable (staves[i]))
{
- ret[DOWN] = offsets[i];
- break;
+ ret[DOWN] = offsets[i];
+ break;
}
return ret;
for (vsize i = 0; i < staves.size (); ++i)
{
Interval iv = begin
- ? Axis_group_interface::begin_of_line_pure_height (staves[i], start)
- : Axis_group_interface::rest_of_line_pure_height (staves[i], start, end);
+ ? Axis_group_interface::begin_of_line_pure_height (staves[i], start)
+ : Axis_group_interface::rest_of_line_pure_height (staves[i], start, end);
if (i < offsets.size ())
- iv.translate (offsets[i]);
+ iv.translate (offsets[i]);
ret.unite (iv);
}
Interval other_elements = begin
- ? Axis_group_interface::begin_of_line_pure_height (this, start)
- : Axis_group_interface::rest_of_line_pure_height (this, start, end);
+ ? Axis_group_interface::begin_of_line_pure_height (this, start)
+ : Axis_group_interface::rest_of_line_pure_height (this, start, end);
ret.unite (other_elements);
for (vsize i = 0; i < elts.size (); ++i)
{
if (!Axis_group_interface::has_interface (elts[i]))
- {
- if (to_boolean (scm_apply_1 (pure_relevant_p, elts[i]->self_scm (), SCM_EOL)))
- relevant_grobs.push_back (elts[i]);
-
- if (Item *it = dynamic_cast<Item*> (elts[i]))
- {
- Direction d = LEFT;
- do
- {
- Item *piece = it->find_prebroken_piece (d);
- if (piece && to_boolean (scm_apply_1 (pure_relevant_p, piece->self_scm (), SCM_EOL)))
- relevant_grobs.push_back (piece);
- }
- while (flip (&d) != LEFT);
- }
- }
+ {
+ if (to_boolean (scm_apply_1 (pure_relevant_p, elts[i]->self_scm (), SCM_EOL)))
+ relevant_grobs.push_back (elts[i]);
+
+ if (Item *it = dynamic_cast<Item *> (elts[i]))
+ {
+ Direction d = LEFT;
+ do
+ {
+ Item *piece = it->find_prebroken_piece (d);
+ if (piece && to_boolean (scm_apply_1 (pure_relevant_p, piece->self_scm (), SCM_EOL)))
+ relevant_grobs.push_back (piece);
+ }
+ while (flip (&d) != LEFT);
+ }
+ }
}
SCM grobs_scm = Grob_array::make_array ();
return ly_interval2scm (begin);
}
-Grob*
+Grob *
System::get_pure_bound (Direction d, int start, int end)
{
vector<vsize> ranks = pscore_->get_break_ranks ();
vector<vsize> indices = pscore_->get_break_indices ();
- vector<Grob*> cols = pscore_->get_columns ();
+ vector<Grob *> cols = pscore_->get_columns ();
vsize target_rank = (d == LEFT ? start : end);
- vector<vsize>::const_iterator i =
- lower_bound (ranks.begin (), ranks.end (), target_rank, std::less<vsize> ());
+ vector<vsize>::const_iterator i
+ = lower_bound (ranks.begin (), ranks.end (), target_rank, std::less<vsize> ());
if (i != ranks.end () && (*i) == target_rank)
return cols[indices[i - ranks.begin ()]];
return 0;
}
-Grob*
+Grob *
System::get_maybe_pure_bound (Direction d, bool pure, int start, int end)
{
return pure ? get_pure_bound (d, start, end) : get_bound (d);
}
ADD_INTERFACE (System,
- "This is the top-level object: Each object in a score"
- " ultimately has a @code{System} object as its X and"
- " Y@tie{}parent.",
-
- /* properties */
- "all-elements "
- "columns "
- "labels "
- "pure-Y-extent "
- "skyline-horizontal-padding "
- );
+ "This is the top-level object: Each object in a score"
+ " ultimately has a @code{System} object as its X and"
+ " Y@tie{}parent.",
+
+ /* properties */
+ "all-elements "
+ "columns "
+ "labels "
+ "pure-Y-extent "
+ "skyline-horizontal-padding "
+ );
Tab_note_heads_engraver::process_music ()
{
SCM tab_strings = articulation_list (note_events_,
- tabstring_events_,
- "string-number-event");
+ tabstring_events_,
+ "string-number-event");
SCM defined_fingers = articulation_list (note_events_,
- fingering_events_,
- "fingering-event");
+ fingering_events_,
+ "fingering-event");
SCM tab_notes = ly_cxx_vector_to_list (note_events_);
SCM proc = get_property ("noteToFretFunction");
SCM string_fret_finger = SCM_EOL;
if (ly_is_procedure (proc))
string_fret_finger = scm_call_3 (proc,
- context ()->self_scm (),
- tab_notes,
- scm_list_2 (tab_strings,
- defined_fingers));
+ context ()->self_scm (),
+ tab_notes,
+ scm_list_2 (tab_strings,
+ defined_fingers));
SCM note_entry = SCM_EOL;
SCM string_number = SCM_EOL;
SCM fret = SCM_EOL;
if (string_fret_finger != SCM_EOL)
for (vsize i = 0; i < fret_count; i++)
{
- note_entry = scm_list_ref (string_fret_finger, scm_from_int (i));
- string_number = scm_car (note_entry);
+ note_entry = scm_list_ref (string_fret_finger, scm_from_int (i));
+ string_number = scm_car (note_entry);
if (string_number != SCM_BOOL_F)
{
- fret = scm_cadr (note_entry);
- fret_label = scm_call_3 (fret_procedure,
- context ()->self_scm (),
- string_number,
- fret);
- index = length_changed ? 0 : i;
- Item *note = make_item ("TabNoteHead", note_events_[index]->self_scm ());
- note->set_property ("text", fret_label);
- staff_position = scm_call_2 (staff_line_procedure,
- context ()->self_scm (),
- string_number);
- note->set_property ("staff-position", staff_position);
+ fret = scm_cadr (note_entry);
+ fret_label = scm_call_3 (fret_procedure,
+ context ()->self_scm (),
+ string_number,
+ fret);
+ index = length_changed ? 0 : i;
+ Item *note = make_item ("TabNoteHead", note_events_[index]->self_scm ());
+ note->set_property ("text", fret_label);
+ staff_position = scm_call_2 (staff_line_procedure,
+ context ()->self_scm (),
+ string_number);
+ note->set_property ("staff-position", staff_position);
}
}
}
}
ADD_TRANSLATOR (Tab_note_heads_engraver,
- /* doc */
- "Generate one or more tablature note heads from event of type"
- " @code{NoteEvent}.",
-
- /* create */
- "TabNoteHead ",
-
- /* read */
- "defaultStrings "
- "fretLabels "
- "highStringOne "
- "middleCPosition "
- "minimumFret "
- "noteToFretFunction "
- "stringOneTopmost "
- "stringTunings "
- "tablatureFormat "
- "tabStaffLineLayoutFunction ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Generate one or more tablature note heads from event of type"
+ " @code{NoteEvent}.",
+
+ /* create */
+ "TabNoteHead ",
+
+ /* read */
+ "defaultStrings "
+ "fretLabels "
+ "highStringOne "
+ "middleCPosition "
+ "minimumFret "
+ "noteToFretFunction "
+ "stringOneTopmost "
+ "stringTunings "
+ "tablatureFormat "
+ "tabStaffLineLayoutFunction ",
+
+ /* write */
+ ""
+ );
ADD_ACKNOWLEDGER (Tab_staff_symbol_engraver, staff_symbol);
ADD_TRANSLATOR (Tab_staff_symbol_engraver,
- /* doc */
- "Create a tablature staff symbol, but look at"
- " @code{stringTunings} for the number of lines.",
+ /* doc */
+ "Create a tablature staff symbol, but look at"
+ " @code{stringTunings} for the number of lines.",
- /* create */
- "StaffSymbol ",
+ /* create */
+ "StaffSymbol ",
- /* read */
- "stringTunings ",
+ /* read */
+ "stringTunings ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
bool spanner_start = false;
for (vsize j = 0; j < slurs_.size (); j++)
{
- Item* left_item = slurs_[j]->get_bound (LEFT);
+ Item *left_item = slurs_[j]->get_bound (LEFT);
if (left_item)
{
SCM left_cause = left_item->get_property ("cause");
Item *slur_cause = unsmob_item (left_cause);
- if (slur_cause == note_heads_[k])
+ if (slur_cause == note_heads_[k])
{
note_heads_[k]->set_property ("span-start", SCM_BOOL_T);
spanner_start = true;
}
slurs_.clear ();
glissandi_.clear ();
- note_heads_.clear();
+ note_heads_.clear ();
}
ADD_ACKNOWLEDGER (Tab_tie_follow_engraver, slur);
ADD_ACKNOWLEDGER (Tab_tie_follow_engraver, glissando);
ADD_ACKNOWLEDGER (Tab_tie_follow_engraver, tab_note_head);
-
ADD_TRANSLATOR (Tab_tie_follow_engraver,
- /* doc */
- "Adjust TabNoteHead properties when a tie is followed"
- " by a slur or glissando.",
+ /* doc */
+ "Adjust TabNoteHead properties when a tie is followed"
+ " by a slur or glissando.",
- /* create */
- " ",
+ /* create */
+ " ",
- /* read */
+ /* read */
" ",
- /* write */
+ /* write */
" "
- );
+ );
return infty;
}
-
template<>
string
Interval_t<Rational>::T_to_string (Rational a)
template INTERVAL__INSTANTIATE (Rational);
-
template<>
Moment
Interval_t<Moment>::infinity ()
{
Moment infty;
-
+
infty.main_part_.set_infinite (1);
return infty;
}
-
template<>
string
Interval_t<Moment>::T_to_string (Moment a)
protected:
- virtual void derived_mark () const;
+ virtual void derived_mark () const;
void stop_translation_timestep ();
void process_music ();
private:
Audio_tempo *audio_;
- SCM last_tempo_;
+ SCM last_tempo_;
};
void
}
ADD_TRANSLATOR (Tempo_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "tempoWholesPerMinute ",
+ /* read */
+ "tempoWholesPerMinute ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Item *text = make_item ("TextScript", r->self_scm ());
int priority = robust_scm2int (text->get_property ("script-priority"),
- 200);
+ 200);
/* see script-engraver.cc */
priority += i;
Direction dir = to_dir (r->get_property ("direction"));
if (dir)
- set_grob_direction (text, dir);
+ set_grob_direction (text, dir);
SCM mark = r->get_property ("text");
}
ADD_TRANSLATOR (Text_engraver,
- /* doc */
- "Create text scripts.",
+ /* doc */
+ "Create text scripts.",
- /* create */
- "TextScript ",
+ /* create */
+ "TextScript ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
// avoid the locale-dependent isspace
if (cur == '\n' || cur == '\t' || cur == '\v')
- (*str)[i] = ' ';
+ (*str)[i] = ' ';
vsize char_len = utf8_char_len (cur);
MAKE_SCHEME_CALLBACK (Text_interface, interpret_string, 3);
SCM
Text_interface::interpret_string (SCM layout_smob,
- SCM props,
- SCM markup)
+ SCM props,
+ SCM markup)
{
LY_ASSERT_SMOB (Output_def, layout_smob, 1);
LY_ASSERT_TYPE (scm_is_string, markup, 3);
if it matches one of the music font encodings. --pmccarty
*/
SCM encoding = ly_chain_assoc_get (ly_symbol2scm ("font-encoding"),
- props,
- SCM_BOOL_F);
+ props,
+ SCM_BOOL_F);
SCM music_encodings = ly_lily_module_constant ("all-music-font-encodings");
bool is_music = (scm_memq (encoding, music_encodings) != SCM_BOOL_F);
}
MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Text_interface, interpret_markup, 3, 0,
- "Convert a text markup into a stencil."
-" Takes three arguments, @var{layout}, @var{props}, and @var{markup}.\n"
-"\n"
-"@var{layout} is a @code{\\layout} block; it may be obtained from a grob with"
-" @code{ly:grob-layout}. @var{props} is an alist chain, i.e. a list of"
-" alists. This is typically obtained with"
-" @code{(ly:grob-alist-chain grob (ly:output-def-lookup layout 'text-font-defaults))}."
-" @var{markup} is the markup text to be processed.");
+ "Convert a text markup into a stencil."
+ " Takes three arguments, @var{layout}, @var{props}, and @var{markup}.\n"
+ "\n"
+ "@var{layout} is a @code{\\layout} block; it may be obtained from a grob with"
+ " @code{ly:grob-layout}. @var{props} is an alist chain, i.e. a list of"
+ " alists. This is typically obtained with"
+ " @code{(ly:grob-alist-chain grob (ly:output-def-lookup layout 'text-font-defaults))}."
+ " @var{markup} is the markup text to be processed.");
SCM
Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup)
{
SCM func = scm_car (markup);
SCM args = scm_cdr (markup);
if (!is_markup (markup))
- programming_error ("markup head has no markup signature");
+ programming_error ("markup head has no markup signature");
return scm_apply_2 (func, layout_smob, props, args);
}
Text_interface::is_markup (SCM x)
{
return (scm_is_string (x)
- || (scm_is_pair (x)
- && SCM_BOOL_F
- != scm_object_property (scm_car (x),
- ly_symbol2scm ("markup-signature"))));
+ || (scm_is_pair (x)
+ && SCM_BOOL_F
+ != scm_object_property (scm_car (x),
+ ly_symbol2scm ("markup-signature"))));
}
bool
return scm_is_true (scm_call_1 (music_list_p, x));
}
-
ADD_INTERFACE (Text_interface,
- "A Scheme markup text, see @ruser{Formatting text} and"
- " @rextend{New markup command definition}.\n"
- "\n"
- "There are two important commands:"
- " @code{ly:text-interface::print}, which is a"
- " grob callback, and"
- " @code{ly:text-interface::interpret-markup}.",
-
- /* properties */
- "baseline-skip "
- "text "
- "word-space "
- "text-direction "
- );
+ "A Scheme markup text, see @ruser{Formatting text} and"
+ " @rextend{New markup command definition}.\n"
+ "\n"
+ "There are two important commands:"
+ " @code{ly:text-interface::print}, which is a"
+ " grob callback, and"
+ " @code{ly:text-interface::interpret-markup}.",
+
+ /* properties */
+ "baseline-skip "
+ "text "
+ "word-space "
+ "text-direction "
+ );
if (event_drul_[STOP])
{
if (!span_)
- event_drul_[STOP]->origin ()->warning (_ ("cannot find start of text spanner"));
+ event_drul_[STOP]->origin ()->warning (_ ("cannot find start of text spanner"));
else
- {
- finished_ = span_;
- announce_end_grob (finished_, SCM_EOL);
- span_ = 0;
- current_event_ = 0;
- }
+ {
+ finished_ = span_;
+ announce_end_grob (finished_, SCM_EOL);
+ span_ = 0;
+ current_event_ = 0;
+ }
}
if (event_drul_[START])
{
if (current_event_)
- event_drul_[START]->origin ()->warning (_ ("already have a text spanner"));
+ event_drul_[START]->origin ()->warning (_ ("already have a text spanner"));
else
- {
- current_event_ = event_drul_[START];
- span_ = make_spanner ("TextSpanner", event_drul_[START]->self_scm ());
+ {
+ current_event_ = event_drul_[START];
+ span_ = make_spanner ("TextSpanner", event_drul_[START]->self_scm ());
- Side_position_interface::set_axis (span_, Y_AXIS);
- event_drul_[START] = 0;
- }
+ Side_position_interface::set_axis (span_, Y_AXIS);
+ event_drul_[START] = 0;
+ }
}
}
if (finished_)
{
if (!finished_->get_bound (RIGHT))
- {
- Grob *e = unsmob_grob (get_property ("currentMusicalColumn"));
- finished_->set_bound (RIGHT, e);
- }
+ {
+ Grob *e = unsmob_grob (get_property ("currentMusicalColumn"));
+ finished_->set_bound (RIGHT, e);
+ }
finished_ = 0;
}
}
if (span_)
{
Pointer_group_interface::add_grob (span_,
- ly_symbol2scm ("note-columns"),
- info.grob ());
+ ly_symbol2scm ("note-columns"),
+ info.grob ());
if (!span_->get_bound (LEFT))
- add_bound_item (span_, info.grob ());
+ add_bound_item (span_, info.grob ());
}
else if (finished_)
{
Pointer_group_interface::add_grob (finished_,
- ly_symbol2scm ("note-columns"),
- info.grob ());
+ ly_symbol2scm ("note-columns"),
+ info.grob ());
if (!finished_->get_bound (RIGHT))
- add_bound_item (finished_, info.grob ());
+ add_bound_item (finished_, info.grob ());
}
}
ADD_ACKNOWLEDGER (Text_spanner_engraver, note_column);
ADD_TRANSLATOR (Text_spanner_engraver,
- /* doc */
- "Create text spanner from an event.",
+ /* doc */
+ "Create text spanner from an event.",
- /* create */
- "TextSpanner ",
+ /* create */
+ "TextSpanner ",
- /* read */
- "currentMusicalColumn ",
+ /* read */
+ "currentMusicalColumn ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Tie_column::add_tie (Grob *tc, Grob *tie)
{
Spanner *me = dynamic_cast<Spanner *> (tc);
-
+
if (tie->get_parent (Y_AXIS)
&& Tie_column::has_interface (tie->get_parent (Y_AXIS)))
return;
if (!me->get_bound (LEFT)
|| (Paper_column::get_rank (me->get_bound (LEFT)->get_column ())
- > Paper_column::get_rank (dynamic_cast<Spanner*> (tie)->get_bound (LEFT)->get_column ())))
+ > Paper_column::get_rank (dynamic_cast<Spanner *> (tie)->get_bound (LEFT)->get_column ())))
{
- me->set_bound (LEFT, Tie::head (tie, LEFT));
- me->set_bound (RIGHT, Tie::head (tie, RIGHT));
+ me->set_bound (LEFT, Tie::head (tie, LEFT));
+ me->set_bound (RIGHT, Tie::head (tie, RIGHT));
}
-
+
tie->set_parent (me, Y_AXIS);
Pointer_group_interface::add_grob (me, ly_symbol2scm ("ties"), tie);
}
Spanner *tie = dynamic_cast<Spanner *> (unsmob_grob (scm_car (s)));
Direction dir = LEFT;
do
- {
- if (dir * tie->get_bound (dir)->get_column ()->get_rank ()
- > dir * me->get_bound (dir)->get_column ()->get_rank ())
- me->set_bound (dir, Tie::head (tie, dir));
- }
+ {
+ if (dir * tie->get_bound (dir)->get_column ()->get_rank ()
+ > dir * me->get_bound (dir)->get_column ()->get_rank ())
+ me->set_bound (dir, Tie::head (tie, dir));
+ }
while (flip (&dir) != LEFT);
}
-
+
return SCM_UNSPECIFIED;
}
{
Grob *me = unsmob_grob (smob);
extract_grob_set (me, "ties", ro_ties);
- vector<Grob*> ties (ro_ties);
+ vector<Grob *> ties (ro_ties);
if (!ties.size ())
return SCM_BOOL_T;
for (vsize i = 0; i < base.size (); i++)
{
SCM cp = Tie::get_control_points (ties[i], problem.common_x_refpoint (),
- base[i],
- problem.details_);
+ base[i],
+ problem.details_);
ties[i]->set_property ("control-points", cp);
set_grob_direction (ties[i],
- base[i].dir_);
+ base[i].dir_);
problem.set_debug_scoring (base);
}
return SCM_BOOL_T;
}
-
-
ADD_INTERFACE (Tie_column,
- "Object that sets directions of multiple ties in a tied"
- " chord.",
+ "Object that sets directions of multiple ties in a tied"
+ " chord.",
- /* properties */
- "positioning-done "
- "tie-configuration "
- );
+ /* properties */
+ "positioning-done "
+ "tie-configuration "
+ );
int
Tie_configuration::compare (Tie_configuration const &a,
- Tie_configuration const &b)
+ Tie_configuration const &b)
{
if (a.position_ - b.position_)
return sign (a.position_ - b.position_);
return sign (a.dir_ - b.dir_);
}
-
Tie_configuration::Tie_configuration ()
{
column_ranks_ = Drul_array<int> (0, 0);
}
-
void
Tie_configuration::center_tie_vertically (Tie_details const &details)
{
Bezier b = get_untransformed_bezier (details);
Offset middle = b.curve_point (0.5);
Offset edge = b.curve_point (0.0);
- Real center = (edge[Y_AXIS] + middle[Y_AXIS])/2.0;
+ Real center = (edge[Y_AXIS] + middle[Y_AXIS]) / 2.0;
delta_y_ = - dir_ * center;
}
-
Bezier
Tie_configuration::get_transformed_bezier (Tie_details const &details) const
{
b.scale (1, dir_);
b.translate (Offset (attachment_x_[LEFT],
- delta_y_ + details.staff_space_ * 0.5 * position_));
+ delta_y_ + details.staff_space_ * 0.5 * position_));
return b;
}
l = 1.0;
}
return slur_shape (l,
- details.height_limit_,
- details.ratio_);
+ details.height_limit_,
+ details.ratio_);
}
int
Real
Tie_configuration::distance (Tie_configuration const &a,
- Tie_configuration const &b)
+ Tie_configuration const &b)
{
Real d = 3 * (a.position_ - b.position_);
return d + (2 + (a.dir_ - b.dir_));
}
-
void
Tie_configuration::add_score (Real s, string desc)
{
Real l = attachment_x_.length ();
return slur_shape (l,
- details.height_limit_,
- details.ratio_).curve_point (0.5)[Y_AXIS];
+ details.height_limit_,
+ details.ratio_).curve_point (0.5)[Y_AXIS];
}
Ties_configuration::Ties_configuration ()
if (s)
{
while (tie_score_cards_.size () < size ())
- tie_score_cards_.push_back ("");
+ tie_score_cards_.push_back ("");
tie_score_cards_[i] += to_string ("%s=%.2f ", desc.c_str (), s);
}
return score_;
}
-
string
Ties_configuration::complete_tie_card (vsize i) const
{
string s;
s += to_string ("%d (%.2f) %c: ", (*this)[i].position_, (*this)[i].delta_y_,
- ((*this)[i].dir_ == UP ? 'u' : 'd'))
- + (*this)[i].card () + (*this).tie_card (i);
-
+ ((*this)[i].dir_ == UP ? 'u' : 'd'))
+ + (*this)[i].card () + (*this).tie_card (i);
+
/*
this is a little awkward, but we must decide where to put
aggregrates.
if (i + 1 == size ())
s += to_string ("TOTAL=%.2f", score ());
-
+
return s;
}
string
Ties_configuration::complete_score_card () const
{
- string s;
+ string s;
for (vsize i = 0; i < size (); i++)
{
s += complete_tie_card (i);
return s;
}
-
-
string
Ties_configuration::card () const
{
#include "warn.hh"
#include "tie-details.hh"
-
/*
- this is a macro because we want ly_symbol2scm()
+ this is a macro because we want ly_symbol2scm()
*/
#define get_real_detail(src, defvalue) \
robust_scm2double(ly_assoc_get (ly_symbol2scm (src), details, SCM_EOL), defvalue)
{
staff_symbol_referencer_ = me;
staff_space_ = Staff_symbol_referencer::staff_space (me);
-
+
neutral_direction_ = to_dir (me->get_property ("neutral-direction"));
if (!neutral_direction_)
neutral_direction_ = DOWN;
-
+
SCM details = me->get_property ("details");
height_limit_ = get_real_detail ("height-limit", 0.75);
- ratio_ = get_real_detail ("ratio", .333);
+ ratio_ = get_real_detail ("ratio", .333);
between_length_limit_ = get_real_detail ("between-length-limit", 1.0);
-
+
wrong_direction_offset_penalty_ = get_real_detail ("wrong-direction-offset-penalty", 10);
-
+
min_length_ = get_real_detail ("min-length", 1.0);
min_length_penalty_factor_ = get_real_detail ("min-length-penalty-factor", 1.0);
-
// in half-space
center_staff_line_clearance_ = get_real_detail ("center-staff-line-clearance", 0.4);
tip_staff_line_clearance_ = get_real_detail ("tip-staff-line-clearance", 0.4);
intra_space_threshold_ = get_real_detail ("intra-space-threshold", 1.0);
outer_tie_length_symmetry_penalty_factor_ = get_real_detail ("outer-tie-length-symmetry-penalty-factor", 3.0);
outer_tie_vertical_distance_symmetry_penalty_factor_ = get_real_detail ("outer-tie-vertical-distance-symmetry-penalty-factor", 3.0);
-
+
outer_tie_vertical_gap_ = get_real_detail ("outer-tie-vertical-gap", 0.15);
single_tie_region_size_ = get_int_detail ("single-tie-region-size", 3);
Tie_details::Tie_details ()
{
- staff_space_ = 1.0;
+ staff_space_ = 1.0;
height_limit_ = 1.0;
- ratio_ = .333;
+ ratio_ = .333;
}
class Tie_engraver : public Engraver
{
Stream_event *event_;
- vector<Grob*> now_heads_;
+ vector<Grob *> now_heads_;
vector<Head_event_tuple> heads_to_tie_;
- vector<Grob*> ties_;
+ vector<Grob *> ties_;
Spanner *tie_column_;
// moment that created a tie, so this is not necessarily an unterminated
// tie. Happens e.g. for <c e g>~ g
if (!tie_start.tie_from_chord_created)
- tie_start.head_->warning (_("unterminated tie"));
+ tie_start.head_->warning (_ ("unterminated tie"));
}
/*
{
bool busy = event_;
for (vsize i = 0; !busy && i < heads_to_tie_.size (); i++)
- busy |= (heads_to_tie_[i].tie_event_
- || heads_to_tie_[i].tie_stream_event_);
+ busy |= (heads_to_tie_[i].tie_event_
+ || heads_to_tie_[i].tie_stream_event_);
if (busy)
context ()->set_property ("tieMelismaBusy", SCM_BOOL_T);
Stream_event *left_ev = unsmob_stream_event (th->get_property ("cause"));
/*
- maybe should check positions too.
+ maybe should check positions too.
*/
if (!right_ev || !left_ev)
- continue;
+ continue;
/*
Make a tie only if pitches are equal or if event end was not generated by
Completion_heads_engraver.
*/
if (ly_is_equal (right_ev->get_property ("pitch"), left_ev->get_property ("pitch"))
- && (!Tie_engraver::has_autosplit_end (left_ev)))
- {
- Grob *p = new Spanner (heads_to_tie_[i].tie_definition_);
- Moment end = heads_to_tie_[i].end_moment_;
-
- SCM cause = heads_to_tie_[i].tie_event_
- ? heads_to_tie_[i].tie_event_->self_scm ()
- : heads_to_tie_[i].tie_stream_event_->self_scm ();
-
- announce_grob (p, cause);
- Tie::set_head (p, LEFT, th);
- Tie::set_head (p, RIGHT, h);
-
-
- if (is_direction (unsmob_stream_event (cause)->get_property ("direction")))
- {
- Direction d = to_dir (unsmob_stream_event (cause)->get_property ("direction"));
- p->set_property ("direction", scm_from_int (d));
- }
-
- ties_.push_back (p);
- heads_to_tie_.erase (heads_to_tie_.begin () + i);
-
- /*
- Prevent all other tied notes ending at the same moment (assume
- implicitly the notes have also started at the same moment!)
- from triggering an "unterminated tie" warning. Needed e.g. for
- <c e g>~ g
- */
- for (vsize j = heads_to_tie_.size (); j--;)
- {
- if (heads_to_tie_[j].end_moment_ == end)
- heads_to_tie_[j].tie_from_chord_created = true;
- }
- }
+ && (!Tie_engraver::has_autosplit_end (left_ev)))
+ {
+ Grob *p = new Spanner (heads_to_tie_[i].tie_definition_);
+ Moment end = heads_to_tie_[i].end_moment_;
+
+ SCM cause = heads_to_tie_[i].tie_event_
+ ? heads_to_tie_[i].tie_event_->self_scm ()
+ : heads_to_tie_[i].tie_stream_event_->self_scm ();
+
+ announce_grob (p, cause);
+ Tie::set_head (p, LEFT, th);
+ Tie::set_head (p, RIGHT, h);
+
+ if (is_direction (unsmob_stream_event (cause)->get_property ("direction")))
+ {
+ Direction d = to_dir (unsmob_stream_event (cause)->get_property ("direction"));
+ p->set_property ("direction", scm_from_int (d));
+ }
+
+ ties_.push_back (p);
+ heads_to_tie_.erase (heads_to_tie_.begin () + i);
+
+ /*
+ Prevent all other tied notes ending at the same moment (assume
+ implicitly the notes have also started at the same moment!)
+ from triggering an "unterminated tie" warning. Needed e.g. for
+ <c e g>~ g
+ */
+ for (vsize j = heads_to_tie_.size (); j--;)
+ {
+ if (heads_to_tie_[j].end_moment_ == end)
+ heads_to_tie_[j].tie_from_chord_created = true;
+ }
+ }
}
if (ties_.size () && ! tie_column_)
if (heads_to_tie_.size () && !to_boolean (get_property ("tieWaitForNote")))
{
Moment now = now_mom ();
- for (vsize i = heads_to_tie_.size (); i--; )
- {
- if (now > heads_to_tie_[i].end_moment_)
- {
- report_unterminated_tie (heads_to_tie_[i]);
- heads_to_tie_.erase (heads_to_tie_.begin () + i);
- }
- }
+ for (vsize i = heads_to_tie_.size (); i--;)
+ {
+ if (now > heads_to_tie_[i].end_moment_)
+ {
+ report_unterminated_tie (heads_to_tie_[i]);
+ heads_to_tie_.erase (heads_to_tie_.begin () + i);
+ }
+ }
}
context ()->set_property ("tieMelismaBusy",
- ly_bool2scm (heads_to_tie_.size ()));
+ ly_bool2scm (heads_to_tie_.size ()));
}
void
{
if (!wait)
{
- vector<Head_event_tuple>::iterator it = heads_to_tie_.begin ();
- for (; it < heads_to_tie_.end (); it++)
- report_unterminated_tie (*it);
- heads_to_tie_.clear ();
+ vector<Head_event_tuple>::iterator it = heads_to_tie_.begin ();
+ for (; it < heads_to_tie_.end (); it++)
+ report_unterminated_tie (*it);
+ heads_to_tie_.clear ();
}
for (vsize i = 0; i < ties_.size (); i++)
- typeset_tie (ties_[i]);
+ typeset_tie (ties_[i]);
ties_.clear ();
tie_column_ = 0;
{
Grob *head = now_heads_[i];
Stream_event *left_ev
- = unsmob_stream_event (head->get_property ("cause"));
+ = unsmob_stream_event (head->get_property ("cause"));
if (!left_ev)
- {
- // may happen for ambitus
- continue;
- }
+ {
+ // may happen for ambitus
+ continue;
+ }
// We only want real notes to cause ties, not e.g. pitched trills
if (!left_ev->in_event_class ("note-event"))
- continue;
+ continue;
SCM left_articulations = left_ev->get_property ("articulations");
Stream_event *tie_event = 0;
Stream_event *tie_stream_event = event_;
for (SCM s = left_articulations;
- !tie_event && !tie_stream_event && scm_is_pair (s);
- s = scm_cdr (s))
- {
- Stream_event *ev = unsmob_stream_event (scm_car (s));
- if (!ev)
- continue;
+ !tie_event && !tie_stream_event && scm_is_pair (s);
+ s = scm_cdr (s))
+ {
+ Stream_event *ev = unsmob_stream_event (scm_car (s));
+ if (!ev)
+ continue;
- if (ev->in_event_class ("tie-event"))
- tie_event = ev;
- }
+ if (ev->in_event_class ("tie-event"))
+ tie_event = ev;
+ }
if (left_ev && (tie_event || tie_stream_event)
- && (!Tie_engraver::has_autosplit_end (left_ev)))
- {
- event_processed = true;
-
- Head_event_tuple event_tup;
-
- SCM start_definition
- = updated_grob_properties (context (), ly_symbol2scm ("Tie"));
-
- event_tup.head_ = head;
- event_tup.tie_definition_ = start_definition;
- event_tup.tie_event_ = tie_event;
- event_tup.tie_stream_event_ = tie_stream_event;
-
- Moment end = now_mom ();
- if (end.grace_part_)
- {
- end.grace_part_ += get_event_length (left_ev).main_part_;
- }
- else
- {
- end += get_event_length (left_ev);
- }
- event_tup.end_moment_ = end;
-
- new_heads_to_tie.push_back (event_tup);
- }
+ && (!Tie_engraver::has_autosplit_end (left_ev)))
+ {
+ event_processed = true;
+
+ Head_event_tuple event_tup;
+
+ SCM start_definition
+ = updated_grob_properties (context (), ly_symbol2scm ("Tie"));
+
+ event_tup.head_ = head;
+ event_tup.tie_definition_ = start_definition;
+ event_tup.tie_event_ = tie_event;
+ event_tup.tie_stream_event_ = tie_stream_event;
+
+ Moment end = now_mom ();
+ if (end.grace_part_)
+ {
+ end.grace_part_ += get_event_length (left_ev).main_part_;
+ }
+ else
+ {
+ end += get_event_length (left_ev);
+ }
+ event_tup.end_moment_ = end;
+
+ new_heads_to_tie.push_back (event_tup);
+ }
}
if (!wait && new_heads_to_tie.size ())
{
- vector<Head_event_tuple>::iterator it=heads_to_tie_.begin ();
+ vector<Head_event_tuple>::iterator it = heads_to_tie_.begin ();
for (; it < heads_to_tie_.end (); it++)
report_unterminated_tie (*it);
heads_to_tie_.clear ();
do
{
if (!Tie::head (her, d))
- new_head_drul[d] = Tie::head (her, (Direction) - d);
+ new_head_drul[d] = Tie::head (her, (Direction) - d);
}
while (flip (&d) != LEFT);
- Spanner *sp = dynamic_cast<Spanner*> (her);
+ Spanner *sp = dynamic_cast<Spanner *> (her);
sp->set_bound (LEFT, new_head_drul[LEFT]);
sp->set_bound (RIGHT, new_head_drul[RIGHT]);
}
ADD_ACKNOWLEDGER (Tie_engraver, note_head);
ADD_TRANSLATOR (Tie_engraver,
- /* doc */
- "Generate ties between note heads of equal pitch.",
+ /* doc */
+ "Generate ties between note heads of equal pitch.",
- /* create */
- "Tie "
- "TieColumn ",
+ /* create */
+ "Tie "
+ "TieColumn ",
- /* read */
- "tieWaitForNote ",
+ /* read */
+ "tieWaitForNote ",
- /* write */
- "tieMelismaBusy "
- );
+ /* write */
+ "tieMelismaBusy "
+ );
char const *man_pos = (specifications_[i].has_manual_position_) ? "(M)" : "";
char const *man_dir = (specifications_[i].has_manual_dir_) ? "(M)" : "";
char const *dir = (ties->at (i).dir_ == UP) ? "up" : "dn";
-
+
printf ("(P%d%s, %s%s) ", ties->at (i).position_, man_pos, dir, man_dir);
}
printf ("\n");
Interval
Tie_formatting_problem::get_attachment (Real y, Drul_array<int> columns) const
{
- Interval attachments (0,0);
+ Interval attachments (0, 0);
Direction d = LEFT;
do
{
Tuple2<int> key (columns[d], int (d));
Chord_outline_map::const_iterator i (chord_outlines_.find (key));
if (i == chord_outlines_.end ())
- programming_error ("Cannot find chord outline");
+ programming_error ("Cannot find chord outline");
else
- attachments[d] = i->second.height (y);
+ attachments[d] = i->second.height (y);
}
while (flip (&d) != LEFT);
-
+
return attachments;
}
}
void
-Tie_formatting_problem::set_column_chord_outline (vector<Item*> bounds,
- Direction dir,
- int column_rank)
+Tie_formatting_problem::set_column_chord_outline (vector<Item *> bounds,
+ Direction dir,
+ int column_rank)
{
Real staff_space = Staff_symbol_referencer::staff_space (bounds[0]);
{
Grob *head = bounds[i];
if (!Note_head::has_interface (head))
- continue;
-
+ continue;
+
if (!stem)
- stem = unsmob_grob (head->get_object ("stem"));
-
+ stem = unsmob_grob (head->get_object ("stem"));
+
Real p = Staff_symbol_referencer::get_position (head);
- Interval y ((p-1) * 0.5 * staff_space,
- (p+1) * 0.5 * staff_space);
+ Interval y ((p - 1) * 0.5 * staff_space,
+ (p + 1) * 0.5 * staff_space);
Interval x = head->extent (x_refpoint_, X_AXIS);
head_boxes.push_back (Box (x, y));
Grob *dots = Rhythmic_head::get_dots (head);
if (dir == LEFT && dots)
- {
- Interval x = dots->extent (x_refpoint_, X_AXIS);
- int p = int (Staff_symbol_referencer::get_position (dots));
-
- /*
- TODO: shouldn't this use column-rank dependent key?
- */
- dot_positions_.insert (p);
- dot_x_.unite (x);
-
- Interval y (dots->extent (dots, Y_AXIS));
- y.translate (p * staff_space * 0.5);
-
- boxes.push_back (Box (x, y));
- }
+ {
+ Interval x = dots->extent (x_refpoint_, X_AXIS);
+ int p = int (Staff_symbol_referencer::get_position (dots));
+
+ /*
+ TODO: shouldn't this use column-rank dependent key?
+ */
+ dot_positions_.insert (p);
+ dot_x_.unite (x);
+
+ Interval y (dots->extent (dots, Y_AXIS));
+ y.translate (p * staff_space * 0.5);
+
+ boxes.push_back (Box (x, y));
+ }
}
Tuple2<int> key (column_rank, int (dir));
if (stem)
{
if (Stem::is_normal_stem (stem))
- {
- Interval x;
- x.add_point (stem->relative_coordinate (x_refpoint_, X_AXIS));
- x.widen (staff_space / 20); // ugh.
- Interval y;
-
- Real stem_end_position = 0.0;
- if (Stem::is_cross_staff (stem))
- stem_end_position = get_grob_direction (stem) * infinity_f;
- else
- {
- if (use_horizontal_spacing_ || !Stem::get_beam (stem))
- stem_end_position = Stem::stem_end_position (stem) * staff_space * .5;
- else
- stem_end_position = Stem::note_head_positions (stem)[get_grob_direction (stem)]
- * staff_space * .5;
- }
-
- y.add_point (stem_end_position);
-
- Direction stemdir = get_grob_direction (stem);
- y.add_point (Stem::head_positions (stem)[-stemdir]
- * staff_space * .5);
-
- /*
- add extents of stem.
- */
- boxes.push_back (Box (x, y));
-
- stem_extents_[key].unite (Box (x, y));
-
- if (dir == LEFT)
- {
- Box flag_box = Stem::get_translated_flag (stem).extent_box ();
- flag_box.translate ( Offset (x[RIGHT], X_AXIS));
- boxes.push_back (flag_box);
- }
- }
+ {
+ Interval x;
+ x.add_point (stem->relative_coordinate (x_refpoint_, X_AXIS));
+ x.widen (staff_space / 20); // ugh.
+ Interval y;
+
+ Real stem_end_position = 0.0;
+ if (Stem::is_cross_staff (stem))
+ stem_end_position = get_grob_direction (stem) * infinity_f;
+ else
+ {
+ if (use_horizontal_spacing_ || !Stem::get_beam (stem))
+ stem_end_position = Stem::stem_end_position (stem) * staff_space * .5;
+ else
+ stem_end_position = Stem::note_head_positions (stem)[get_grob_direction (stem)]
+ * staff_space * .5;
+ }
+
+ y.add_point (stem_end_position);
+
+ Direction stemdir = get_grob_direction (stem);
+ y.add_point (Stem::head_positions (stem)[-stemdir]
+ * staff_space * .5);
+
+ /*
+ add extents of stem.
+ */
+ boxes.push_back (Box (x, y));
+
+ stem_extents_[key].unite (Box (x, y));
+
+ if (dir == LEFT)
+ {
+ Box flag_box = Stem::get_translated_flag (stem).extent_box ();
+ flag_box.translate ( Offset (x[RIGHT], X_AXIS));
+ boxes.push_back (flag_box);
+ }
+ }
else
- {
- Grob *head = Stem::support_head (stem);
-
- /*
- In case of invisible stem, don't pass x-center of heads.
- */
- Real x_center = head->extent (x_refpoint_, X_AXIS).center ();
- Interval x_ext;
- x_ext[-dir] = x_center;
- x_ext[dir] = infinity_f * dir;
- Interval y_ext;
- for (vsize j = 0; j < head_boxes.size (); j++)
- y_ext.unite (head_boxes[j][Y_AXIS]);
-
- boxes.push_back (Box (x_ext, y_ext));
- }
+ {
+ Grob *head = Stem::support_head (stem);
+
+ /*
+ In case of invisible stem, don't pass x-center of heads.
+ */
+ Real x_center = head->extent (x_refpoint_, X_AXIS).center ();
+ Interval x_ext;
+ x_ext[-dir] = x_center;
+ x_ext[dir] = infinity_f * dir;
+ Interval y_ext;
+ for (vsize j = 0; j < head_boxes.size (); j++)
+ y_ext.unite (head_boxes[j][Y_AXIS]);
+
+ boxes.push_back (Box (x_ext, y_ext));
+ }
extract_grob_set (stem, "note-heads", heads);
- for (vsize i = 0; i < heads.size (); i ++)
- {
- if (find (bounds.begin (), bounds.end (), dynamic_cast<Item*> (heads[i])) == bounds.end ())
- {
- /*
- other untied notes in the same chord.
- */
-
- Interval y = Staff_symbol_referencer::extent_in_staff (heads[i]);
- Interval x = heads[i]->extent (x_refpoint_, X_AXIS);
- boxes.push_back (Box (x, y));
- }
-
- Grob *acc = unsmob_grob (heads[i]->get_object ("accidental-grob"));
- if (acc)
- acc->get_property ("stencil"); /* trigger tie-related suicide */
-
- if (acc && acc->is_live () && dir == RIGHT)
- {
- boxes.push_back (Box (acc->extent (x_refpoint_, X_AXIS),
- Staff_symbol_referencer::extent_in_staff (acc)));
- }
-
- head_positions_[column_rank].add_point (int (Staff_symbol_referencer::get_position (heads[i])));
- }
-
+ for (vsize i = 0; i < heads.size (); i++)
+ {
+ if (find (bounds.begin (), bounds.end (), dynamic_cast<Item *> (heads[i])) == bounds.end ())
+ {
+ /*
+ other untied notes in the same chord.
+ */
+
+ Interval y = Staff_symbol_referencer::extent_in_staff (heads[i]);
+ Interval x = heads[i]->extent (x_refpoint_, X_AXIS);
+ boxes.push_back (Box (x, y));
+ }
+
+ Grob *acc = unsmob_grob (heads[i]->get_object ("accidental-grob"));
+ if (acc)
+ acc->get_property ("stencil"); /* trigger tie-related suicide */
+
+ if (acc && acc->is_live () && dir == RIGHT)
+ {
+ boxes.push_back (Box (acc->extent (x_refpoint_, X_AXIS),
+ Staff_symbol_referencer::extent_in_staff (acc)));
+ }
+
+ head_positions_[column_rank].add_point (int (Staff_symbol_referencer::get_position (heads[i])));
+ }
+
}
-
+
Direction updowndir = DOWN;
do
{
Interval x;
Interval y;
if (head_boxes.size ())
- {
- Box b = boundary (head_boxes, updowndir, 0);
- x = b[X_AXIS];
- x[-dir] = b[X_AXIS].linear_combination (-dir / 2);
- y[-updowndir] = b[Y_AXIS][updowndir];
- y[updowndir] = updowndir * infinity_f;
- }
+ {
+ Box b = boundary (head_boxes, updowndir, 0);
+ x = b[X_AXIS];
+ x[-dir] = b[X_AXIS].linear_combination (-dir / 2);
+ y[-updowndir] = b[Y_AXIS][updowndir];
+ y[updowndir] = updowndir * infinity_f;
+ }
if (!x.is_empty ())
- boxes.push_back (Box (x, y));
+ boxes.push_back (Box (x, y));
}
while (flip (&updowndir) != DOWN);
{
Interval iv (Axis_group_interface::staff_extent (bounds[0], x_refpoint_, X_AXIS, y_refpoint_, Y_AXIS));
if (iv.is_empty ())
- iv.add_point (bounds[0]->relative_coordinate (x_refpoint_, X_AXIS));
+ iv.add_point (bounds[0]->relative_coordinate (x_refpoint_, X_AXIS));
chord_outlines_[key].set_minimum_height (iv[-dir]);
}
{
Interval x;
for (vsize j = 0; j < head_boxes.size (); j++)
- {
- x.unite (head_boxes[j][X_AXIS]);
- }
-
+ {
+ x.unite (head_boxes[j][X_AXIS]);
+ }
+
chord_outlines_[key].set_minimum_height (x[dir]);
}
}
void
-Tie_formatting_problem::set_chord_outline (vector<Item*> bounds,
- Direction dir)
+Tie_formatting_problem::set_chord_outline (vector<Item *> bounds,
+ Direction dir)
{
vector<int> ranks;
for (vsize i = 0; i < ranks.size (); i++)
{
- vector<Item*> col_items;
- for (vsize j = 0; j < bounds.size (); j ++)
- {
- if (bounds[j]->get_column ()->get_rank () == ranks[i])
- col_items.push_back (bounds[j]);
- }
+ vector<Item *> col_items;
+ for (vsize j = 0; j < bounds.size (); j++)
+ {
+ if (bounds[j]->get_column ()->get_rank () == ranks[i])
+ col_items.push_back (bounds[j]);
+ }
set_column_chord_outline (col_items, dir, ranks[i]);
}
}
-
-
void
Tie_formatting_problem::from_tie (Grob *tie)
{
- vector<Grob*> ties;
+ vector<Grob *> ties;
ties.push_back (tie);
from_ties (ties);
}
void
-Tie_formatting_problem::from_ties (vector<Grob*> const &ties)
+Tie_formatting_problem::from_ties (vector<Grob *> const &ties)
{
if (ties.empty ())
return;
-
+
x_refpoint_ = ties[0];
y_refpoint_ = ties[0];
for (vsize i = 0; i < ties.size (); i++)
{
- Spanner *tie = dynamic_cast<Spanner*> (ties[i]);
+ Spanner *tie = dynamic_cast<Spanner *> (ties[i]);
Item *l = tie->get_bound (LEFT);
Item *r = tie->get_bound (RIGHT);
- x_refpoint_ = l->common_refpoint (x_refpoint_, X_AXIS);
+ x_refpoint_ = l->common_refpoint (x_refpoint_, X_AXIS);
x_refpoint_ = r->common_refpoint (x_refpoint_, X_AXIS);
if (!l->break_status_dir ())
- y_refpoint_ = l->common_refpoint (y_refpoint_, Y_AXIS);
+ y_refpoint_ = l->common_refpoint (y_refpoint_, Y_AXIS);
if (!r->break_status_dir ())
- y_refpoint_ = r->common_refpoint (y_refpoint_, Y_AXIS);
+ y_refpoint_ = r->common_refpoint (y_refpoint_, Y_AXIS);
}
details_.from_grob (ties[0]);
-
+
Direction d = LEFT;
do
{
- vector<Item*> bounds;
-
+ vector<Item *> bounds;
+
for (vsize i = 0; i < ties.size (); i++)
- {
- Item *it = dynamic_cast<Spanner*> (ties[i])->get_bound (d);
- if (it->break_status_dir ())
- it = it->get_column ();
-
- bounds.push_back (it);
- }
-
+ {
+ Item *it = dynamic_cast<Spanner *> (ties[i])->get_bound (d);
+ if (it->break_status_dir ())
+ it = it->get_column ();
+
+ bounds.push_back (it);
+ }
+
set_chord_outline (bounds, d);
}
while (flip (&d) != LEFT);
-
for (vsize i = 0; i < ties.size (); i++)
{
Tie_specification spec;
spec.from_grob (ties[i]);
-
+
do
- {
- spec.note_head_drul_[d] = Tie::head (ties[i], d);
- spec.column_ranks_[d] = Tie::get_column_rank (ties[i], d);
- }
+ {
+ spec.note_head_drul_[d] = Tie::head (ties[i], d);
+ spec.column_ranks_[d] = Tie::get_column_rank (ties[i], d);
+ }
while (flip (&d) != LEFT);
specifications_.push_back (spec);
}
}
void
-Tie_formatting_problem::from_semi_ties (vector<Grob*> const &semi_ties, Direction head_dir)
+Tie_formatting_problem::from_semi_ties (vector<Grob *> const &semi_ties, Direction head_dir)
{
if (semi_ties.empty ())
return;
- use_horizontal_spacing_ = false;
+ use_horizontal_spacing_ = false;
details_.from_grob (semi_ties[0]);
- vector<Item*> heads;
+ vector<Item *> heads;
int column_rank = -1;
for (vsize i = 0; i < semi_ties.size (); i++)
{
Tie_specification spec;
Item *head = unsmob_item (semi_ties[i]->get_object ("note-head"));
-
+
if (!head)
- programming_error ("LV tie without head?!");
+ programming_error ("LV tie without head?!");
if (head)
- {
- spec.position_ = int (Staff_symbol_referencer::get_position (head));
- }
+ {
+ spec.position_ = int (Staff_symbol_referencer::get_position (head));
+ }
spec.from_grob (semi_ties[i]);
-
+
spec.note_head_drul_[head_dir] = head;
column_rank = Tie::get_column_rank (semi_ties[i], head_dir);
spec.column_ranks_ = Drul_array<int> (column_rank, column_rank);
for (vsize i = 0; i < semi_ties.size (); i++)
{
- x_refpoint_ = semi_ties[i]->common_refpoint (x_refpoint_, X_AXIS);
- y_refpoint_ = semi_ties[i]->common_refpoint (y_refpoint_, Y_AXIS);
+ x_refpoint_ = semi_ties[i]->common_refpoint (x_refpoint_, X_AXIS);
+ y_refpoint_ = semi_ties[i]->common_refpoint (y_refpoint_, Y_AXIS);
}
for (vsize i = 0; i < heads.size (); i++)
{
- x_refpoint_ = heads[i]->common_refpoint (x_refpoint_, X_AXIS);
- y_refpoint_ = heads[i]->common_refpoint (y_refpoint_, Y_AXIS) ;
+ x_refpoint_ = heads[i]->common_refpoint (x_refpoint_, X_AXIS);
+ y_refpoint_ = heads[i]->common_refpoint (y_refpoint_, Y_AXIS);
}
set_chord_outline (heads, head_dir);
chord_outlines_[open_key].set_minimum_height (extremal - head_dir * 1.5);
}
-
Tie_specification
Tie_formatting_problem::get_tie_specification (int i) const
{
return specifications_[i];
}
-
/*
- Return configuration, create it if necessary.
+ Return configuration, create it if necessary.
*/
-Tie_configuration*
+Tie_configuration *
Tie_formatting_problem::get_configuration (int pos, Direction dir, Drul_array<int> columns,
- bool tune_dy) const
+ bool tune_dy) const
{
- int key_components[] = {
+ int key_components[] =
+ {
pos, dir, columns[LEFT], columns[RIGHT]
};
- Tuple<int,4> key (key_components);
-
+ Tuple<int, 4> key (key_components);
+
Tie_configuration_map::const_iterator f = possibilities_.find (key);
if (f != possibilities_.end ())
{
return (*f).second;
}
-
Tie_configuration *conf = generate_configuration (pos, dir, columns, tune_dy);
- ((Tie_formatting_problem*) this)->possibilities_[key] = conf;
+ ((Tie_formatting_problem *) this)->possibilities_[key] = conf;
return conf;
}
-Tie_configuration*
+Tie_configuration *
Tie_formatting_problem::generate_configuration (int pos, Direction dir,
- Drul_array<int> columns, bool y_tune) const
+ Drul_array<int> columns, bool y_tune) const
{
Tie_configuration *conf = new Tie_configuration;
conf->position_ = pos;
conf->dir_ = dir;
-
+
conf->column_ranks_ = columns;
-
+
Real y = conf->position_ * 0.5 * details_.staff_space_;
if (dot_positions_.find (pos) != dot_positions_.end ())
conf->delta_y_ += dir * 0.25 * details_.staff_space_;
y_tune = false;
}
-
+
if (y_tune
&& max (fabs (get_head_extent (columns[LEFT], LEFT, Y_AXIS)[dir] - y),
- fabs (get_head_extent (columns[RIGHT], RIGHT, Y_AXIS)[dir] - y)) < 0.25
+ fabs (get_head_extent (columns[RIGHT], RIGHT, Y_AXIS)[dir] - y)) < 0.25
&& !Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos))
{
- conf->delta_y_ =
- (get_head_extent (columns[LEFT], LEFT, Y_AXIS)[dir] - y)
- + dir * details_.outer_tie_vertical_gap_;
+ conf->delta_y_
+ = (get_head_extent (columns[LEFT], LEFT, Y_AXIS)[dir] - y)
+ + dir * details_.outer_tie_vertical_gap_;
}
if (y_tune)
{
conf->attachment_x_ = get_attachment (y + conf->delta_y_, conf->column_ranks_);
- Real h = conf->height (details_);
-
+ Real h = conf->height (details_);
+
/*
- TODO:
+ TODO:
- - should make sliding criterion, should flatten ties if
+ - should make sliding criterion, should flatten ties if
+
+ - they're just the wrong (ie. touching line at top & bottom)
+ size.
- - they're just the wrong (ie. touching line at top & bottom)
- size.
-
*/
if (head_positions_slice (columns[LEFT]).contains (pos)
- || head_positions_slice (columns[RIGHT]).contains (pos)
- || abs (pos) < 2 * Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_))
- {
- if (h < details_.intra_space_threshold_ * 0.5 * details_.staff_space_)
- {
- if (!Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos)
- && abs (pos) < 2 * Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_))
- {
- conf->center_tie_vertically (details_);
- }
- else if (Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos))
- {
- conf->delta_y_ += dir *
- details_.tip_staff_line_clearance_ * 0.5 * details_.staff_space_;
- }
- }
- else
- {
- Real top_y = y + conf->delta_y_ + conf->dir_ * h;
- Real top_pos = top_y / (0.5*details_.staff_space_);
- int round_pos = int (my_round (top_pos));
-
- /* TODO: should use other variable? */
- Real clearance = details_.center_staff_line_clearance_;
- if (fabs (top_pos - round_pos) < clearance
- && Staff_symbol_referencer::on_staff_line (details_.staff_symbol_referencer_,
- round_pos))
- {
- Real new_y = (round_pos + clearance * conf->dir_) * 0.5 * details_.staff_space_;
- conf->delta_y_ = (new_y - top_y);
- }
- }
- }
- }
+ || head_positions_slice (columns[RIGHT]).contains (pos)
+ || abs (pos) < 2 * Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_))
+ {
+ if (h < details_.intra_space_threshold_ * 0.5 * details_.staff_space_)
+ {
+ if (!Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos)
+ && abs (pos) < 2 * Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_))
+ {
+ conf->center_tie_vertically (details_);
+ }
+ else if (Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos))
+ {
+ conf->delta_y_ += dir *
+ details_.tip_staff_line_clearance_ * 0.5 * details_.staff_space_;
+ }
+ }
+ else
+ {
+ Real top_y = y + conf->delta_y_ + conf->dir_ * h;
+ Real top_pos = top_y / (0.5 * details_.staff_space_);
+ int round_pos = int (my_round (top_pos));
+
+ /* TODO: should use other variable? */
+ Real clearance = details_.center_staff_line_clearance_;
+ if (fabs (top_pos - round_pos) < clearance
+ && Staff_symbol_referencer::on_staff_line (details_.staff_symbol_referencer_,
+ round_pos))
+ {
+ Real new_y = (round_pos + clearance * conf->dir_) * 0.5 * details_.staff_space_;
+ conf->delta_y_ = (new_y - top_y);
+ }
+ }
+ }
+ }
conf->attachment_x_ = get_attachment (y + conf->delta_y_, conf->column_ranks_);
if (conf->height (details_) < details_.intra_space_threshold_ * 0.5 * details_.staff_space_)
{
/*
- This is less sensible for long ties, since those are more
- horizontal.
+ This is less sensible for long ties, since those are more
+ horizontal.
*/
Interval close_by = get_attachment (y
- + conf->delta_y_
- + (dir * details_.intra_space_threshold_ * 0.25
- * details_.staff_space_),
- conf->column_ranks_);
-
+ + conf->delta_y_
+ + (dir * details_.intra_space_threshold_ * 0.25
+ * details_.staff_space_),
+ conf->column_ranks_);
+
conf->attachment_x_.intersect (close_by);
}
if (conf->column_span_length ())
{
/*
- avoid the stems that we attach to as well. We don't do this
- for semities (span length = 0)
+ avoid the stems that we attach to as well. We don't do this
+ for semities (span length = 0)
- It would be better to check D against HEAD-DIRECTION if
- applicable.
+ It would be better to check D against HEAD-DIRECTION if
+ applicable.
*/
Direction d = LEFT;
do
- {
- Real y = conf->position_ * details_.staff_space_ * 0.5 + conf->delta_y_;
- if (get_stem_extent (conf->column_ranks_[d], d, X_AXIS).is_empty ()
- || !get_stem_extent (conf->column_ranks_[d], d, Y_AXIS).contains (y))
- continue;
-
- conf->attachment_x_[d] =
- d * min (d * conf->attachment_x_[d],
- d * (get_stem_extent (conf->column_ranks_[d], d, X_AXIS)[-d] - d * details_.stem_gap_));
- }
+ {
+ Real y = conf->position_ * details_.staff_space_ * 0.5 + conf->delta_y_;
+ if (get_stem_extent (conf->column_ranks_[d], d, X_AXIS).is_empty ()
+ || !get_stem_extent (conf->column_ranks_[d], d, Y_AXIS).contains (y))
+ continue;
+
+ conf->attachment_x_[d]
+ = d * min (d * conf->attachment_x_[d],
+ d * (get_stem_extent (conf->column_ranks_[d], d, X_AXIS)[-d] - d * details_.stem_gap_));
+ }
while (flip (&d) != LEFT);
- }
+ }
return conf;
}
*/
Real
Tie_formatting_problem::score_aptitude (Tie_configuration *conf,
- Tie_specification const &spec,
- Ties_configuration *ties_conf, int tie_idx) const
+ Tie_specification const &spec,
+ Ties_configuration *ties_conf, int tie_idx) const
{
Real penalty = 0.0;
Real curve_y = conf->position_ * details_.staff_space_ * 0.5 + conf->delta_y_;
Real tie_y = spec.position_ * details_.staff_space_ * 0.5;
if (sign (curve_y - tie_y) != conf->dir_)
{
- Real p = details_.wrong_direction_offset_penalty_;
+ Real p = details_.wrong_direction_offset_penalty_;
if (ties_conf)
- ties_conf->add_tie_score (p, tie_idx, "wrong dir");
+ ties_conf->add_tie_score (p, tie_idx, "wrong dir");
else
- penalty += p;
+ penalty += p;
}
{
if (ties_conf)
ties_conf->add_tie_score (p, tie_idx, "vdist");
else
- penalty += p;
+ penalty += p;
}
-
+
Direction d = LEFT;
do
{
if (!spec.note_head_drul_[d])
- continue;
-
+ continue;
+
Interval head_x = spec.note_head_drul_[d]->extent (x_refpoint_, X_AXIS);
Real dist = head_x.distance (conf->attachment_x_[d]);
-
/*
- TODO: flatten with log or sqrt.
+ TODO: flatten with log or sqrt.
*/
Real p = details_.horizontal_distance_penalty_factor_
- * convex_amplifier (1.25, 1.0, dist);
+ * convex_amplifier (1.25, 1.0, dist);
if (ties_conf)
- ties_conf->add_tie_score (p, tie_idx,
- (d == LEFT) ? "lhdist" : "rhdist");
+ ties_conf->add_tie_score (p, tie_idx,
+ (d == LEFT) ? "lhdist" : "rhdist");
else
- penalty += p;
+ penalty += p;
}
while (flip (&d) != LEFT);
&& ties_conf->size () == 1)
{
Direction d = LEFT;
- Drul_array<Grob*> stems (0, 0);
+ Drul_array<Grob *> stems (0, 0);
do
- {
- if (!spec.note_head_drul_[d])
- continue;
-
- Grob *stem = unsmob_grob (spec.note_head_drul_[d]->get_object ("stem"));
- if (stem
- && Stem::is_normal_stem (stem))
- stems[d] = stem;
- }
+ {
+ if (!spec.note_head_drul_[d])
+ continue;
+
+ Grob *stem = unsmob_grob (spec.note_head_drul_[d]->get_object ("stem"));
+ if (stem
+ && Stem::is_normal_stem (stem))
+ stems[d] = stem;
+ }
while (flip (&d) != LEFT);
bool tie_stem_dir_ok = true;
bool tie_position_dir_ok = true;
if (stems[LEFT] && !stems[RIGHT])
- tie_stem_dir_ok = conf->dir_ != get_grob_direction (stems[LEFT]);
+ tie_stem_dir_ok = conf->dir_ != get_grob_direction (stems[LEFT]);
else if (!stems[LEFT] && stems[RIGHT])
- tie_stem_dir_ok = conf->dir_ != get_grob_direction (stems[RIGHT]);
+ tie_stem_dir_ok = conf->dir_ != get_grob_direction (stems[RIGHT]);
else if (stems[LEFT] && stems[RIGHT]
- && get_grob_direction (stems[LEFT]) == get_grob_direction (stems[RIGHT]))
- tie_stem_dir_ok = conf->dir_ != get_grob_direction (stems[LEFT]);
+ && get_grob_direction (stems[LEFT]) == get_grob_direction (stems[RIGHT]))
+ tie_stem_dir_ok = conf->dir_ != get_grob_direction (stems[LEFT]);
else if (spec.position_)
- tie_position_dir_ok = conf->dir_ == sign (spec.position_);
+ tie_position_dir_ok = conf->dir_ == sign (spec.position_);
if (!tie_stem_dir_ok)
- ties_conf->add_score (details_.same_dir_as_stem_penalty_, "tie/stem dir");
+ ties_conf->add_score (details_.same_dir_as_stem_penalty_, "tie/stem dir");
if (!tie_position_dir_ok)
- ties_conf->add_score (details_.same_dir_as_stem_penalty_, "tie/pos dir");
+ ties_conf->add_score (details_.same_dir_as_stem_penalty_, "tie/pos dir");
}
-
+
return penalty;
}
-
Slice
Tie_formatting_problem::head_positions_slice (int rank) const
{
Position_extent_map::const_iterator i (head_positions_.find (rank));
if (i != head_positions_.end ())
{
- return (*i).second;
+ return (*i).second;
}
Slice empty;
return empty;
{
if (conf->scored_)
{
- return ;
+ return;
}
-
+
Real length = conf->attachment_x_.length ();
Real length_penalty
= peak_around (0.33 * details_.min_length_, details_.min_length_, length);
conf->add_score (details_.min_length_penalty_factor_
- * length_penalty, "minlength");
-
+ * length_penalty, "minlength");
+
Real tip_pos = conf->position_ + conf->delta_y_ / 0.5 * details_.staff_space_;
Real tip_y = tip_pos * details_.staff_space_ * 0.5;
- Real height = conf->height (details_);
+ Real height = conf->height (details_);
Real top_y = tip_y + conf->dir_ * height;
Real top_pos = 2 * top_y / details_.staff_space_;
Real round_top_pos = rint (top_pos);
if (Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_,
- int (round_top_pos))
+ int (round_top_pos))
&& Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_) > top_y)
{
- conf->add_score (
- details_.staff_line_collision_penalty_
- * peak_around (0.1 * details_.center_staff_line_clearance_,
- details_.center_staff_line_clearance_,
- fabs (top_pos - round_top_pos)),
- "line center");
+ conf->add_score (details_.staff_line_collision_penalty_
+ * peak_around (0.1 * details_.center_staff_line_clearance_,
+ details_.center_staff_line_clearance_,
+ fabs (top_pos - round_top_pos)),
+ "line center");
}
int rounded_tip_pos = int (rint (tip_pos));
if (Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, rounded_tip_pos)
&& (head_positions_slice (conf->column_ranks_[LEFT]).contains (rounded_tip_pos)
- || head_positions_slice (conf->column_ranks_[RIGHT]).contains (rounded_tip_pos)
- || abs (rounded_tip_pos) < 2 * Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_))
- )
+ || head_positions_slice (conf->column_ranks_[RIGHT]).contains (rounded_tip_pos)
+ || abs (rounded_tip_pos) < 2 * Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_))
+ )
{
conf->add_score (details_.staff_line_collision_penalty_
- * peak_around (0.1 * details_.tip_staff_line_clearance_,
- details_.tip_staff_line_clearance_,
- fabs (tip_pos - rint (tip_pos))),
- "tipline");
+ * peak_around (0.1 * details_.tip_staff_line_clearance_,
+ details_.tip_staff_line_clearance_,
+ fabs (tip_pos - rint (tip_pos))),
+ "tipline");
}
if (!dot_x_.is_empty ())
{
/* use left edge? */
Real x = dot_x_.center ();
-
+
Bezier b = conf->get_transformed_bezier (details_);
if (b.control_point_extent (X_AXIS).contains (x))
- {
- Real y = b.get_other_coordinate (X_AXIS, x);
-
- for (set<int>::const_iterator i (dot_positions_.begin ());
- i != dot_positions_.end (); i ++)
- {
- int dot_pos = (*i);
- conf->add_score (details_.dot_collision_penalty_
- * peak_around (.1 * details_.dot_collision_clearance_,
- details_.dot_collision_clearance_,
- fabs (dot_pos * details_.staff_space_ * 0.5 - y)),
- "dot collision");
- }
- }
+ {
+ Real y = b.get_other_coordinate (X_AXIS, x);
+
+ for (set<int>::const_iterator i (dot_positions_.begin ());
+ i != dot_positions_.end (); i++)
+ {
+ int dot_pos = (*i);
+ conf->add_score (details_.dot_collision_penalty_
+ * peak_around (.1 * details_.dot_collision_clearance_,
+ details_.dot_collision_clearance_,
+ fabs (dot_pos * details_.staff_space_ * 0.5 - y)),
+ "dot collision");
+ }
+ }
}
conf->scored_ = true;
void
Tie_formatting_problem::score_ties_aptitude (Ties_configuration *ties) const
{
- if (ties->size () != specifications_.size ())
+ if (ties->size () != specifications_.size ())
{
programming_error ("Huh? Mismatch between sizes.");
return;
for (vsize i = 0; i < ties->size (); i++)
score_aptitude (&ties->at (i), specifications_[i],
- ties, i);
+ ties, i);
}
void
{
if (ties->scored_)
return;
-
+
score_ties_configuration (ties);
score_ties_aptitude (ties);
ties->scored_ = true;
score_configuration (&ties->at (i));
ties->add_tie_score (ties->at (i).score (), i, "conf");
}
-
+
Real last_edge = 0.0;
Real last_center = 0.0;
for (vsize i = 0; i < ties->size (); i++)
{
Bezier b (ties->at (i).get_transformed_bezier (details_));
-
+
Real center = b.curve_point (0.5)[Y_AXIS];
Real edge = b.curve_point (0.0)[Y_AXIS];
-
+
if (i)
- {
- if (edge <= last_edge)
- ties->add_score (details_.tie_column_monotonicity_penalty_, "monoton edge");
- if (center <= last_center)
- ties->add_score (details_.tie_column_monotonicity_penalty_, "monoton cent");
-
- ties->add_score (details_.tie_tie_collision_penalty_ *
- peak_around (0.1 * details_.tie_tie_collision_distance_,
- details_.tie_tie_collision_distance_,
- fabs (center - last_center)),
- "tietie center");
- ties->add_score (details_.tie_tie_collision_penalty_ *
- peak_around (0.1 * details_.tie_tie_collision_distance_,
- details_.tie_tie_collision_distance_,
- fabs (edge - last_edge)), "tietie edge");
- }
+ {
+ if (edge <= last_edge)
+ ties->add_score (details_.tie_column_monotonicity_penalty_, "monoton edge");
+ if (center <= last_center)
+ ties->add_score (details_.tie_column_monotonicity_penalty_, "monoton cent");
+
+ ties->add_score (details_.tie_tie_collision_penalty_ *
+ peak_around (0.1 * details_.tie_tie_collision_distance_,
+ details_.tie_tie_collision_distance_,
+ fabs (center - last_center)),
+ "tietie center");
+ ties->add_score (details_.tie_tie_collision_penalty_ *
+ peak_around (0.1 * details_.tie_tie_collision_distance_,
+ details_.tie_tie_collision_distance_,
+ fabs (edge - last_edge)), "tietie edge");
+ }
last_edge = edge;
last_center = center;
if (ties->size () > 1)
{
ties->add_score (details_.outer_tie_length_symmetry_penalty_factor_
- * fabs (ties->at (0).attachment_x_.length () - ties->back ().attachment_x_.length ()),
- "length symm");
-
+ * fabs (ties->at (0).attachment_x_.length () - ties->back ().attachment_x_.length ()),
+ "length symm");
+
ties->add_score (details_.outer_tie_vertical_distance_symmetry_penalty_factor_
- * fabs (fabs (specifications_[0].position_ * 0.5 * details_.staff_space_
- - (ties->at (0).position_ * 0.5 * details_.staff_space_
- + ties->at (0).delta_y_))
- -
- fabs (specifications_.back ().position_ * 0.5 * details_.staff_space_
- - (ties->back ().position_ * 0.5 * details_.staff_space_
- + ties->back ().delta_y_))),
- "pos symmetry");
+ * fabs (fabs (specifications_[0].position_ * 0.5 * details_.staff_space_
+ - (ties->at (0).position_ * 0.5 * details_.staff_space_
+ + ties->at (0).delta_y_))
+ -
+ fabs (specifications_.back ().position_ * 0.5 * details_.staff_space_
+ - (ties->back ().position_ * 0.5 * details_.staff_space_
+ + ties->back ().delta_y_))),
+ "pos symmetry");
}
}
Ties_configuration copy;
for (vsize i = 0; i < ties_config.size (); i++)
{
- Tie_configuration * ptr = get_configuration (ties_config[i].position_, ties_config[i].dir_,
- ties_config[i].column_ranks_,
- !specifications_[i].has_manual_delta_y_);
+ Tie_configuration *ptr = get_configuration (ties_config[i].position_, ties_config[i].dir_,
+ ties_config[i].column_ranks_,
+ !specifications_[i].has_manual_delta_y_);
if (specifications_[i].has_manual_delta_y_)
- {
- ptr->delta_y_
- = (specifications_[i].manual_position_ - ties_config[i].position_)
- * 0.5 * details_.staff_space_;
- }
+ {
+ ptr->delta_y_
+ = (specifications_[i].manual_position_ - ties_config[i].position_)
+ * 0.5 * details_.staff_space_;
+ }
copy.push_back (*ptr);
}
-
+
return copy;
}
Ties_configuration
-Tie_formatting_problem::generate_base_chord_configuration ()
+Tie_formatting_problem::generate_base_chord_configuration ()
{
Ties_configuration ties_config;
- for (vsize i = 0; i < specifications_.size (); i ++)
+ for (vsize i = 0; i < specifications_.size (); i++)
{
Tie_configuration conf;
if (specifications_[i].has_manual_dir_)
- conf.dir_ = specifications_[i].manual_dir_;
+ conf.dir_ = specifications_[i].manual_dir_;
if (specifications_[i].has_manual_position_)
- {
- conf.position_ = (int) my_round (specifications_[i].manual_position_);
- if (specifications_[i].has_manual_delta_y_)
- conf.delta_y_ = (specifications_[i].manual_position_ - conf.position_)
- * 0.5 * details_.staff_space_;
- }
+ {
+ conf.position_ = (int) my_round (specifications_[i].manual_position_);
+ if (specifications_[i].has_manual_delta_y_)
+ conf.delta_y_ = (specifications_[i].manual_position_ - conf.position_)
+ * 0.5 * details_.staff_space_;
+ }
else
- {
- conf.position_ = specifications_[i].position_;
- }
+ {
+ conf.position_ = specifications_[i].position_;
+ }
conf.column_ranks_ = specifications_[i].column_ranks_;
ties_config.push_back (conf);
ties_config[i].position_ += ties_config[i].dir_;
ties_config = generate_ties_configuration (ties_config);
-
+
return ties_config;
}
Ties_configuration
Tie_formatting_problem::find_best_variation (Ties_configuration const &base,
- vector<Tie_configuration_variation> const &vars)
+ vector<Tie_configuration_variation> const &vars)
{
Ties_configuration best = base;
-
+
/*
This simply is 1-opt: we have K substitions, and we try applying
exactly every one for each.
for (vsize i = 0; i < vars.size (); i++)
{
Ties_configuration variant (base);
- for (vsize j = 0; j < vars[i].index_suggestion_pairs_.size(); j++)
- variant[vars[i].index_suggestion_pairs_[j].first] = *vars[i].index_suggestion_pairs_[j].second;
+ for (vsize j = 0; j < vars[i].index_suggestion_pairs_.size (); j++)
+ variant[vars[i].index_suggestion_pairs_[j].first] = *vars[i].index_suggestion_pairs_[j].second;
variant.reset_score ();
score_ties (&variant);
-
+
if (variant.score () < best.score ())
- {
- best = variant;
- }
+ {
+ best = variant;
+ }
}
return best;
}
-
-
Ties_configuration
Tie_formatting_problem::generate_optimal_configuration ()
Ties_configuration base = generate_base_chord_configuration ();
score_ties (&base);
- vector<Tie_configuration_variation> vars;
+ vector<Tie_configuration_variation> vars;
if (specifications_.size () > 1)
vars = generate_collision_variations (base);
else
Tie_formatting_problem::set_ties_config_standard_directions (Ties_configuration *tie_configs)
{
if (tie_configs->empty ())
- return ;
+ return;
if (!tie_configs->at (0).dir_)
{
if (tie_configs->size () == 1)
- tie_configs->at (0).dir_ = Direction (sign (tie_configs->at (0).position_));
+ tie_configs->at (0).dir_ = Direction (sign (tie_configs->at (0).position_));
if (!tie_configs->at (0).dir_)
- tie_configs->at (0).dir_
- = (tie_configs->size() > 1) ? DOWN : details_.neutral_direction_;
+ tie_configs->at (0).dir_
+ = (tie_configs->size () > 1) ? DOWN : details_.neutral_direction_;
}
-
+
if (!tie_configs->back ().dir_)
tie_configs->back ().dir_ = UP;
for (vsize i = 1; i < tie_configs->size (); i++)
{
Real diff = (tie_configs->at (i).position_
- -tie_configs->at (i-1).position_);
-
- Real span_diff
- = specifications_[i].column_span () - specifications_[i-1].column_span ();
+ - tie_configs->at (i - 1).position_);
+
+ Real span_diff
+ = specifications_[i].column_span () - specifications_[i - 1].column_span ();
if (span_diff && fabs (diff) <= 2)
- {
- if (span_diff > 0)
- tie_configs->at (i).dir_ = UP;
- else if (span_diff < 0)
- tie_configs->at (i-1).dir_ = DOWN;
- }
+ {
+ if (span_diff > 0)
+ tie_configs->at (i).dir_ = UP;
+ else if (span_diff < 0)
+ tie_configs->at (i - 1).dir_ = DOWN;
+ }
else if (fabs (diff) <= 1)
- {
- if (!tie_configs->at (i-1).dir_)
- tie_configs->at (i-1).dir_ = DOWN;
- if (!tie_configs->at (i).dir_)
- tie_configs->at (i).dir_ = UP;
- }
+ {
+ if (!tie_configs->at (i - 1).dir_)
+ tie_configs->at (i - 1).dir_ = DOWN;
+ if (!tie_configs->at (i).dir_)
+ tie_configs->at (i).dir_ = UP;
+ }
}
for (vsize i = 1; i + 1 < tie_configs->size (); i++)
{
Tie_configuration &conf = tie_configs->at (i);
if (conf.dir_)
- continue;
+ continue;
- Direction position_dir =
- Direction (sign (conf.position_));
+ Direction position_dir
+ = Direction (sign (conf.position_));
if (!position_dir)
- position_dir = DOWN;
+ position_dir = DOWN;
conf.dir_ = position_dir;
}
Tie_formatting_problem::generate_extremal_tie_variations (Ties_configuration const &ties) const
{
vector<Tie_configuration_variation> vars;
- Direction d = DOWN;
+ Direction d = DOWN;
for (int i = 1; i <= details_.multi_tie_region_size_; i++)
{
- Drul_array<Tie_configuration*> configs (0, 0);
+ Drul_array<Tie_configuration *> configs (0, 0);
do
- {
- const Tie_configuration &config = boundary (ties, d, 0);
- if (config.dir_ == d
- && !boundary (specifications_, d, 0).has_manual_position_)
- {
- Tie_configuration_variation var;
- configs[d] = get_configuration (config.position_ + d * i, d,
- config.column_ranks_,
- true);
- var.add_suggestion((d == DOWN) ? 0 : ties.size () - 1,
- configs[d]);
- vars.push_back (var);
- }
- }
- while (flip (&d) != DOWN);
+ {
+ const Tie_configuration &config = boundary (ties, d, 0);
+ if (config.dir_ == d
+ && !boundary (specifications_, d, 0).has_manual_position_)
+ {
+ Tie_configuration_variation var;
+ configs[d] = get_configuration (config.position_ + d * i, d,
+ config.column_ranks_,
+ true);
+ var.add_suggestion ((d == DOWN) ? 0 : ties.size () - 1,
+ configs[d]);
+ vars.push_back (var);
+ }
+ }
+ while (flip (&d) != DOWN);
if (configs[LEFT] && configs[RIGHT])
- {
- Tie_configuration_variation var;
- var.add_suggestion(0, configs[DOWN]);
- var.add_suggestion(ties.size() - 1, configs[UP]);
- vars.push_back (var);
- }
+ {
+ Tie_configuration_variation var;
+ var.add_suggestion (0, configs[DOWN]);
+ var.add_suggestion (ties.size () - 1, configs[UP]);
+ vars.push_back (var);
+ }
}
return vars;
int sz = details_.single_tie_region_size_;
if (specifications_[0].has_manual_position_)
sz = 1;
- for (int i = 0; i < sz; i ++)
+ for (int i = 0; i < sz; i++)
{
Direction d = LEFT;
do
- {
- if (i == 0
- && ties[0].dir_ == d)
- continue;
-
- int p = ties[0].position_ + i * d;
-
- if (!specifications_[0].has_manual_dir_
- || d == specifications_[0].manual_dir_)
- {
- Tie_configuration_variation var;
- var.add_suggestion(0,
- get_configuration (p,
- d, specifications_[0].column_ranks_,
- !specifications_[0].has_manual_delta_y_));
- vars.push_back (var);
- }
- }
+ {
+ if (i == 0
+ && ties[0].dir_ == d)
+ continue;
+
+ int p = ties[0].position_ + i * d;
+
+ if (!specifications_[0].has_manual_dir_
+ || d == specifications_[0].manual_dir_)
+ {
+ Tie_configuration_variation var;
+ var.add_suggestion (0,
+ get_configuration (p,
+ d, specifications_[0].column_ranks_,
+ !specifications_[0].has_manual_delta_y_));
+ vars.push_back (var);
+ }
+ }
while (flip (&d) != LEFT);
}
return vars;
}
-
vector<Tie_configuration_variation>
Tie_formatting_problem::generate_collision_variations (Ties_configuration const &ties) const
{
Real center_distance_tolerance = 0.25;
-
+
vector<Tie_configuration_variation> vars;
Real last_center = 0.0;
for (vsize i = 0; i < ties.size (); i++)
{
Bezier b (ties[i].get_transformed_bezier (details_));
-
+
Real center = b.curve_point (0.5)[Y_AXIS];
-
+
if (i)
- {
- if (center <= last_center + center_distance_tolerance)
- {
- if (!specifications_[i].has_manual_dir_)
- {
- Tie_configuration_variation var;
- var.add_suggestion(i,
- get_configuration (specifications_[i].position_
- - ties[i].dir_,
- - ties[i].dir_,
-
- ties[i].column_ranks_,
- !specifications_[i].has_manual_delta_y_
- ));
-
- vars.push_back (var);
- }
-
- if (!specifications_[i-1].has_manual_dir_)
- {
- Tie_configuration_variation var;
- var.add_suggestion(i-1,
- get_configuration (specifications_[i-1].position_
- - ties[i-1].dir_,
- - ties[i-1].dir_,
- specifications_[i-1].column_ranks_,
- !specifications_[i-1].has_manual_delta_y_));
-
- vars.push_back (var);
- }
-
- if (i == 1 && !specifications_[i-1].has_manual_position_
- && ties[i-1].dir_ == DOWN)
- {
- Tie_configuration_variation var;
- var.add_suggestion(i-1,
- get_configuration (specifications_[i-1].position_ - 1, DOWN,
- specifications_[i-1].column_ranks_,
- !specifications_[i-1].has_manual_delta_y_
- ));
- vars.push_back (var);
- }
- if (i == ties.size () && !specifications_[i].has_manual_position_
- && ties[i].dir_ == UP)
- {
- Tie_configuration_variation var;
- var.add_suggestion(i,
- get_configuration (specifications_[i].position_
- + 1, UP,
- specifications_[i].column_ranks_,
- !specifications_[i].has_manual_delta_y_
- ));
- vars.push_back (var);
- }
- }
- else if (dot_positions_.find (ties[i].position_) != dot_positions_.end ()
- && !specifications_[i].has_manual_position_)
- {
- Tie_configuration_variation var;
- var.add_suggestion(i,
- get_configuration (ties[i].position_ + ties[i].dir_,
- ties[i].dir_,
- ties[i].column_ranks_,
- !specifications_[i].has_manual_delta_y_
- ));
- vars.push_back (var);
- }
-
- }
+ {
+ if (center <= last_center + center_distance_tolerance)
+ {
+ if (!specifications_[i].has_manual_dir_)
+ {
+ Tie_configuration_variation var;
+ var.add_suggestion (i,
+ get_configuration (specifications_[i].position_
+ - ties[i].dir_,
+ - ties[i].dir_,
+
+ ties[i].column_ranks_,
+ !specifications_[i].has_manual_delta_y_
+ ));
+
+ vars.push_back (var);
+ }
+
+ if (!specifications_[i - 1].has_manual_dir_)
+ {
+ Tie_configuration_variation var;
+ var.add_suggestion (i - 1,
+ get_configuration (specifications_[i - 1].position_
+ - ties[i - 1].dir_,
+ - ties[i - 1].dir_,
+ specifications_[i - 1].column_ranks_,
+ !specifications_[i - 1].has_manual_delta_y_));
+
+ vars.push_back (var);
+ }
+
+ if (i == 1 && !specifications_[i - 1].has_manual_position_
+ && ties[i - 1].dir_ == DOWN)
+ {
+ Tie_configuration_variation var;
+ var.add_suggestion (i - 1,
+ get_configuration (specifications_[i - 1].position_ - 1, DOWN,
+ specifications_[i - 1].column_ranks_,
+ !specifications_[i - 1].has_manual_delta_y_
+ ));
+ vars.push_back (var);
+ }
+ if (i == ties.size () && !specifications_[i].has_manual_position_
+ && ties[i].dir_ == UP)
+ {
+ Tie_configuration_variation var;
+ var.add_suggestion (i,
+ get_configuration (specifications_[i].position_
+ + 1, UP,
+ specifications_[i].column_ranks_,
+ !specifications_[i].has_manual_delta_y_
+ ));
+ vars.push_back (var);
+ }
+ }
+ else if (dot_positions_.find (ties[i].position_) != dot_positions_.end ()
+ && !specifications_[i].has_manual_position_)
+ {
+ Tie_configuration_variation var;
+ var.add_suggestion (i,
+ get_configuration (ties[i].position_ + ties[i].dir_,
+ ties[i].dir_,
+ ties[i].column_ranks_,
+ !specifications_[i].has_manual_delta_y_
+ ));
+ vars.push_back (var);
+ }
+
+ }
last_center = center;
}
-
return vars;
}
{
SCM entry = scm_car (s);
if (scm_is_pair (entry))
- {
- Tie_specification &spec = specifications_[k];
-
- if (scm_is_number (scm_car (entry)))
- {
- spec.has_manual_position_ = true;
- spec.manual_position_ = scm_to_double (scm_car (entry));
- spec.has_manual_delta_y_ = (scm_inexact_p (scm_car (entry)) == SCM_BOOL_T);
- }
-
- if (scm_is_number (scm_cdr (entry)))
- {
- spec.has_manual_dir_ = true;
- spec.manual_dir_ = Direction (scm_to_int (scm_cdr (entry)));
- }
- }
- k ++;
+ {
+ Tie_specification &spec = specifications_[k];
+
+ if (scm_is_number (scm_car (entry)))
+ {
+ spec.has_manual_position_ = true;
+ spec.manual_position_ = scm_to_double (scm_car (entry));
+ spec.has_manual_delta_y_ = (scm_inexact_p (scm_car (entry)) == SCM_BOOL_T);
+ }
+
+ if (scm_is_number (scm_cdr (entry)))
+ {
+ spec.has_manual_dir_ = true;
+ spec.manual_dir_ = Direction (scm_to_int (scm_cdr (entry)));
+ }
+ }
+ k++;
}
}
-
void
Tie_formatting_problem::set_debug_scoring (Ties_configuration const &base)
{
#if DEBUG_TIE_SCORING
if (to_boolean (x_refpoint_->layout ()
- ->lookup_variable (ly_symbol2scm ("debug-tie-scoring"))))
+ ->lookup_variable (ly_symbol2scm ("debug-tie-scoring"))))
{
for (vsize i = 0; i < base.size (); i++)
- {
- string card = base.complete_tie_card (i);
- specifications_[i].tie_grob_->set_property ("annotation",
- ly_string2scm (card));
- }
+ {
+ string card = base.complete_tie_card (i);
+ specifications_[i].tie_grob_->set_property ("annotation",
+ ly_string2scm (card));
+ }
}
#endif
-}
+}
}
};
-
class Tie_performer : public Performer
{
Stream_event *event_;
else
now_heads_.push_back (inf_mom);
- // Find a previous note that ties to the current note. If it exists,
+ // Find a previous note that ties to the current note. If it exists,
// remove it from the heads_to_tie vector and create the tie
list<Head_audio_event_tuple>::iterator it;
bool found = false;
Stream_event *right_mus = inf.event_;
- for (it = heads_to_tie_.begin ();
- !found && (it != heads_to_tie_.end());
- it++)
- {
- Audio_element_info et = (*it).head_;
- Audio_note *th = dynamic_cast<Audio_note *> (et.elem_);
- Stream_event *left_mus = et.event_;
-
- if (th && right_mus && left_mus
- && ly_is_equal (right_mus->get_property ("pitch"),
- left_mus->get_property ("pitch")))
- {
- found = true;
- // (*it).moment_ already stores the end of the tied note!
- Moment skip = now_mom() - (*it).end_moment_;
- an->tie_to (th, skip);
- // this invalidates the iterator, we are leaving the loop anyway
- heads_to_tie_.erase (it);
- }
- }
+ for (it = heads_to_tie_.begin ();
+ !found && (it != heads_to_tie_.end ());
+ it++)
+ {
+ Audio_element_info et = (*it).head_;
+ Audio_note *th = dynamic_cast<Audio_note *> (et.elem_);
+ Stream_event *left_mus = et.event_;
+
+ if (th && right_mus && left_mus
+ && ly_is_equal (right_mus->get_property ("pitch"),
+ left_mus->get_property ("pitch")))
+ {
+ found = true;
+ // (*it).moment_ already stores the end of the tied note!
+ Moment skip = now_mom () - (*it).end_moment_;
+ an->tie_to (th, skip);
+ // this invalidates the iterator, we are leaving the loop anyway
+ heads_to_tie_.erase (it);
+ }
+ }
}
}
Tie_performer::start_translation_timestep ()
{
context ()->set_property ("tieMelismaBusy",
- ly_bool2scm (heads_to_tie_.size ()));
+ ly_bool2scm (heads_to_tie_.size ()));
}
// a predicate implemented as a class, used to delete all tied notes with end
Moment now;
public:
end_moment_passed (Moment mom) : now (mom) {}
- bool operator() (const Head_audio_event_tuple &value) {
+ bool operator () (const Head_audio_event_tuple &value)
+ {
return (value.end_moment_ <= now);
}
};
}
ADD_TRANSLATOR (Tie_performer,
- /* doc */
- "Generate ties between note heads of equal pitch.",
+ /* doc */
+ "Generate ties between note heads of equal pitch.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "tieWaitForNote",
+ /* read */
+ "tieWaitForNote",
- /* write */
- "tieMelismaBusy"
- );
+ /* write */
+ "tieMelismaBusy"
+ );
position_ = 0;
manual_position_ = 0;
manual_dir_ = CENTER;
- note_head_drul_[LEFT] =
- note_head_drul_[RIGHT] = 0;
- column_ranks_[RIGHT] =
- column_ranks_[LEFT] = 0;
+ note_head_drul_[LEFT]
+ = note_head_drul_[RIGHT] = 0;
+ column_ranks_[RIGHT]
+ = column_ranks_[LEFT] = 0;
}
-
void
Tie_specification::from_grob (Grob *tie)
{
manual_dir_ = to_dir (tie->get_property ("direction"));
has_manual_dir_ = true;
}
-
+
position_ = Tie::get_position (tie);
SCM pos_scm = tie->get_property ("staff-position");
if (scm_is_number (pos_scm))
Direction hd = to_dir (me->get_property ("head-direction"));
return (hd == d)
- ? unsmob_grob (me->get_object ("note-head"))
- : 0;
+ ? unsmob_grob (me->get_object ("note-head"))
+ : 0;
}
Item *it = dynamic_cast<Spanner *> (me)->get_bound (d);
{
Grob *h = head (me, d);
if (h)
- return (int) rint (Staff_symbol_referencer::get_position (h));
+ return (int) rint (Staff_symbol_referencer::get_position (h));
}
while (flip (&d) != LEFT);
{
Grob *one_head = head (me, d);
if (!one_head && dynamic_cast<Spanner *> (me))
- one_head = Tie::head (dynamic_cast<Spanner *> (me)->broken_neighbor (d), d);
+ one_head = Tie::head (dynamic_cast<Spanner *> (me)->broken_neighbor (d), d);
Grob *stem = one_head ? Rhythmic_head::get_stem (one_head) : 0;
if (stem)
- stem = Stem::is_invisible (stem) ? 0 : stem;
+ stem = Stem::is_invisible (stem) ? 0 : stem;
stems[d] = stem;
}
if (stems[LEFT] && stems[RIGHT])
{
if (get_grob_direction (stems[LEFT]) == UP
- && get_grob_direction (stems[RIGHT]) == UP)
- return DOWN;
+ && get_grob_direction (stems[RIGHT]) == UP)
+ return DOWN;
}
else if (stems[LEFT] || stems[RIGHT])
{
|| Semi_tie_column::has_interface (yparent))
&& unsmob_grob_array (yparent->get_object ("ties"))
// && unsmob_grob_array (yparent->get_object ("ties"))->size () > 1
- )
+ )
{
/* trigger positioning. */
(void) yparent->get_property ("positioning-done");
= problem.generate_optimal_configuration ();
return get_control_points (me, problem.common_x_refpoint (),
- conf[0], problem.details_);
+ conf[0], problem.details_);
}
SCM
Tie::get_control_points (Grob *me,
- Grob *common,
- Tie_configuration const &conf,
- Tie_details const &details)
+ Grob *common,
+ Tie_configuration const &conf,
+ Tie_details const &details)
{
Bezier b = conf.get_transformed_bezier (details);
b.translate (Offset (- me->relative_coordinate (common, X_AXIS), 0));
for (int i = 4; i--;)
{
if (!b.control_[i].is_sane ())
- programming_error ("Insane offset");
+ programming_error ("Insane offset");
controls = scm_cons (ly_offset2scm (b.control_[i]), controls);
}
return controls;
{
extract_grob_set (yparent, "ties", ties);
if (me->original () && ties.size () == 1
- && !to_dir (me->get_property_data ("direction")))
- {
- assert (ties[0] == me);
- set_grob_direction (me, Tie::get_default_dir (me));
- }
+ && !to_dir (me->get_property_data ("direction")))
+ {
+ assert (ties[0] == me);
+ set_grob_direction (me, Tie::get_default_dir (me));
+ }
/* trigger positioning. */
(void) yparent->get_property ("positioning-done");
}
SCM dash_definition = me->get_property ("dash-definition");
a = Lookup::slur (b,
- get_grob_direction (me) * base_thick,
- line_thick,
- dash_definition);
+ get_grob_direction (me) * base_thick,
+ line_thick,
+ dash_definition);
#if DEBUG_TIE_SCORING
SCM annotation = me->get_property ("annotation");
SCM properties = Font_interface::text_font_alist_chain (me);
Stencil tm = *unsmob_stencil (Text_interface::interpret_markup
- (me->layout ()->self_scm (), properties,
- annotation));
+ (me->layout ()->self_scm (), properties,
+ annotation));
tm.translate (Offset (b.control_[3][X_AXIS] + 0.5,
- b.control_[0][Y_AXIS] * 2));
+ b.control_[0][Y_AXIS] * 2));
tm = tm.in_color (1, 0, 0);
/*
- It would be nice if we could put this in a different layer,
- but alas, this must be done with a Tie override.
+ It would be nice if we could put this in a different layer,
+ but alas, this must be done with a Tie override.
*/
a.add_stencil (tm);
}
}
ADD_INTERFACE (Tie,
- "A horizontal curve connecting two noteheads.",
-
- /* properties */
- "annotation "
- "avoid-slur " // UGH.
- "control-points "
- "dash-definition "
- "details "
- "direction "
- "head-direction "
- "line-thickness "
- "neutral-direction "
- "staff-position "
- "thickness "
- );
+ "A horizontal curve connecting two noteheads.",
+
+ /* properties */
+ "annotation "
+ "avoid-slur " // UGH.
+ "control-points "
+ "dash-definition "
+ "details "
+ "direction "
+ "head-direction "
+ "line-thickness "
+ "neutral-direction "
+ "staff-position "
+ "thickness "
+ );
{
int den = scm_to_int (scm_cdr (fr));
if (den != (1 << intlog2 (den)))
- {
- /*
- Todo: should make typecheck?
+ {
+ /*
+ Todo: should make typecheck?
- OTOH, Tristan Keuris writes 8/20 in his Intermezzi.
- */
- warning (_f ("strange time signature found: %d/%d",
- int (scm_to_int (scm_car (fr))),
- den));
- }
+ OTOH, Tristan Keuris writes 8/20 in his Intermezzi.
+ */
+ warning (_f ("strange time signature found: %d/%d",
+ int (scm_to_int (scm_car (fr))),
+ den));
+ }
time_signature_ = make_item ("TimeSignature", SCM_EOL);
time_signature_->set_property ("fraction", fr);
if (last_time_fraction_ == SCM_BOOL_F)
- time_signature_->set_property ("break-visibility",
- get_property ("implicitTimeSignatureVisibility"));
-
+ time_signature_->set_property ("break-visibility",
+ get_property ("implicitTimeSignatureVisibility"));
+
last_time_fraction_ = fr;
}
}
#include "translator.icc"
ADD_TRANSLATOR (Time_signature_engraver,
- /* doc */
- "Create a @ref{TimeSignature} whenever"
- " @code{timeSignatureFraction} changes.",
-
- /* create */
- "TimeSignature ",
-
- /* read */
- "implicitTimeSignatureVisibility "
- "timeSignatureFraction ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create a @ref{TimeSignature} whenever"
+ " @code{timeSignatureFraction} changes.",
+
+ /* create */
+ "TimeSignature ",
+
+ /* read */
+ "implicitTimeSignatureVisibility "
+ "timeSignatureFraction ",
+
+ /* write */
+ ""
+ );
#include "translator.icc"
ADD_TRANSLATOR (Time_signature_performer,
- /* doc */
- "",
+ /* doc */
+ "",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
if (style == "C")
{
if /* neither C2/2 nor C4/4 */
- (((n != 2) || (d != 2))
- && ((n != 4) || (d != 4)))
- return numbered_time_signature (me, n, d);
+ (((n != 2) || (d != 2))
+ && ((n != 4) || (d != 4)))
+ return numbered_time_signature (me, n, d);
}
string char_name = style + to_string (n) + to_string (d);
me->set_property ("font-encoding", ly_symbol2scm ("fetaMusic"));
Stencil out = Font_interface::get_default_font (me)
- ->find_by_name ("timesig." + char_name);
+ ->find_by_name ("timesig." + char_name);
if (!out.is_empty ())
return out;
/* If there is no such symbol, we default to the numbered style.
(Here really with a warning!) */
me->warning (_f ("time signature symbol `%s' not found; "
- "reverting to numbered style", char_name));
+ "reverting to numbered style", char_name));
return numbered_time_signature (me, n, d);
}
{
SCM chain = me->get_property_alist_chain (Font_interface::text_font_alist_chain (me));
chain = scm_cons (scm_list_1 (scm_cons (ly_symbol2scm ("font-encoding"),
- ly_symbol2scm ("fetaText"))),
- chain);
+ ly_symbol2scm ("fetaText"))),
+ chain);
SCM sn = Text_interface::interpret_markup (me->layout ()->self_scm (), chain,
- ly_string2scm (to_string (num)));
+ ly_string2scm (to_string (num)));
SCM sd = Text_interface::interpret_markup (me->layout ()->self_scm (), chain,
- ly_string2scm (to_string (den)));
+ ly_string2scm (to_string (den)));
Stencil n = *unsmob_stencil (sn);
Stencil d = *unsmob_stencil (sd);
}
ADD_INTERFACE (Time_signature,
- "A time signature, in different styles. The following values"
- " for @code{style} are are recognized:\n"
- "\n"
- "@table @code\n"
- "@item C\n"
- "4/4 and 2/2 are typeset as C and struck C, respectively."
- " All other time signatures are written with two digits."
- " The value @code{default} is equivalent to @code{C}.\n"
- "@item neomensural\n"
- "2/2, 3/2, 2/4, 3/4, 4/4, 6/4, 9/4, 4/8, 6/8, and 9/8 are"
- " typeset with neo-mensural style mensuration marks. All"
- " other time signatures are written with two digits.\n"
- "@item mensural\n"
- "2/2, 3/2, 2/4, 3/4, 4/4, 6/4, 9/4, 4/8, 6/8, and 9/8 are"
- " typeset with mensural style mensuration marks. All other"
- " time signatures are written with two digits.\n"
- "@item single-digit\n"
- "All time signatures are typeset with a single digit, e.g.,"
- " 3/2 is written as 3.\n"
- "@item numbered\n"
- "All time signatures are typeset with two digits.\n"
- "@end table",
-
- /* properties */
- "fraction "
- "style "
- );
+ "A time signature, in different styles. The following values"
+ " for @code{style} are are recognized:\n"
+ "\n"
+ "@table @code\n"
+ "@item C\n"
+ "4/4 and 2/2 are typeset as C and struck C, respectively."
+ " All other time signatures are written with two digits."
+ " The value @code{default} is equivalent to @code{C}.\n"
+ "@item neomensural\n"
+ "2/2, 3/2, 2/4, 3/4, 4/4, 6/4, 9/4, 4/8, 6/8, and 9/8 are"
+ " typeset with neo-mensural style mensuration marks. All"
+ " other time signatures are written with two digits.\n"
+ "@item mensural\n"
+ "2/2, 3/2, 2/4, 3/4, 4/4, 6/4, 9/4, 4/8, 6/8, and 9/8 are"
+ " typeset with mensural style mensuration marks. All other"
+ " time signatures are written with two digits.\n"
+ "@item single-digit\n"
+ "All time signatures are typeset with a single digit, e.g.,"
+ " 3/2 is written as 3.\n"
+ "@item numbered\n"
+ "All time signatures are typeset with two digits.\n"
+ "@end table",
+
+ /* properties */
+ "fraction "
+ "style "
+ );
Moment now = now_mom ();
if (barleft > Moment (0))
- {
- Moment nextmom = now + barleft;
- nextmom.grace_part_ = Rational (0);
- global->add_moment_to_process (nextmom);
- }
+ {
+ Moment nextmom = now + barleft;
+ nextmom.grace_part_ = Rational (0);
+ global->add_moment_to_process (nextmom);
+ }
}
}
context ()->set_property ("internalBarNumber", scm_from_int (1));
context ()->set_property ("timeSignatureFraction",
- scm_cons (scm_from_int (4), scm_from_int (4)));
+ scm_cons (scm_from_int (4), scm_from_int (4)));
/*
Do not init measurePosition; this should be done from global
context.
*/
context ()->set_property ("measureLength",
- Moment (Rational (1)).smobbed_copy ());
+ Moment (Rational (1)).smobbed_copy ());
context ()->set_property ("baseMoment",
- Moment (Rational (1, 4)).smobbed_copy ());
+ Moment (Rational (1, 4)).smobbed_copy ());
}
Rational
{
measposp = now;
context ()->set_property ("measurePosition",
- measposp.smobbed_copy ());
+ measposp.smobbed_copy ());
}
measposp += dt;
while (c && measposp.main_part_ >= len)
{
measposp.main_part_ -= len;
- current_barnumber ++;
- internal_barnumber ++;
+ current_barnumber++;
+ internal_barnumber++;
}
context ()->set_property ("currentBarNumber", scm_from_int (current_barnumber));
#include "translator.icc"
ADD_TRANSLATOR (Timing_translator,
- /* doc */
- "This engraver adds the alias @code{Timing} to its containing"
- " context. Responsible for synchronizing timing information"
- " from staves. Normally in @code{Score}. In order to create"
- " polyrhythmic music, this engraver should be removed from"
- " @code{Score} and placed in @code{Staff}.",
-
- /* create */
- "",
-
- /* read */
- "internalBarNumber "
- "currentBarNumber "
- "measureLength "
- "measurePosition ",
-
- /* write */
- "baseMoment "
- "currentBarNumber "
- "internalBarNumber "
- "measureLength "
- "measurePosition "
- "timeSignatureFraction "
- );
+ /* doc */
+ "This engraver adds the alias @code{Timing} to its containing"
+ " context. Responsible for synchronizing timing information"
+ " from staves. Normally in @code{Score}. In order to create"
+ " polyrhythmic music, this engraver should be removed from"
+ " @code{Score} and placed in @code{Staff}.",
+
+ /* create */
+ "",
+
+ /* read */
+ "internalBarNumber "
+ "currentBarNumber "
+ "measureLength "
+ "measurePosition ",
+
+ /* write */
+ "baseMoment "
+ "currentBarNumber "
+ "internalBarNumber "
+ "measureLength "
+ "measurePosition "
+ "timeSignatureFraction "
+ );
Scheme_hash_table *global_translator_dict = 0;
LY_DEFINE (get_all_translators, "ly:get-all-translators", 0, 0, 0, (),
- "Return a list of all translator objects that may be"
- " instantiated.")
+ "Return a list of all translator objects that may be"
+ " instantiated.")
{
SCM l = global_translator_dict ? global_translator_dict->to_alist () : SCM_EOL;
{
Engraver_dispatch_entry const &e (dispatch_entries_[i]);
if (e.engraver_ == origin)
- continue;
+ continue;
(*e.function_) (e.engraver_, gi);
}
SCM
Engraver_dispatch_list::create (SCM trans_list,
- SCM iface_list, Direction start_end)
+ SCM iface_list, Direction start_end)
{
SCM retval = Engraver_dispatch_list ().smobbed_copy ();
Engraver_dispatch_list *list = Engraver_dispatch_list::unsmob (retval);
for (SCM s = trans_list; scm_is_pair (s); s = scm_cdr (s))
{
Engraver *eng
- = dynamic_cast<Engraver *> (unsmob_translator (scm_car (s)));
+ = dynamic_cast<Engraver *> (unsmob_translator (scm_car (s)));
if (!eng)
- continue;
+ continue;
entry.engraver_ = eng;
for (SCM i = iface_list; scm_is_pair (i); i = scm_cdr (i))
- {
- Engraver_void_function_engraver_grob_info ptr
- = (start_end == START)
- ? eng->get_acknowledger (scm_car (i))
- : eng->get_end_acknowledger (scm_car (i));
-
- if (ptr)
- {
- entry.function_ = ptr;
- list->dispatch_entries_.push_back (entry);
- found = true;
- }
- }
+ {
+ Engraver_void_function_engraver_grob_info ptr
+ = (start_end == START)
+ ? eng->get_acknowledger (scm_car (i))
+ : eng->get_end_acknowledger (scm_car (i));
+
+ if (ptr)
+ {
+ entry.function_ = ptr;
+ list->dispatch_entries_.push_back (entry);
+ found = true;
+ }
+ }
}
return found ? retval : SCM_EOL;
int
Engraver_dispatch_list::print_smob (SCM /* x */,
- SCM p,
- scm_print_state *)
+ SCM p,
+ scm_print_state *)
{
scm_puts ("#<Engraver_dispatch_list>", p);
return 1;
return new Score_performer ();
error (_f ("fatal error. Couldn't find type: %s",
- ly_symbol2string (sym).c_str ()));
+ ly_symbol2string (sym).c_str ()));
scm_flush (scm_current_error_port ());
scm_display (sym, scm_current_error_port ());
scm_flush (scm_current_error_port ());
-
+
exit (2);
-
+
return 0;
}
if (context_)
{
programming_error ("translator group is already connected to context "
- + context_->context_name ());
+ + context_->context_name ());
}
-
+
context_ = c;
c->event_source ()->add_listener (GET_LISTENER (create_child_translator),
- ly_symbol2scm ("AnnounceNewContext"));
+ ly_symbol2scm ("AnnounceNewContext"));
for (SCM tr_list = simple_trans_list_; scm_is_pair (tr_list); tr_list = scm_cdr (tr_list))
{
Translator *tr = unsmob_translator (scm_car (tr_list));
tr->disconnect_from_context (context_);
}
context_->event_source ()->remove_listener (GET_LISTENER (create_child_translator),
- ly_symbol2scm ("AnnounceNewContext"));
+ ly_symbol2scm ("AnnounceNewContext"));
context_ = 0;
protected_events_ = SCM_EOL;
}
for (SCM p = ell; scm_is_pair (p); p = scm_cdr (p))
{
if (unsmob_performer (scm_car (*tail)))
- *tail = scm_cdr (*tail);
+ *tail = scm_cdr (*tail);
else
- tail = SCM_CDRLOC (*tail);
+ tail = SCM_CDRLOC (*tail);
}
return ell;
}
for (SCM p = ell; scm_is_pair (p); p = scm_cdr (p))
{
if (unsmob_engraver (scm_car (*tail)))
- *tail = scm_cdr (*tail);
+ *tail = scm_cdr (*tail);
else
- tail = SCM_CDRLOC (*tail);
+ tail = SCM_CDRLOC (*tail);
}
return ell;
}
-/*
+/*
Protects the parameter from being garbage collected. The object is
protected until the next disconnect_from_context call.
this list. This eliminates the need for derived_mark methods in most
translators; all incoming events are instead protected by the
translator group.
-
+
TODO: Should the list also be flushed at the beginning of each new
moment?
*/
Context *new_context = unsmob_context (cs);
Context_def *def = unsmob_context_def (new_context->get_definition ());
SCM ops = new_context->get_definition_mods ();
-
+
SCM trans_names = def->get_translator_names (ops);
Translator_group *g = get_translator_group (def->get_translator_group_type ());
Translator *type = 0;
if (ly_is_symbol (definition))
- type = get_translator (definition);
+ type = get_translator (definition);
else if (ly_is_pair (definition))
- {
- type = get_translator (ly_symbol2scm ("Scheme_engraver"));
- is_scheme = true;
- }
+ {
+ type = get_translator (ly_symbol2scm ("Scheme_engraver"));
+ is_scheme = true;
+ }
else if (ly_is_procedure (definition))
- {
- // `definition' is a procedure, which takes the context as
- // an argument and evaluates to an a-list scheme engraver
- // definition.
- definition = scm_call_1 (definition, cs);
- type = get_translator (ly_symbol2scm ("Scheme_engraver"));
- is_scheme = true;
- }
-
+ {
+ // `definition' is a procedure, which takes the context as
+ // an argument and evaluates to an a-list scheme engraver
+ // definition.
+ definition = scm_call_1 (definition, cs);
+ type = get_translator (ly_symbol2scm ("Scheme_engraver"));
+ is_scheme = true;
+ }
+
if (!type)
- warning (_f ("cannot find: `%s'", ly_symbol2string (scm_car (s)).c_str ()));
+ warning (_f ("cannot find: `%s'", ly_symbol2string (scm_car (s)).c_str ()));
else
- {
- Translator *instance = type->clone ();
- if (is_scheme)
- dynamic_cast<Scheme_engraver *> (instance)->init_from_scheme (definition);
-
- SCM str = instance->self_scm ();
-
- if (instance->must_be_last ())
- {
- SCM cons = scm_cons (str, SCM_EOL);
- if (scm_is_pair (trans_list))
- scm_set_cdr_x (scm_last_pair (trans_list), cons);
- else
- trans_list = cons;
- }
- else
- trans_list = scm_cons (str, trans_list);
-
- instance->daddy_context_ = new_context;
- instance->unprotect ();
- }
+ {
+ Translator *instance = type->clone ();
+ if (is_scheme)
+ dynamic_cast<Scheme_engraver *> (instance)->init_from_scheme (definition);
+
+ SCM str = instance->self_scm ();
+
+ if (instance->must_be_last ())
+ {
+ SCM cons = scm_cons (str, SCM_EOL);
+ if (scm_is_pair (trans_list))
+ scm_set_cdr_x (scm_last_pair (trans_list), cons);
+ else
+ trans_list = cons;
+ }
+ else
+ trans_list = scm_cons (str, trans_list);
+
+ instance->daddy_context_ = new_context;
+ instance->unprotect ();
+ }
}
/* Filter unwanted translator types. Required to make
g->unprotect ();
recurse_over_translators (new_context,
- &Translator::initialize,
- &Translator_group::initialize,
- DOWN);
+ &Translator::initialize,
+ &Translator_group::initialize,
+ DOWN);
}
SCM
void
recurse_over_translators (Context *c, Translator_method ptr,
- Translator_group_method tg_ptr, Direction dir)
+ Translator_group_method tg_ptr, Direction dir)
{
Translator_group *tg
= dynamic_cast<Translator_group *> (c->implementation ());
if (tg && dir == UP)
{
translator_each (tg->get_simple_trans_list (),
- ptr);
+ ptr);
(tg->*tg_ptr) ();
}
assert (tr);
for (int i = 0; i < TRANSLATOR_METHOD_PRECOMPUTE_COUNT; i++)
- {
- if (ptrs[i])
- precomputed_method_bindings_[i].push_back (Translator_method_binding (tr, ptrs[i]));
- }
+ {
+ if (ptrs[i])
+ precomputed_method_bindings_[i].push_back (Translator_method_binding (tr, ptrs[i]));
+ }
}
fetch_precomputable_methods (precomputed_self_method_bindings_);
#include "moment.hh"
LY_DEFINE (ly_translator_name, "ly:translator-name",
- 1, 0, 0, (SCM trans),
- "Return the type name of the translator object @var{trans}."
- " The name is a symbol.")
+ 1, 0, 0, (SCM trans),
+ "Return the type name of the translator object @var{trans}."
+ " The name is a symbol.")
{
LY_ASSERT_SMOB (Translator, trans, 1);
Translator *tr = unsmob_translator (trans);
}
LY_DEFINE (ly_translator_description, "ly:translator-description",
- 1, 0, 0, (SCM me),
- "Return an alist of properties of translator @var{me}.")
+ 1, 0, 0, (SCM me),
+ "Return an alist of properties of translator @var{me}.")
{
LY_ASSERT_SMOB (Translator, me, 1);
Translator *tr = unsmob_translator (me);
return tr->translator_description ();
}
-
LY_DEFINE (ly_translator_context, "ly:translator-context",
- 1, 0, 0, (SCM trans),
- "Return the context of the translator object @var{trans}.")
+ 1, 0, 0, (SCM trans),
+ "Return the context of the translator object @var{trans}.")
{
LY_ASSERT_SMOB (Translator, trans, 1);
Translator *tr = unsmob_translator (trans);
{
for (translator_listener_record *r = get_listener_list (); r; r = r->next_)
c->events_below ()->add_listener (r->get_listener_ (this, r->event_class_),
- r->event_class_);
+ r->event_class_);
}
void
{
for (translator_listener_record *r = get_listener_list (); r; r = r->next_)
c->events_below ()->remove_listener (r->get_listener_ (this, r->event_class_),
- r->event_class_);
+ r->event_class_);
}
static SCM listened_event_class_table;
listened_event_class_table = scm_permanent_object (scm_c_make_hash_table (61));
}
-
LY_DEFINE (ly_get_listened_event_classes, "ly:get-listened-event-classes",
- 0, 0, 0, (),
- "Return a list of all event classes that some translator listens"
- " to.")
+ 0, 0, 0, (),
+ "Return a list of all event classes that some translator listens"
+ " to.")
{
ensure_listened_hash ();
return ly_hash_table_keys (listened_event_class_table);
}
LY_DEFINE (ly_is_listened_event_class, "ly:is-listened-event-class",
- 1, 0, 0, (SCM sym),
- "Is @var{sym} a listened event class?")
+ 1, 0, 0, (SCM sym),
+ "Is @var{sym} a listened event class?")
{
ensure_listened_hash ();
return scm_hashq_ref (listened_event_class_table, sym, SCM_BOOL_F);
scm_hashq_set_x (listened_event_class_table, sym, SCM_BOOL_T);
}
-
/*
internally called once, statically, for each translator
listener. Connects the name of an event class with a procedure that
*/
void
Translator::add_translator_listener (translator_listener_record **listener_list,
- translator_listener_record *r,
- Listener (*get_listener) (void *, SCM),
- const char *ev_class)
+ translator_listener_record *r,
+ Listener (*get_listener) (void *, SCM),
+ const char *ev_class)
{
/* ev_class is the C++ identifier name. Convert to scm symbol */
string name = string (ev_class);
name = replace_all (&name, '_', '-');
name += "-event";
-
+
SCM class_sym = scm_from_locale_symbol (name.c_str ());
-
+
add_listened_event_class (class_sym);
r->event_class_ = class_sym;
*/
SCM
Translator::static_translator_description (const char *grobs,
- const char *desc,
- translator_listener_record *listener_list,
- const char *read,
- const char *write) const
-{
- SCM static_properties = SCM_EOL;
-
- static_properties = scm_acons (ly_symbol2scm ("grobs-created"),
- parse_symbol_list (grobs), static_properties);
-
- static_properties = scm_acons (ly_symbol2scm ("description"),
- scm_from_locale_string (desc), static_properties);
-
+ const char *desc,
+ translator_listener_record *listener_list,
+ const char *read,
+ const char *write) const
+{
+ SCM static_properties = SCM_EOL;
+
+ static_properties = scm_acons (ly_symbol2scm ("grobs-created"),
+ parse_symbol_list (grobs), static_properties);
+
+ static_properties = scm_acons (ly_symbol2scm ("description"),
+ scm_from_locale_string (desc), static_properties);
+
SCM list = SCM_EOL;
for (; listener_list; listener_list = listener_list->next_)
list = scm_cons (listener_list->event_class_, list);
static_properties = scm_acons (ly_symbol2scm ("events-accepted"),
- list, static_properties);
-
- static_properties = scm_acons (ly_symbol2scm ("properties-read"),
- parse_symbol_list (read), static_properties);
-
- static_properties = scm_acons (ly_symbol2scm ("properties-written"),
- parse_symbol_list (write), static_properties);
-
- return static_properties;
-}
-
+ list, static_properties);
+
+ static_properties = scm_acons (ly_symbol2scm ("properties-read"),
+ parse_symbol_list (read), static_properties);
+
+ static_properties = scm_acons (ly_symbol2scm ("properties-written"),
+ parse_symbol_list (write), static_properties);
+
+ return static_properties;
+}
+
/*
SMOBS
*/
void
add_acknowledger (Engraver_void_function_engraver_grob_info ptr,
- char const *func_name,
- vector<Acknowledge_information> *ack_array)
+ char const *func_name,
+ vector<Acknowledge_information> *ack_array)
{
Acknowledge_information inf;
inf.function_ = ptr;
for (vsize i = 0; i < ack_array->size (); i++)
{
if (ack_array->at (i).symbol_ == sym)
- return ack_array->at (i).function_;
+ return ack_array->at (i).function_;
}
return 0;
}
-
Moment
get_event_length (Stream_event *e)
{
get_event_length (Stream_event *e, Moment now)
{
Moment len = get_event_length (e);
-
+
if (now.grace_part_)
{
len.grace_part_ = len.main_part_;
bool
internal_event_assignment (Stream_event **old_ev, Stream_event *new_ev, const char *function)
{
- if (*old_ev &&
- !to_boolean (scm_equal_p ((*old_ev)->self_scm (),
- new_ev->self_scm ())))
+ if (*old_ev
+ && !to_boolean (scm_equal_p ((*old_ev)->self_scm (),
+ new_ev->self_scm ())))
{
/* extract event class from function name */
string ev_class = function;
/* This assertion fails if EVENT_ASSIGNMENT was called outside a
- translator listener. Don't do that. */
+ translator listener. Don't do that. */
const char *prefix = "listen_";
assert (0 == ev_class.find (prefix));
}
ADD_TRANSLATOR (Translator,
- /* doc */
- "Base class. Not instantiated.",
+ /* doc */
+ "Base class. Not instantiated.",
- /* create */
- "",
+ /* create */
+ "",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
if (span_)
{
Pointer_group_interface::add_grob (span_,
- ly_symbol2scm ("note-columns"),
- info.grob());
+ ly_symbol2scm ("note-columns"),
+ info.grob ());
if (!span_->get_bound (LEFT))
- add_bound_item (span_, info.grob ());
+ add_bound_item (span_, info.grob ());
}
else if (finished_)
{
Pointer_group_interface::add_grob (finished_, ly_symbol2scm ("note-columns"),
- info.grob());
+ info.grob ());
if (!finished_->get_bound (RIGHT))
- add_bound_item (finished_, info.grob ());
+ add_bound_item (finished_, info.grob ());
}
}
{
Stream_event *ender = event_drul_[STOP];
if (!ender)
- ender = event_drul_[START];
+ ender = event_drul_[START];
finished_ = span_;
announce_end_grob (finished_, ender->self_scm ());
span_ = 0;
if (finished_)
{
if (!finished_->get_bound (RIGHT))
- {
- Grob *e = unsmob_grob (get_property ("currentMusicalColumn"));
- finished_->set_bound (RIGHT, e);
- }
+ {
+ Grob *e = unsmob_grob (get_property ("currentMusicalColumn"));
+ finished_->set_bound (RIGHT, e);
+ }
finished_ = 0;
}
}
ADD_ACKNOWLEDGER (Trill_spanner_engraver, note_column);
ADD_TRANSLATOR (Trill_spanner_engraver,
- /* doc */
- "Create trill spanner from an event.",
+ /* doc */
+ "Create trill spanner from an event.",
- /* create */
- "TrillSpanner ",
+ /* create */
+ "TrillSpanner ",
- /* read */
- "currentCommandColumn "
- "currentMusicalColumn ",
+ /* read */
+ "currentCommandColumn "
+ "currentMusicalColumn ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
#include "main.hh"
#include "open-type-font.hh"
-
Index_to_charcode_map
make_index_to_charcode_map (FT_Face face)
{
charcode = FT_Get_Next_Char (face, charcode, &gindex))
{
m[gindex] = charcode;
- j ++;
+ j++;
}
FT_Set_Charmap (face, current_cmap);
lily_cookie_fprintf (out, "%d dict begin\n", 11);
lily_cookie_fprintf (out, "/FontName /%s def\n",
- FT_Get_Postscript_Name (face));
+ FT_Get_Postscript_Name (face));
lily_cookie_fprintf (out, "/Encoding StandardEncoding def\n");
lily_cookie_fprintf (out, "/PaintType 0 def\n");
= (TT_Header *)FT_Get_Sfnt_Table (face, ft_sfnt_head);
lily_cookie_fprintf (out, "/FontBBox [%lf %lf %lf %lf] def\n",
- float (ht->xMin) / float (ht->Units_Per_EM),
- float (ht->yMin) / float (ht->Units_Per_EM),
- float (ht->xMax) / float (ht->Units_Per_EM),
- float (ht->yMax) / float (ht->Units_Per_EM));
+ float (ht->xMin) / float (ht->Units_Per_EM),
+ float (ht->yMin) / float (ht->Units_Per_EM),
+ float (ht->xMax) / float (ht->Units_Per_EM),
+ float (ht->yMax) / float (ht->Units_Per_EM));
lily_cookie_fprintf (out, "/FontType 42 def\n");
lily_cookie_fprintf (out, "/FontInfo 8 dict dup begin\n");
lily_cookie_fprintf (out, "/version (%.3f) def\n",
- ht->Font_Revision / 65536.0);
+ ht->Font_Revision / 65536.0);
#if 0
if (strings[0])
#endif
lily_cookie_fprintf (out, "/isFixedPitch %s def\n",
- pt->isFixedPitch ? "true" : "false");
+ pt->isFixedPitch ? "true" : "false");
lily_cookie_fprintf (out, "/UnderlinePosition %lf def\n",
- float (pt->underlinePosition)
- / float (ht->Units_Per_EM));
+ float (pt->underlinePosition)
+ / float (ht->Units_Per_EM));
lily_cookie_fprintf (out, "/UnderlineThickness %lf def\n",
- float (pt->underlineThickness)
- / float (ht->Units_Per_EM));
+ float (pt->underlineThickness)
+ / float (ht->Units_Per_EM));
lily_cookie_fprintf (out, "end readonly def\n");
}
static
void t42_write_table (void *out, FT_Face face, unsigned char const *buffer,
- size_t s, bool is_glyf,
- FT_ULong head_length, FT_ULong loca_length)
+ size_t s, bool is_glyf,
+ FT_ULong head_length, FT_ULong loca_length)
{
vector<FT_UShort> chunks;
unsigned char *head_buf = new unsigned char[head_length];
FT_Error error = FT_Load_Sfnt_Table (face, head_tag, 0, head_buf, NULL);
if (error)
- programming_error ("FT_Load_Sfnt_Table (): error.");
+ programming_error ("FT_Load_Sfnt_Table (): error.");
/* we access the lower byte of indexToLocFormat */
- bool long_offsets = head_buf[4*4 + 2*2 + 2*8 + 4*2 + 3*2 + 1] == 1;
+ bool long_offsets = head_buf[4 * 4 + 2 * 2 + 2 * 8 + 4 * 2 + 3 * 2 + 1] == 1;
delete[] head_buf;
unsigned char *loca_buf = new unsigned char[loca_length];
error = FT_Load_Sfnt_Table (face, loca_tag, 0, loca_buf, NULL);
if (error)
- programming_error ("FT_Load_Sfnt_Table (): error.");
+ programming_error ("FT_Load_Sfnt_Table (): error.");
unsigned char *p = loca_buf;
unsigned char *endp = loca_buf + loca_length;
FT_ULong offset = 0, last_offset = 0, last_chunk = 0;
while (p < endp)
- {
- if (long_offsets)
- {
- offset = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
- p += 4;
- }
- else
- {
- offset = ((p[0] << 8) | p[1]) << 1;
- p += 2;
- }
- if (offset > last_offset + CHUNKSIZE)
- {
- if (last_chunk != last_offset)
- chunks.push_back (FT_UShort (last_offset - last_chunk));
- /*
- a single glyph with more than 64k data
- is a pathological case but...
- */
- FT_ULong rest = offset - last_offset;
- while (rest > CHUNKSIZE)
- {
- chunks.push_back (CHUNKSIZE);
- rest -= CHUNKSIZE;
- }
- chunks.push_back (FT_UShort (rest));
- last_chunk = offset;
- }
- else if (offset > last_chunk + CHUNKSIZE)
- {
- chunks.push_back (FT_UShort (last_offset - last_chunk));
- last_chunk = last_offset;
- }
-
- last_offset = offset;
- }
+ {
+ if (long_offsets)
+ {
+ offset = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+ p += 4;
+ }
+ else
+ {
+ offset = ((p[0] << 8) | p[1]) << 1;
+ p += 2;
+ }
+ if (offset > last_offset + CHUNKSIZE)
+ {
+ if (last_chunk != last_offset)
+ chunks.push_back (FT_UShort (last_offset - last_chunk));
+ /*
+ a single glyph with more than 64k data
+ is a pathological case but...
+ */
+ FT_ULong rest = offset - last_offset;
+ while (rest > CHUNKSIZE)
+ {
+ chunks.push_back (CHUNKSIZE);
+ rest -= CHUNKSIZE;
+ }
+ chunks.push_back (FT_UShort (rest));
+ last_chunk = offset;
+ }
+ else if (offset > last_chunk + CHUNKSIZE)
+ {
+ chunks.push_back (FT_UShort (last_offset - last_chunk));
+ last_chunk = last_offset;
+ }
+
+ last_offset = offset;
+ }
chunks.push_back (FT_UShort (s - last_chunk));
delete[] loca_buf;
{
FT_ULong rest = s;
while (rest > CHUNKSIZE)
- {
- chunks.push_back (CHUNKSIZE);
- rest -= CHUNKSIZE;
- }
+ {
+ chunks.push_back (CHUNKSIZE);
+ rest -= CHUNKSIZE;
+ }
chunks.push_back (FT_UShort (rest));
}
else
chunks.push_back (CHUNKSIZE);
lily_cookie_fprintf (out, "\n"
- " <");
+ " <");
int l = 0;
static char xdigits[] = "0123456789ABCDEF";
for (size_t j = 0; j < s; j++)
{
if (l >= chunks[cur_chunk_idx])
- {
- lily_cookie_fprintf (out, "\n"
- " 00>\n"
- " <");
- l = 0;
- cur_chunk_idx ++;
- }
+ {
+ lily_cookie_fprintf (out, "\n"
+ " 00>\n"
+ " <");
+ l = 0;
+ cur_chunk_idx++;
+ }
if (l % 31 == 0)
- lily_cookie_fprintf (out, "\n"
- " ");
+ lily_cookie_fprintf (out, "\n"
+ " ");
/* lily_cookie_fprintf (out,"%02X",(int)buffer[j]) is too slow */
lily_cookie_putc (xdigits[(buffer[j] & 0xF0) >> 4], out);
lily_cookie_putc (xdigits[buffer[j] & 0x0F], out);
- l ++;
+ l++;
}
/* pad to four-byte boundary */
- while ((s ++) % 4 != 0)
+ while ((s++) % 4 != 0)
lily_cookie_fprintf (out, "00");
lily_cookie_fprintf (out, "\n"
- " 00\n"
- " >");
+ " 00\n"
+ " >");
}
static void
contains tables which aren't indexed at all
*/
while (FT_Sfnt_Table_Info (face, idx, &tag, &length)
- != FT_Err_Table_Missing)
- {
- lengths.push_back (length);
- tags.push_back (tag);
- if (tag == head_tag)
- head_length = length;
- else if (tag == loca_tag)
- loca_length = length;
- idx ++;
- }
+ != FT_Err_Table_Missing)
+ {
+ lengths.push_back (length);
+ tags.push_back (tag);
+ if (tag == head_tag)
+ head_length = length;
+ else if (tag == loca_tag)
+ loca_length = length;
+ idx++;
+ }
FT_ULong hlength = 12 + 16 * idx;
unsigned char *hbuf = new unsigned char[hlength];
unsigned char *p;
- hbuf[0] = 0x00; /* version */
+ hbuf[0] = 0x00; /* version */
hbuf[1] = 0x01;
hbuf[2] = 0x00;
hbuf[3] = 0x00;
- hbuf[4] = (unsigned char) ((idx & 0xFF00) >> 8); /* numTables */
+ hbuf[4] = (unsigned char) ((idx & 0xFF00) >> 8); /* numTables */
hbuf[5] = idx & 0x00FF;
FT_UInt searchRange, entrySelector, rangeShift;
FT_ULong checksum, font_checksum = 0;
- FT_ULong offset = hlength; /* first table offset */
+ FT_ULong offset = hlength; /* first table offset */
for (FT_UInt i = 0; i < idx; i++)
- {
- /* here, the buffer length must be a multiple of 4 */
- FT_ULong len = (lengths[i] + 3) & ~3;
- unsigned char *buf = new unsigned char[len];
-
- buf[len - 1] = 0x00; /* assure padding with zeros */
- buf[len - 2] = 0x00;
- buf[len - 3] = 0x00;
-
- FT_Error error = FT_Load_Sfnt_Table (face, tags[i], 0, buf, NULL);
- if (error)
- programming_error ("FT_Load_Sfnt_Table (): error.");
-
- if (tag == head_tag)
- {
- /*
- first pass of computing the font checksum
- needs checkSumAdjustment = 0
- */
- buf[8] = 0x00;
- buf[9] = 0x00;
- buf[10] = 0x00;
- buf[11] = 0x00;
- }
-
- checksum = 0;
- unsigned char *endq = buf + len;
- for (unsigned char *q = buf; q < endq; q += 4)
- checksum += (q[0] << 24) | (q[1] << 16) | (q[2] << 8) | q[3];
- font_checksum += checksum;
-
- delete[] buf;
-
- *(p++) = (unsigned char) ((tags[i] & 0xFF000000UL) >> 24);
- *(p++) = (unsigned char) ((tags[i] & 0x00FF0000UL) >> 16);
- *(p++) = (unsigned char) ((tags[i] & 0x0000FF00UL) >> 8);
- *(p++) = tags[i] & 0x000000FFUL;
-
- *(p++) = (unsigned char) ((checksum & 0xFF000000UL) >> 24);
- *(p++) = (unsigned char) ((checksum & 0x00FF0000UL) >> 16);
- *(p++) = (unsigned char) ((checksum & 0x0000FF00UL) >> 8);
- *(p++) = checksum & 0x000000FFUL;
-
- *(p++) = (unsigned char) ((offset & 0xFF000000UL) >> 24);
- *(p++) = (unsigned char) ((offset & 0x00FF0000UL) >> 16);
- *(p++) = (unsigned char) ((offset & 0x0000FF00UL) >> 8);
- *(p++) = offset & 0x000000FFUL;
-
- *(p++) = (unsigned char) ((lengths[i] & 0xFF000000UL) >> 24);
- *(p++) = (unsigned char) ((lengths[i] & 0x00FF0000UL) >> 16);
- *(p++) = (unsigned char) ((lengths[i] & 0x0000FF00UL) >> 8);
- *(p++) = lengths[i] & 0x000000FFUL;
-
- /* offset must be a multiple of 4 */
- offset += (lengths[i] + 3) & ~3;
- }
+ {
+ /* here, the buffer length must be a multiple of 4 */
+ FT_ULong len = (lengths[i] + 3) & ~3;
+ unsigned char *buf = new unsigned char[len];
+
+ buf[len - 1] = 0x00; /* assure padding with zeros */
+ buf[len - 2] = 0x00;
+ buf[len - 3] = 0x00;
+
+ FT_Error error = FT_Load_Sfnt_Table (face, tags[i], 0, buf, NULL);
+ if (error)
+ programming_error ("FT_Load_Sfnt_Table (): error.");
+
+ if (tag == head_tag)
+ {
+ /*
+ first pass of computing the font checksum
+ needs checkSumAdjustment = 0
+ */
+ buf[8] = 0x00;
+ buf[9] = 0x00;
+ buf[10] = 0x00;
+ buf[11] = 0x00;
+ }
+
+ checksum = 0;
+ unsigned char *endq = buf + len;
+ for (unsigned char *q = buf; q < endq; q += 4)
+ checksum += (q[0] << 24) | (q[1] << 16) | (q[2] << 8) | q[3];
+ font_checksum += checksum;
+
+ delete[] buf;
+
+ *(p++) = (unsigned char) ((tags[i] & 0xFF000000UL) >> 24);
+ *(p++) = (unsigned char) ((tags[i] & 0x00FF0000UL) >> 16);
+ *(p++) = (unsigned char) ((tags[i] & 0x0000FF00UL) >> 8);
+ *(p++) = tags[i] & 0x000000FFUL;
+
+ *(p++) = (unsigned char) ((checksum & 0xFF000000UL) >> 24);
+ *(p++) = (unsigned char) ((checksum & 0x00FF0000UL) >> 16);
+ *(p++) = (unsigned char) ((checksum & 0x0000FF00UL) >> 8);
+ *(p++) = checksum & 0x000000FFUL;
+
+ *(p++) = (unsigned char) ((offset & 0xFF000000UL) >> 24);
+ *(p++) = (unsigned char) ((offset & 0x00FF0000UL) >> 16);
+ *(p++) = (unsigned char) ((offset & 0x0000FF00UL) >> 8);
+ *(p++) = offset & 0x000000FFUL;
+
+ *(p++) = (unsigned char) ((lengths[i] & 0xFF000000UL) >> 24);
+ *(p++) = (unsigned char) ((lengths[i] & 0x00FF0000UL) >> 16);
+ *(p++) = (unsigned char) ((lengths[i] & 0x0000FF00UL) >> 8);
+ *(p++) = lengths[i] & 0x000000FFUL;
+
+ /* offset must be a multiple of 4 */
+ offset += (lengths[i] + 3) & ~3;
+ }
/* add checksum of TTF header */
checksum = 0;
*/
lily_cookie_fprintf (out, "/sfnts [");
t42_write_table (out, face, hbuf, hlength, false,
- head_length, loca_length);
+ head_length, loca_length);
delete[] hbuf;
idx = 0;
while (FT_Sfnt_Table_Info (face, idx, &tag, &length)
- != FT_Err_Table_Missing)
+ != FT_Err_Table_Missing)
{
unsigned char *buf = new unsigned char[length];
FT_Error error = FT_Load_Sfnt_Table (face, tag, 0, buf, NULL);
if (error)
- programming_error ("FT_Load_Sfnt_Table (): error.");
+ programming_error ("FT_Load_Sfnt_Table (): error.");
if (tag == head_tag)
- {
- /* in the second pass simply store the computed font checksum */
- buf[8] = (unsigned char) ((font_checksum & 0xFF000000UL) >> 24);
- buf[9] = (unsigned char) ((font_checksum & 0x00FF0000UL) >> 16);
- buf[10] = (unsigned char) ((font_checksum & 0x0000FF00UL) >> 8);
- buf[11] = font_checksum & 0x000000FFUL;
- }
+ {
+ /* in the second pass simply store the computed font checksum */
+ buf[8] = (unsigned char) ((font_checksum & 0xFF000000UL) >> 24);
+ buf[9] = (unsigned char) ((font_checksum & 0x00FF0000UL) >> 16);
+ buf[10] = (unsigned char) ((font_checksum & 0x0000FF00UL) >> 8);
+ buf[11] = font_checksum & 0x000000FFUL;
+ }
bool is_glyf_table = tag == glyf_tag && length > CHUNKSIZE;
t42_write_table (out, face, buf, length, is_glyf_table,
- head_length, loca_length);
+ head_length, loca_length);
delete[] buf;
- idx ++;
+ idx++;
}
lily_cookie_fprintf (out, "\n] def\n");
}
static void
print_trailer (void *out,
- FT_Face face)
+ FT_Face face)
{
const int GLYPH_NAME_LEN = 256;
char glyph_name[GLYPH_NAME_LEN];
{
glyph_name[0] = 0;
if (face->face_flags & FT_FACE_FLAG_GLYPH_NAMES)
- {
- FT_Error error = FT_Get_Glyph_Name (face, i, glyph_name,
- GLYPH_NAME_LEN);
- if (error)
- {
- programming_error ("FT_Get_Glyph_Name (): error.");
- glyph_name[0] = 0;
- }
- }
+ {
+ FT_Error error = FT_Get_Glyph_Name (face, i, glyph_name,
+ GLYPH_NAME_LEN);
+ if (error)
+ {
+ programming_error ("FT_Get_Glyph_Name (): error.");
+ glyph_name[0] = 0;
+ }
+ }
if (!glyph_name[0] && ic_map.find (i) != ic_map.end ())
- {
- FT_ULong ucode = ic_map[i];
- get_unicode_name (glyph_name, ucode);
- }
+ {
+ FT_ULong ucode = ic_map[i];
+ get_unicode_name (glyph_name, ucode);
+ }
if (i == 0)
- sprintf (glyph_name, ".notdef");
+ sprintf (glyph_name, ".notdef");
else if (glyph_name == string (".notdef"))
- glyph_name[0] = '\0';
+ glyph_name[0] = '\0';
if (!glyph_name[0])
- get_glyph_index_name (glyph_name, i);
+ get_glyph_index_name (glyph_name, i);
if (glyph_name[0])
- {
- lily_cookie_fprintf (out, "(%s) cvn %d def ", glyph_name, i);
- output_count ++;
- }
+ {
+ lily_cookie_fprintf (out, "(%s) cvn %d def ", glyph_name, i);
+ output_count++;
+ }
else
- programming_error (to_string ("no name for glyph %d", i));
-
+ programming_error (to_string ("no name for glyph %d", i));
+
if (! (output_count % 5))
- lily_cookie_fprintf (out, "\n");
+ lily_cookie_fprintf (out, "\n");
}
lily_cookie_fprintf (out, "end readonly def\n");
{
face = open_ft_face (name, -1);
if (idx >= face->num_faces)
- {
- warning (_f ("font index %d too large for font `%s', using index 0",
- idx, name.c_str()));
- idx = 0;
- }
+ {
+ warning (_f ("font index %d too large for font `%s', using index 0",
+ idx, name.c_str ()));
+ idx = 0;
+ }
FT_Done_Face (face);
}
}
LY_DEFINE (ly_ttf_ps_name, "ly:ttf-ps-name",
- 1, 1, 0, (SCM ttf_file_name, SCM idx),
- "Extract the PostScript name from a TrueType font. The optional"
- " @var{idx} argument is useful for TrueType collections (TTC)"
- " only; it specifies the font index within the TTC. The default"
- " value of @var{idx} is@tie{}0.")
+ 1, 1, 0, (SCM ttf_file_name, SCM idx),
+ "Extract the PostScript name from a TrueType font. The optional"
+ " @var{idx} argument is useful for TrueType collections (TTC)"
+ " only; it specifies the font index within the TTC. The default"
+ " value of @var{idx} is@tie{}0.")
{
LY_ASSERT_TYPE (scm_is_string, ttf_file_name, 1);
LY_ASSERT_TYPE (scm_is_integer, idx, 2);
i = scm_to_int (idx);
if (i < 0)
- {
- warning (_ ("font index must be non-negative, using index 0"));
- i = 0;
- }
+ {
+ warning (_ ("font index must be non-negative, using index 0"));
+ i = 0;
+ }
}
string file_name = ly_scm2string (ttf_file_name);
{
face = open_ft_face (file_name, -1);
if (i >= face->num_faces)
- {
- warning (_f ("font index %d too large for font `%s', using index 0",
- i, file_name.c_str()));
- i = 0;
- }
+ {
+ warning (_f ("font index %d too large for font `%s', using index 0",
+ i, file_name.c_str ()));
+ i = 0;
+ }
FT_Done_Face (face);
}
}
LY_DEFINE (ly_ttf_2_pfa, "ly:ttf->pfa",
- 1, 1, 0, (SCM ttf_file_name, SCM idx),
- "Convert the contents of a TrueType font file to PostScript"
- " Type@tie{}42 font, returning it as a string. The optional"
- " @var{idx} argument is useful for TrueType collections (TTC)"
- " only; it specifies the font index within the TTC. The default"
- " value of @var{idx} is@tie{}0.")
+ 1, 1, 0, (SCM ttf_file_name, SCM idx),
+ "Convert the contents of a TrueType font file to PostScript"
+ " Type@tie{}42 font, returning it as a string. The optional"
+ " @var{idx} argument is useful for TrueType collections (TTC)"
+ " only; it specifies the font index within the TTC. The default"
+ " value of @var{idx} is@tie{}0.")
{
LY_ASSERT_TYPE (scm_is_string, ttf_file_name, 1);
LY_ASSERT_TYPE (scm_is_integer, idx, 2);
i = scm_to_int (idx);
if (i < 0)
- {
- warning (_ ("font index must be non-negative, using index 0"));
- i = 0;
- }
+ {
+ warning (_ ("font index must be non-negative, using index 0"));
+ i = 0;
+ }
}
string file_name = ly_scm2string (ttf_file_name);
create_type42_font (&stream, file_name, i);
SCM asscm = scm_from_locale_stringn (stream.get_string (),
- stream.get_length ());
+ stream.get_length ());
if (be_verbose_global)
progress_indication ("]");
*/
Grob *
Tuplet_bracket::parallel_beam (Grob *me_grob, vector<Grob *> const &cols,
- bool *equally_long)
+ bool *equally_long)
{
Spanner *me = dynamic_cast<Spanner *> (me_grob);
return 0;
Drul_array<Grob *> stems (Note_column::get_stem (cols[0]),
- Note_column::get_stem (cols.back ()));
+ Note_column::get_stem (cols.back ()));
if (!stems[RIGHT]
|| !stems[LEFT]
|| (dynamic_cast<Item *> (stems[RIGHT])->get_column ()
- != me->get_bound (RIGHT)->get_column ()))
+ != me->get_bound (RIGHT)->get_column ()))
return 0;
Drul_array<Grob *> beams;
Direction dir = get_grob_direction (me);
Drul_array<Item *> bounds (get_x_bound_item (me, LEFT, dir),
- get_x_bound_item (me, RIGHT, dir));
+ get_x_bound_item (me, RIGHT, dir));
Drul_array<bool> connect_to_other (false, false);
Direction d = LEFT;
Spanner *orig_spanner = dynamic_cast<Spanner *> (me->original ());
vsize neighbor_idx = me->get_break_index () - break_dir;
if (break_dir
- && d == RIGHT
- && neighbor_idx < orig_spanner->broken_intos_.size ())
- {
- Grob *neighbor = orig_spanner->broken_intos_[neighbor_idx];
+ && d == RIGHT
+ && neighbor_idx < orig_spanner->broken_intos_.size ())
+ {
+ Grob *neighbor = orig_spanner->broken_intos_[neighbor_idx];
- /* trigger possible suicide*/
- (void) neighbor->get_property ("positions");
- }
+ /* trigger possible suicide*/
+ (void) neighbor->get_property ("positions");
+ }
connect_to_other[d]
- = (break_dir
- && neighbor_idx < orig_spanner->broken_intos_.size ()
- && orig_spanner->broken_intos_[neighbor_idx]->is_live ());
+ = (break_dir
+ && neighbor_idx < orig_spanner->broken_intos_.size ()
+ && orig_spanner->broken_intos_[neighbor_idx]->is_live ());
}
while (flip (&d) != LEFT);
if (connect_to_other[LEFT] || connect_to_other[RIGHT])
return scm_cons (scm_from_bool (connect_to_other[LEFT]),
- scm_from_bool (connect_to_other[RIGHT]));
+ scm_from_bool (connect_to_other[RIGHT]));
return SCM_EOL;
}
Drul_array<bool> connect_to_other
= robust_scm2booldrul (me->get_property ("connect-to-neighbor"),
- Drul_array<bool> (false, false));
+ Drul_array<bool> (false, false));
Interval x_span;
Direction d = LEFT;
x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS)[d];
if (connect_to_other[d])
- {
- Interval overshoot (robust_scm2drul (me->get_property ("break-overshoot"),
- Interval (-0.5, 0.0)));
-
- if (d == RIGHT)
- x_span[d] += d * overshoot[d];
- else
- x_span[d] = robust_relative_extent (bounds[d],
- commonx, X_AXIS)[RIGHT]
- - overshoot[LEFT];
- }
+ {
+ Interval overshoot (robust_scm2drul (me->get_property ("break-overshoot"),
+ Interval (-0.5, 0.0)));
+
+ if (d == RIGHT)
+ x_span[d] += d * overshoot[d];
+ else
+ x_span[d] = robust_relative_extent (bounds[d],
+ commonx, X_AXIS)[RIGHT]
+ - overshoot[LEFT];
+ }
else if (d == RIGHT
- && (columns.empty ()
- || (bounds[d]->get_column ()
- != dynamic_cast<Item *> (columns.back ())->get_column ())))
- {
- /*
- We're connecting to a column, for the last bit of a broken
- fullLength bracket.
- */
- Real padding
- = robust_scm2double (me->get_property ("full-length-padding"), 1.0);
-
- if (bounds[d]->break_status_dir ())
- padding = 0.0;
-
- Real coord = bounds[d]->relative_coordinate (commonx, X_AXIS);
- if (to_boolean (me->get_property ("full-length-to-extent")))
- coord = robust_relative_extent (bounds[d], commonx, X_AXIS)[LEFT];
-
- coord = max (coord, x_span[LEFT]);
-
- x_span[d] = coord - padding;
- }
+ && (columns.empty ()
+ || (bounds[d]->get_column ()
+ != dynamic_cast<Item *> (columns.back ())->get_column ())))
+ {
+ /*
+ We're connecting to a column, for the last bit of a broken
+ fullLength bracket.
+ */
+ Real padding
+ = robust_scm2double (me->get_property ("full-length-padding"), 1.0);
+
+ if (bounds[d]->break_status_dir ())
+ padding = 0.0;
+
+ Real coord = bounds[d]->relative_coordinate (commonx, X_AXIS);
+ if (to_boolean (me->get_property ("full-length-to-extent")))
+ coord = robust_relative_extent (bounds[d], commonx, X_AXIS)[LEFT];
+
+ coord = max (coord, x_span[LEFT]);
+
+ x_span[d] = coord - padding;
+ }
}
while (flip (&d) != LEFT);
x_span -= me->get_bound (LEFT)->relative_coordinate (commonx, X_AXIS);
return scm_list_2 (ly_offset2scm (Offset (x_span[LEFT], positions[LEFT])),
- ly_offset2scm (Offset (x_span[RIGHT], positions[RIGHT])));
+ ly_offset2scm (Offset (x_span[RIGHT], positions[RIGHT])));
}
/*
*/
if (!to_boolean (bracket_vis_prop)
&& (robust_scm2moment (me->get_bound (LEFT)->get_column ()->get_property ("when"), Moment (0))
- == robust_scm2moment (me->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0))))
+ == robust_scm2moment (me->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0))))
bracket_visibility = false;
Drul_array<Offset> points;
{
Interval ext = number_grob->extent (number_grob, X_AXIS);
if (!ext.is_empty ())
- {
- gap = ext.length () + 1.0;
+ {
+ gap = ext.length () + 1.0;
- if ((0.75 * x_span.length () < gap) && !bracket_prop)
- bracket_visibility = false;
- }
+ if ((0.75 * x_span.length () < gap) && !bracket_prop)
+ bracket_visibility = false;
+ }
}
if (bracket_visibility)
Drul_array<Real> zero (0, 0);
Real ss = Staff_symbol_referencer::staff_space (me);
Drul_array<Real> height
- = robust_scm2drul (me->get_property ("edge-height"), zero);
+ = robust_scm2drul (me->get_property ("edge-height"), zero);
Drul_array<Real> flare
- = robust_scm2drul (me->get_property ("bracket-flare"), zero);
+ = robust_scm2drul (me->get_property ("bracket-flare"), zero);
Drul_array<Real> shorten
- = robust_scm2drul (me->get_property ("shorten-pair"), zero);
+ = robust_scm2drul (me->get_property ("shorten-pair"), zero);
Drul_array<Stencil> edge_stencils;
Direction dir = get_grob_direction (me);
scale_drul (&shorten, ss);
Drul_array<bool> connect_to_other
- = robust_scm2booldrul (me->get_property ("connect-to-neighbor"),
- Drul_array<bool> (false, false));
+ = robust_scm2booldrul (me->get_property ("connect-to-neighbor"),
+ Drul_array<bool> (false, false));
Direction d = LEFT;
do
- {
- if (connect_to_other[d])
- {
- height[d] = 0.0;
- flare[d] = 0.0;
- shorten[d] = 0.0;
-
- SCM edge_text = me->get_property ("edge-text");
-
- if (scm_is_pair (edge_text))
- {
- SCM properties = Font_interface::text_font_alist_chain (me);
- SCM text = index_get_cell (edge_text, d);
- if (Text_interface::is_markup (text))
- {
- SCM t
- = Text_interface::interpret_markup (pap->self_scm (),
- properties, text);
-
- Stencil *edge_text = unsmob_stencil (t);
- edge_text->translate_axis (x_span[d] - x_span[LEFT],
- X_AXIS);
- edge_stencils[d] = *edge_text;
- }
- }
- }
- }
+ {
+ if (connect_to_other[d])
+ {
+ height[d] = 0.0;
+ flare[d] = 0.0;
+ shorten[d] = 0.0;
+
+ SCM edge_text = me->get_property ("edge-text");
+
+ if (scm_is_pair (edge_text))
+ {
+ SCM properties = Font_interface::text_font_alist_chain (me);
+ SCM text = index_get_cell (edge_text, d);
+ if (Text_interface::is_markup (text))
+ {
+ SCM t
+ = Text_interface::interpret_markup (pap->self_scm (),
+ properties, text);
+
+ Stencil *edge_text = unsmob_stencil (t);
+ edge_text->translate_axis (x_span[d] - x_span[LEFT],
+ X_AXIS);
+ edge_stencils[d] = *edge_text;
+ }
+ }
+ }
+ }
while (flip (&d) != LEFT);
Stencil brack = make_bracket (me, Y_AXIS,
- points[RIGHT] - points[LEFT],
- height,
- /*
- 0.1 = more space at right due to italics
- TODO: use italic correction of font.
- */
- Interval (-0.5, 0.5) * gap + 0.1,
- flare, shorten);
+ points[RIGHT] - points[LEFT],
+ height,
+ /*
+ 0.1 = more space at right due to italics
+ TODO: use italic correction of font.
+ */
+ Interval (-0.5, 0.5) * gap + 0.1,
+ flare, shorten);
do
- {
- if (!edge_stencils[d].is_empty ())
- brack.add_stencil (edge_stencils[d]);
- }
+ {
+ if (!edge_stencils[d].is_empty ())
+ brack.add_stencil (edge_stencils[d]);
+ }
while (flip (&d) != LEFT);
mol.add_stencil (brack);
*/
Stencil
Tuplet_bracket::make_bracket (Grob *me, // for line properties.
- Axis protrusion_axis,
- Offset dz,
- Drul_array<Real> height,
- Interval gap,
- Drul_array<Real> flare,
- Drul_array<Real> shorten)
+ Axis protrusion_axis,
+ Offset dz,
+ Drul_array<Real> height,
+ Interval gap,
+ Drul_array<Real> flare,
+ Drul_array<Real> shorten)
{
Drul_array<Offset> corners (Offset (0, 0), dz);
if (!gap.is_empty ())
{
do
- gap_corners[d] = (dz * 0.5) + gap[d] / length * dz;
+ gap_corners[d] = (dz * 0.5) + gap[d] / length * dz;
while (flip (&d) != LEFT);
}
do
{
if (!gap.is_empty ())
- m.add_stencil (Line_interface::line (me, straight_corners[d],
- gap_corners[d]));
+ m.add_stencil (Line_interface::line (me, straight_corners[d],
+ gap_corners[d]));
m.add_stencil (Line_interface::line (me, straight_corners[d],
- flare_corners[d]));
+ flare_corners[d]));
}
while (flip (&d) != LEFT);
if (gap.is_empty ())
m.add_stencil (Line_interface::line (me, straight_corners[LEFT],
- straight_corners[RIGHT]));
+ straight_corners[RIGHT]));
return m;
}
{
Real pad = robust_scm2double (me->get_property ("staff-padding"), -1.0);
if (pad >= 0.0)
- {
- staff = st->extent (commony, Y_AXIS) - my_offset;
- staff.widen (pad);
- }
+ {
+ staff = st->extent (commony, Y_AXIS) - my_offset;
+ staff.widen (pad);
+ }
}
Direction dir = get_grob_direction (me);
Real x0 = robust_relative_extent (lgr, commonx, X_AXIS)[LEFT];
Real x1 = robust_relative_extent (rgr, commonx, X_AXIS)[RIGHT];
bool follow_beam = par_beam
- && get_grob_direction (par_beam) == dir
- && !to_boolean (par_beam->get_property ("knee"));
+ && get_grob_direction (par_beam) == dir
+ && !to_boolean (par_beam->get_property ("knee"));
vector<Offset> points;
if (columns.size ()
&& Note_column::get_stem (columns.back ()))
{
/*
- trigger set_stem_ends
+ trigger set_stem_ends
*/
(void) par_beam->get_property ("quantized-positions");
Drul_array<Grob *> stems (Note_column::get_stem (columns[0]),
- Note_column::get_stem (columns.back ()));
+ Note_column::get_stem (columns.back ()));
Real ss = 0.5 * Staff_symbol_referencer::staff_space (me);
Real lp = ss * robust_scm2double (stems[LEFT]->get_property ("stem-end-position"), 0.0)
- + stems[LEFT]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
+ + stems[LEFT]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
Real rp = ss * robust_scm2double (stems[RIGHT]->get_property ("stem-end-position"), 0.0)
- + stems[RIGHT]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
+ + stems[RIGHT]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
*dy = rp - lp;
points.push_back (Offset (stems[LEFT]->relative_coordinate (commonx, X_AXIS) - x0, lp));
else
{
/*
- Use outer non-rest columns to determine slope
+ Use outer non-rest columns to determine slope
*/
Grob *left_col = 0;
Grob *right_col = 0;
get_bounds (me, &left_col, &right_col);
if (left_col && right_col)
- {
- Interval rv = Note_column::cross_staff_extent (right_col, commony);
- Interval lv = Note_column::cross_staff_extent (left_col, commony);
- rv.unite (staff);
- lv.unite (staff);
-
- Real graphical_dy = rv[dir] - lv[dir];
-
- Slice ls = Note_column::head_positions_interval (left_col);
- Slice rs = Note_column::head_positions_interval (right_col);
-
- Interval musical_dy;
- musical_dy[UP] = rs[UP] - ls[UP];
- musical_dy[DOWN] = rs[DOWN] - ls[DOWN];
- if (sign (musical_dy[UP]) != sign (musical_dy[DOWN]))
- *dy = 0.0;
- else if (sign (graphical_dy) != sign (musical_dy[DOWN]))
- *dy = 0.0;
- else
- *dy = graphical_dy;
- }
+ {
+ Interval rv = Note_column::cross_staff_extent (right_col, commony);
+ Interval lv = Note_column::cross_staff_extent (left_col, commony);
+ rv.unite (staff);
+ lv.unite (staff);
+
+ Real graphical_dy = rv[dir] - lv[dir];
+
+ Slice ls = Note_column::head_positions_interval (left_col);
+ Slice rs = Note_column::head_positions_interval (right_col);
+
+ Interval musical_dy;
+ musical_dy[UP] = rs[UP] - ls[UP];
+ musical_dy[DOWN] = rs[DOWN] - ls[DOWN];
+ if (sign (musical_dy[UP]) != sign (musical_dy[DOWN]))
+ *dy = 0.0;
+ else if (sign (graphical_dy) != sign (musical_dy[DOWN]))
+ *dy = 0.0;
+ else
+ *dy = graphical_dy;
+ }
else
- *dy = 0;
+ *dy = 0;
for (vsize i = 0; i < columns.size (); i++)
- {
- Interval note_ext = Note_column::cross_staff_extent (columns[i],
- commony);
- Real x = columns[i]->relative_coordinate (commonx, X_AXIS) - x0;
+ {
+ Interval note_ext = Note_column::cross_staff_extent (columns[i],
+ commony);
+ Real x = columns[i]->relative_coordinate (commonx, X_AXIS) - x0;
- points.push_back (Offset (x, note_ext[dir]));
- }
+ points.push_back (Offset (x, note_ext[dir]));
+ }
}
if (!follow_beam)
Interval tuplet_y (tuplets[i]->extent (commony, Y_AXIS));
if (!tuplets[i]->is_live ())
- continue;
+ continue;
Direction d = LEFT;
Drul_array<Real> positions
- = robust_scm2interval (tuplets[i]->get_property ("positions"),
- Interval (0,0));
+ = robust_scm2interval (tuplets[i]->get_property ("positions"),
+ Interval (0, 0));
Real other_dy = positions[RIGHT] - positions[LEFT];
do
- {
- Real y
- = tuplet_y.linear_combination (d * sign (other_dy));
-
- /*
- We don't take padding into account for nested tuplets.
- the edges can come very close to the stems, likewise for
- nested tuplets?
- */
-
- points.push_back (Offset (tuplet_x[d] - x0, y));
- }
+ {
+ Real y
+ = tuplet_y.linear_combination (d * sign (other_dy));
+
+ /*
+ We don't take padding into account for nested tuplets.
+ the edges can come very close to the stems, likewise for
+ nested tuplets?
+ */
+
+ points.push_back (Offset (tuplet_x[d] - x0, y));
+ }
while (flip (&d) != LEFT);
}
Real tuplety = (*dy) * x * factor + my_offset;
if (points[i][Y_AXIS] * dir > (*offset + tuplety) * dir)
- *offset = points[i][Y_AXIS] - tuplety;
+ *offset = points[i][Y_AXIS] - tuplety;
}
*offset += scm_to_double (me->get_property ("padding")) * dir;
*offset = rint (*offset);
if (Staff_symbol_referencer::on_line (me, (int) rint (*offset)))
- *offset += dir;
+ *offset += dir;
*offset *= 0.5 * ss;
}
calc_position_and_height (me, &offset, &dy);
SCM x = scm_cons (scm_from_double (offset),
- scm_from_double (offset + dy));
+ scm_from_double (offset + dy));
return x;
}
continue;
Direction d = Note_column::dir (nc);
if (d)
- dirs[d]++;
+ dirs[d]++;
}
if (dirs[UP] == dirs[DOWN])
for (vsize i = 0; i < columns.size (); i++)
{
Direction d = Note_column::dir (columns[i]);
- extremal_positions[d] = minmax (d, 1.0*Note_column::head_positions_interval (columns[i])[d], extremal_positions[d]);
+ extremal_positions[d] = minmax (d, 1.0 * Note_column::head_positions_interval (columns[i])[d], extremal_positions[d]);
}
Direction d = LEFT;
do
{
Grob *stem = unsmob_grob (cols[i]->get_object ("stem"));
if (stem && to_boolean (stem->get_property ("cross-staff")))
- return SCM_BOOL_T;
+ return SCM_BOOL_T;
}
return SCM_BOOL_F;
}
ADD_INTERFACE (Tuplet_bracket,
- "A bracket with a number in the middle, used for tuplets."
- " When the bracket spans a line break, the value of"
- " @code{break-overshoot} determines how far it extends"
- " beyond the staff. At a line break, the markups in the"
- " @code{edge-text} are printed at the edges.",
-
- /* properties */
- "bracket-flare "
- "bracket-visibility "
- "break-overshoot "
- "connect-to-neighbor "
- "control-points "
- "direction "
- "edge-height "
- "edge-text "
- "full-length-padding "
- "full-length-to-extent "
- "gap "
- "positions "
- "note-columns "
- "padding "
- "tuplet-number "
- "shorten-pair "
- "staff-padding "
- "thickness "
- "tuplets "
- );
+ "A bracket with a number in the middle, used for tuplets."
+ " When the bracket spans a line break, the value of"
+ " @code{break-overshoot} determines how far it extends"
+ " beyond the staff. At a line break, the markups in the"
+ " @code{edge-text} are printed at the edges.",
+
+ /* properties */
+ "bracket-flare "
+ "bracket-visibility "
+ "break-overshoot "
+ "connect-to-neighbor "
+ "control-points "
+ "direction "
+ "edge-height "
+ "edge-text "
+ "full-length-padding "
+ "full-length-to-extent "
+ "gap "
+ "positions "
+ "note-columns "
+ "padding "
+ "tuplet-number "
+ "shorten-pair "
+ "staff-padding "
+ "thickness "
+ "tuplets "
+ );
Moment stop_moment_;
Moment start_moment_;
Moment length_;
-
+
Tuplet_description ()
{
event_ = 0;
vector<Tuplet_description> tuplets_;
vector<Tuplet_description> new_tuplets_;
vector<Tuplet_description> stopped_tuplets_;
- vector<Spanner*> last_tuplets_;
-
+ vector<Spanner *> last_tuplets_;
+
DECLARE_ACKNOWLEDGER (note_column);
DECLARE_TRANSLATOR_LISTENER (tuplet_span);
virtual void finalize ();
d.event_ = ev;
d.length_ = robust_scm2moment (d.event_->get_property ("length"),
- Moment (0));
+ Moment (0));
d.start_moment_ = now_mom ();
d.stop_moment_ = now_mom () + d.length_;
- for (vsize i=0; i < new_tuplets_.size (); i++)
- {
- /*
- discard duplicates.
- */
- if (new_tuplets_[i].stop_moment_ == d.stop_moment_)
- return;
- }
-
+ for (vsize i = 0; i < new_tuplets_.size (); i++)
+ {
+ /*
+ discard duplicates.
+ */
+ if (new_tuplets_[i].stop_moment_ == d.stop_moment_)
+ return;
+ }
+
new_tuplets_.push_back (d);
}
else if (dir == STOP)
{
if (tuplets_.size ())
- {
- stopped_tuplets_.push_back (tuplets_.back ());
- tuplets_.pop_back ();
- }
- else if (!to_boolean (get_property ("skipTypesetting")))
- ev->origin ()->warning (_ ("No tuplet to end"));
+ {
+ stopped_tuplets_.push_back (tuplets_.back ());
+ tuplets_.pop_back ();
+ }
+ else if (!to_boolean (get_property ("skipTypesetting")))
+ ev->origin ()->warning (_ ("No tuplet to end"));
}
- else
+ else
ev->origin ()->programming_error ("direction tuplet-span-event_ invalid.");
}
This may happen if the end of a tuplet is part of a quoted voice.
*/
Moment now = now_mom ();
- for (vsize i = tuplets_.size (); i --; )
+ for (vsize i = tuplets_.size (); i--;)
{
if (tuplets_[i].stop_moment_ == now)
- {
- stopped_tuplets_.push_back (tuplets_[i]);
- tuplets_.erase (tuplets_.begin () + i);
- }
+ {
+ stopped_tuplets_.push_back (tuplets_[i]);
+ tuplets_.erase (tuplets_.begin () + i);
+ }
}
-
+
for (vsize i = 0; i < stopped_tuplets_.size (); i++)
{
Spanner *bracket = stopped_tuplets_[i].bracket_;
Spanner *number = stopped_tuplets_[i].number_;
if (bracket)
- {
- if (stopped_tuplets_[i].full_length_)
- {
- Item *col =
- unsmob_item (stopped_tuplets_[i].full_length_note_
- ? get_property ("currentMusicalColumn")
- : get_property ("currentCommandColumn"));
-
- bracket->set_bound (RIGHT, col);
- number->set_bound (RIGHT, col);
- }
- else if (!bracket->get_bound (RIGHT))
- {
- if (bracket->get_bound (LEFT))
- {
- bracket->set_bound (RIGHT,
- bracket->get_bound (LEFT));
- number->set_bound (RIGHT,
- stopped_tuplets_[i].bracket_->get_bound (LEFT));
- }
- else
- programming_error ("stopped tuplet bracket has neither left nor right bound");
- }
- // todo: scrap last_tuplets_, use stopped_tuplets_ only.
- // clear stopped_tuplets_ at start_translation_timestep
- last_tuplets_.push_back (bracket);
- last_tuplets_.push_back (number);
- }
+ {
+ if (stopped_tuplets_[i].full_length_)
+ {
+ Item *col
+ = unsmob_item (stopped_tuplets_[i].full_length_note_
+ ? get_property ("currentMusicalColumn")
+ : get_property ("currentCommandColumn"));
+
+ bracket->set_bound (RIGHT, col);
+ number->set_bound (RIGHT, col);
+ }
+ else if (!bracket->get_bound (RIGHT))
+ {
+ if (bracket->get_bound (LEFT))
+ {
+ bracket->set_bound (RIGHT,
+ bracket->get_bound (LEFT));
+ number->set_bound (RIGHT,
+ stopped_tuplets_[i].bracket_->get_bound (LEFT));
+ }
+ else
+ programming_error ("stopped tuplet bracket has neither left nor right bound");
+ }
+ // todo: scrap last_tuplets_, use stopped_tuplets_ only.
+ // clear stopped_tuplets_ at start_translation_timestep
+ last_tuplets_.push_back (bracket);
+ last_tuplets_.push_back (number);
+ }
}
stopped_tuplets_.clear ();
/* i goes from size-1 downto 0, inclusively */
vsize i = j - 1;
-
if (tuplets_[i].bracket_)
- continue;
+ continue;
tuplets_[i].full_length_ = to_boolean (get_property ("tupletFullLength"));
tuplets_[i].full_length_note_
- = to_boolean (get_property ("tupletFullLengthNote"));
-
+ = to_boolean (get_property ("tupletFullLengthNote"));
+
tuplets_[i].bracket_ = make_spanner ("TupletBracket",
- tuplets_[i].event_->self_scm ());
+ tuplets_[i].event_->self_scm ());
tuplets_[i].number_ = make_spanner ("TupletNumber",
- tuplets_[i].event_->self_scm ());
+ tuplets_[i].event_->self_scm ());
tuplets_[i].number_->set_object ("bracket", tuplets_[i].bracket_->self_scm ());
tuplets_[i].number_->set_parent (tuplets_[i].bracket_, X_AXIS);
tuplets_[i].number_->set_parent (tuplets_[i].bracket_, Y_AXIS);
tuplets_[i].bracket_->set_object ("tuplet-number", tuplets_[i].number_->self_scm ());
tuplets_[i].stop_moment_.grace_part_ = 0;
-
-
+
if (i + 1 < tuplets_.size () && tuplets_[i + 1].bracket_)
- Tuplet_bracket::add_tuplet_bracket (tuplets_[i].bracket_, tuplets_[i + 1].bracket_);
-
+ Tuplet_bracket::add_tuplet_bracket (tuplets_[i].bracket_, tuplets_[i + 1].bracket_);
+
if (i > 0 && tuplets_[i - 1].bracket_)
- Tuplet_bracket::add_tuplet_bracket (tuplets_[i - 1].bracket_, tuplets_[i].bracket_);
+ Tuplet_bracket::add_tuplet_bracket (tuplets_[i - 1].bracket_, tuplets_[i].bracket_);
}
}
for (vsize j = 0; j < tuplets_.size (); j++)
if (tuplets_[j].bracket_)
{
- Item *i = dynamic_cast<Item *> (inf.grob ());
- Tuplet_bracket::add_column (tuplets_[j].bracket_, i);
- add_bound_item (tuplets_[j].number_, i);
+ Item *i = dynamic_cast<Item *> (inf.grob ());
+ Tuplet_bracket::add_column (tuplets_[j].bracket_, i);
+ add_bound_item (tuplets_[j].number_, i);
}
}
/*
May seem superfluous, but necessary for skipTypesetting.
*/
- new_tuplets_.clear ();
+ new_tuplets_.clear ();
}
void
if (to_boolean (get_property ("tupletFullLength")))
for (vsize i = 0; i < last_tuplets_.size (); i++)
{
- Item *col = unsmob_item (get_property ("currentCommandColumn"));
- last_tuplets_[i]->set_bound (RIGHT, col);
+ Item *col = unsmob_item (get_property ("currentCommandColumn"));
+ last_tuplets_[i]->set_bound (RIGHT, col);
}
}
ADD_ACKNOWLEDGER (Tuplet_engraver, note_column);
ADD_TRANSLATOR (Tuplet_engraver,
- /* doc */
- "Catch tuplet events and generate appropriate bracket.",
-
- /* create */
- "TupletBracket "
- "TupletNumber ",
-
- /* read */
- "tupletFullLength "
- "tupletFullLengthNote ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Catch tuplet events and generate appropriate bracket.",
+
+ /* create */
+ "TupletBracket "
+ "TupletNumber ",
+
+ /* read */
+ "tupletFullLength "
+ "tupletFullLengthNote ",
+
+ /* write */
+ ""
+ );
Tuplet_iterator::create_event (Direction d)
{
SCM ev_scm = scm_call_2 (ly_lily_module_constant ("make-span-event"),
- ly_symbol2scm ("TupletSpanEvent"),
- scm_from_int (d));
+ ly_symbol2scm ("TupletSpanEvent"),
+ scm_from_int (d));
Music *mus = get_music ();
ev->set_property ("numerator", mus->get_property ("numerator"));
ev->set_property ("denominator", mus->get_property ("denominator"));
ev->set_property ("tweaks", mus->get_property ("tweaks"));
- ev->set_property ("length", spanner_duration_.smobbed_copy ());
- }
+ ev->set_property ("length", spanner_duration_.smobbed_copy ());
+ }
synthesized_events_ = scm_cons (ev_scm, synthesized_events_);
return ev;
{
descend_to_bottom_context ();
if (tuplet_handler_.get_outlet ())
- create_event (STOP)->send_to_context (tuplet_handler_.get_outlet ());
+ create_event (STOP)->send_to_context (tuplet_handler_.get_outlet ());
if (m.main_part_ < music_get_length ().main_part_)
- {
- tuplet_handler_.set_context (get_outlet ());
- report_event (create_event (START));
+ {
+ tuplet_handler_.set_context (get_outlet ());
+ report_event (create_event (START));
- next_split_mom_ += spanner_duration_;
- }
+ next_split_mom_ += spanner_duration_;
+ }
else
- tuplet_handler_.set_context (0);
+ tuplet_handler_.set_context (0);
}
Music_wrapper_iterator::process (m);
if (child_iter_ && child_iter_->ok ())
descend_to_child (child_iter_->get_outlet ());
-
+
}
void
DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
DECLARE_GROB_INTERFACE ();
};
-
MAKE_SCHEME_CALLBACK (Tuplet_number, print, 1);
-SCM
+SCM
Tuplet_number::print (SCM smob)
{
Spanner *me = unsmob_spanner (smob);
- Spanner *tuplet = unsmob_spanner (me->get_object ("bracket"));
+ Spanner *tuplet = unsmob_spanner (me->get_object ("bracket"));
if (!tuplet || !tuplet->is_live ())
{
stc->align_to (X_AXIS, CENTER);
stc->align_to (Y_AXIS, CENTER);
- SCM cpoints = tuplet->get_property ("control-points");
+ SCM cpoints = tuplet->get_property ("control-points");
Drul_array<Offset> points;
if (scm_is_pair (cpoints))
{
programming_error ("wrong type for control-points");
}
stc->translate ((points[RIGHT] + points[LEFT]) / 2);
-
+
return stc_scm;
}
}
ADD_INTERFACE (Tuplet_number,
- "The number for a bracket.",
+ "The number for a bracket.",
- /* properties */
- "avoid-slur " // UGH.
- "bracket "
- "direction "
- );
+ /* properties */
+ "avoid-slur " // UGH.
+ "bracket "
+ "direction "
+ );
if (Stream_event *ev = info.event_cause ())
{
for (SCM s = ev->get_property ("tweaks");
- scm_is_pair (s); s = scm_cdr (s))
- {
- info.grob ()->set_property (scm_caar (s), scm_cdar (s));
- }
+ scm_is_pair (s); s = scm_cdr (s))
+ {
+ info.grob ()->set_property (scm_caar (s), scm_cdar (s));
+ }
}
}
ADD_ACKNOWLEDGER (Tweak_engraver, grob);
ADD_TRANSLATOR (Tweak_engraver,
- /* doc */
- "Read the @code{tweaks} property from the originating event,"
- " and set properties.",
-
- /* create */
- "",
+ /* doc */
+ "Read the @code{tweaks} property from the originating event,"
+ " and set properties.",
- /* read */
- "",
+ /* create */
+ "",
- /* write */
- ""
- );
+ /* read */
+ "",
+
+ /* write */
+ ""
+ );
for (int i = 0; i < rep_count; i++)
{
if (unsmob_music (body))
- *tail = scm_cons (body, SCM_EOL);
+ *tail = scm_cons (body, SCM_EOL);
tail = SCM_CDRLOC (*tail);
if (alt_count)
- {
- *tail = scm_cons (scm_car (alts), SCM_EOL);
- tail = SCM_CDRLOC (*tail);
- if (i >= rep_count - alt_count)
+ {
+ *tail = scm_cons (scm_car (alts), SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ if (i >= rep_count - alt_count)
- alts = scm_cdr (alts);
- }
+ alts = scm_cdr (alts);
+ }
}
return l;
private:
static bool
need_extra_horizontal_space (int prev_prefix_set, int prefix_set,
- int context_info, int delta_pitch);
+ int context_info, int delta_pitch);
bool is_stacked_head (int prefix_set,
- int context_info);
+ int context_info);
Real align_heads (vector<Grob_info> primitives,
- Real flexa_width,
- Real thickness);
+ Real flexa_width,
+ Real thickness);
void check_for_prefix_loss (Item *primitive);
void check_for_ambiguous_dot_pitch (Grob_info primitive);
void add_mora_column (Paper_column *column);
protected:
virtual Spanner *create_ligature_spanner ();
virtual void transform_heads (Spanner *ligature,
- vector<Grob_info> primitives);
+ vector<Grob_info> primitives);
DECLARE_TRANSLATOR_LISTENER (pes_or_flexa);
DECLARE_TRANSLATOR_LISTENER (ligature);
};
Vaticana_ligature_engraver::Vaticana_ligature_engraver ()
{
- brew_ligature_primitive_proc =
- Vaticana_ligature::brew_ligature_primitive_proc;
+ brew_ligature_primitive_proc
+ = Vaticana_ligature::brew_ligature_primitive_proc;
augmented_primitives_.clear ();
}
bool
Vaticana_ligature_engraver::is_stacked_head (int prefix_set,
- int context_info)
+ int context_info)
{
bool is_stacked;
*/
bool
Vaticana_ligature_engraver::need_extra_horizontal_space (int prev_prefix_set, int prefix_set,
- int context_info, int delta_pitch)
+ int context_info, int delta_pitch)
{
if (prev_prefix_set & VIRGA)
/*
Real
Vaticana_ligature_engraver::align_heads (vector<Grob_info> primitives,
- Real flexa_width,
- Real thickness)
+ Real flexa_width,
+ Real thickness)
{
if (!primitives.size ())
{
programming_error ("Vaticana_ligature:"
- " empty ligature [ignored]");
+ " empty ligature [ignored]");
return 0.0;
}
{
Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
int prefix_set
- = scm_to_int (primitive->get_property ("prefix-set"));
+ = scm_to_int (primitive->get_property ("prefix-set"));
int context_info
- = scm_to_int (primitive->get_property ("context-info"));
+ = scm_to_int (primitive->get_property ("context-info"));
/*
* Get glyph_name, delta_pitch and context_info for this head.
SCM glyph_name_scm = primitive->get_property ("glyph-name");
if (glyph_name_scm == SCM_EOL)
- {
- primitive->programming_error ("Vaticana_ligature:"
- " undefined glyph-name ->"
- " ignoring grob");
- continue;
- }
+ {
+ primitive->programming_error ("Vaticana_ligature:"
+ " undefined glyph-name ->"
+ " ignoring grob");
+ continue;
+ }
string glyph_name = ly_scm2string (glyph_name_scm);
int delta_pitch = 0;
if (prev_primitive) /* urgh, need prev_primitive only here */
- {
- SCM delta_pitch_scm = prev_primitive->get_property ("delta-position");
- if (delta_pitch_scm != SCM_EOL)
- delta_pitch = scm_to_int (delta_pitch_scm);
- else
- {
- primitive->programming_error ("Vaticana_ligature:"
- " delta-position undefined ->"
- " ignoring grob");
- continue;
- }
- }
+ {
+ SCM delta_pitch_scm = prev_primitive->get_property ("delta-position");
+ if (delta_pitch_scm != SCM_EOL)
+ delta_pitch = scm_to_int (delta_pitch_scm);
+ else
+ {
+ primitive->programming_error ("Vaticana_ligature:"
+ " delta-position undefined ->"
+ " ignoring grob");
+ continue;
+ }
+ }
/*
* Now determine width and x-offset of head.
Real x_offset;
if (context_info & STACKED_HEAD)
- {
- /*
- * This head is stacked upon the previous one; hence, it
- * does not contribute to the total width of the ligature,
- * and its width is assumed to be 0.0. Moreover, it is
- * shifted to the left by its width such that the right side
- * of this and the other head are horizontally aligned.
- */
- head_width = 0.0;
- x_offset = join_thickness
- - Font_interface::get_default_font (primitive)->
- find_by_name ("noteheads.s" + glyph_name).extent (X_AXIS).length ();
- }
+ {
+ /*
+ * This head is stacked upon the previous one; hence, it
+ * does not contribute to the total width of the ligature,
+ * and its width is assumed to be 0.0. Moreover, it is
+ * shifted to the left by its width such that the right side
+ * of this and the other head are horizontally aligned.
+ */
+ head_width = 0.0;
+ x_offset = join_thickness
+ - Font_interface::get_default_font (primitive)->
+ find_by_name ("noteheads.s" + glyph_name).extent (X_AXIS).length ();
+ }
else if (glyph_name == "flexa" || glyph_name == "")
- {
- /*
- * This head represents either half of a flexa shape.
- * Hence, it is assigned half the width of this shape.
- */
- head_width = 0.5 * flexa_width;
- x_offset = 0.0;
- }
+ {
+ /*
+ * This head represents either half of a flexa shape.
+ * Hence, it is assigned half the width of this shape.
+ */
+ head_width = 0.5 * flexa_width;
+ x_offset = 0.0;
+ }
else
- {
- /*
- * This is a regular head, placed right to the previous one.
- * Retrieve its width from corresponding font.
- */
- head_width
- = Font_interface::get_default_font (primitive)->
- find_by_name ("noteheads.s" + glyph_name).extent (X_AXIS).length ();
- x_offset = 0.0;
- }
+ {
+ /*
+ * This is a regular head, placed right to the previous one.
+ * Retrieve its width from corresponding font.
+ */
+ head_width
+ = Font_interface::get_default_font (primitive)->
+ find_by_name ("noteheads.s" + glyph_name).extent (X_AXIS).length ();
+ x_offset = 0.0;
+ }
/*
* Save the head's final x-offset.
*/
primitive->set_property ("x-offset",
- scm_from_double (x_offset));
+ scm_from_double (x_offset));
/*
* If the head is the 2nd head of a pes or flexa (but not a
* neighbour head (i.e. the previous head) by a vertical beam.
*/
if ((context_info & PES_UPPER)
- || ((context_info & FLEXA_RIGHT)
- && ! (context_info & PES_LOWER)))
- {
- if (!prev_primitive)
- {
- primitive->programming_error ("Vaticana ligature: add-join:"
- " missing previous primitive");
- }
- else
- {
- prev_primitive->set_property ("add-join",
- ly_bool2scm (true));
-
- /*
- * Create a small overlap of adjacent heads so that the join
- * can be drawn perfectly between them.
- */
- ligature_width -= join_thickness;
- }
- }
+ || ((context_info & FLEXA_RIGHT)
+ && ! (context_info & PES_LOWER)))
+ {
+ if (!prev_primitive)
+ {
+ primitive->programming_error ("Vaticana ligature: add-join:"
+ " missing previous primitive");
+ }
+ else
+ {
+ prev_primitive->set_property ("add-join",
+ ly_bool2scm (true));
+
+ /*
+ * Create a small overlap of adjacent heads so that the join
+ * can be drawn perfectly between them.
+ */
+ ligature_width -= join_thickness;
+ }
+ }
else if (glyph_name == "")
- {
- /*
- * This is the 2nd (virtual) head of flexa shape. Join it
- * tightly with 1st head, i.e. do *not* add additional
- * space, such that next head will not be off from the flexa
- * shape.
- */
- }
+ {
+ /*
+ * This is the 2nd (virtual) head of flexa shape. Join it
+ * tightly with 1st head, i.e. do *not* add additional
+ * space, such that next head will not be off from the flexa
+ * shape.
+ */
+ }
if (need_extra_horizontal_space (prev_prefix_set, prefix_set,
- context_info, delta_pitch))
- ligature_width += extra_space;
+ context_info, delta_pitch))
+ ligature_width += extra_space;
/*
* Horizontally line-up this head to form a ligature.
{
string prefs = Gregorian_ligature::prefixes_to_str (primitive);
primitive->warning (_f ("ignored prefix(es) `%s' of this head"
- " according to restrictions of the selected"
- " ligature style",
- prefs.c_str ()));
+ " according to restrictions of the selected"
+ " ligature style",
+ prefs.c_str ()));
}
}
if (!column) // empty ligature???
{
augmented_primitives_[0].grob ()->
- programming_error ("no paper column to add dot");
+ programming_error ("no paper column to add dot");
return;
}
Item *dotcol = make_item ("DotColumn", SCM_EOL);
dotcol->set_parent (column, X_AXIS);
for (vsize i = 0; i < augmented_primitives_.size (); i++)
{
- Item *primitive =
- dynamic_cast<Item *> (augmented_primitives_[i].grob ());
+ Item *primitive
+ = dynamic_cast<Item *> (augmented_primitives_[i].grob ());
Item *dot = make_item ("Dots", primitive->self_scm ());
dot->set_property ("dot-count", scm_from_int (1));
dot->set_parent (primitive, Y_AXIS);
Stream_event *cause = augmented_primitives_[i].event_cause ();
int pitch = unsmob_pitch (cause->get_property ("pitch"))->steps ();
if (pitch == new_pitch)
- {
- primitive.grob ()->
- warning ("Ambiguous use of dots in ligature: there are"
- " multiple dotted notes with the same pitch."
- " The ligature should be split.");
- return; // supress multiple identical warnings
- }
+ {
+ primitive.grob ()->
+ warning ("Ambiguous use of dots in ligature: there are"
+ " multiple dotted notes with the same pitch."
+ " The ligature should be split.");
+ return; // supress multiple identical warnings
+ }
}
}
void
Vaticana_ligature_engraver::transform_heads (Spanner *ligature,
- vector<Grob_info> primitives)
+ vector<Grob_info> primitives)
{
Real flexa_width = robust_scm2double (ligature->get_property ("flexa-width"), 2);
int delta_pitch;
SCM delta_pitch_scm = primitive->get_property ("delta-position");
if (delta_pitch_scm != SCM_EOL)
- delta_pitch = scm_to_int (delta_pitch_scm);
+ delta_pitch = scm_to_int (delta_pitch_scm);
else
- {
- primitive->programming_error ("Vaticana_ligature:"
- " delta-position undefined ->"
- " ignoring grob");
- continue;
- }
+ {
+ primitive->programming_error ("Vaticana_ligature:"
+ " delta-position undefined ->"
+ " ignoring grob");
+ continue;
+ }
/* retrieve & complete prefix_set and context_info */
int prefix_set
- = scm_to_int (primitive->get_property ("prefix-set"));
+ = scm_to_int (primitive->get_property ("prefix-set"));
int context_info
- = scm_to_int (primitive->get_property ("context-info"));
+ = scm_to_int (primitive->get_property ("context-info"));
if (Rhythmic_head::dot_count (primitive) > 0)
- // remove dots from primitive and add remember primitive for
- // creating a dot column
- {
- Rhythmic_head::get_dots (primitive)->set_property ("dot-count",
- scm_from_int (0));
- // TODO: Maybe completely remove grob "Dots" (dots->suicide
- // () ?) rather than setting property "dot-count" to 0.
-
- check_for_ambiguous_dot_pitch (primitives[i]);
- augmented_primitives_.push_back (primitives[i]);
- }
+ // remove dots from primitive and add remember primitive for
+ // creating a dot column
+ {
+ Rhythmic_head::get_dots (primitive)->set_property ("dot-count",
+ scm_from_int (0));
+ // TODO: Maybe completely remove grob "Dots" (dots->suicide
+ // () ?) rather than setting property "dot-count" to 0.
+
+ check_for_ambiguous_dot_pitch (primitives[i]);
+ augmented_primitives_.push_back (primitives[i]);
+ }
else if (augmented_primitives_.size () > 0)
- {
- primitive->warning ("This ligature has a dotted head followed by"
- " a non-dotted head. The ligature should be"
- " split after the last dotted head before"
- " this head.");
- }
+ {
+ primitive->warning ("This ligature has a dotted head followed by"
+ " a non-dotted head. The ligature should be"
+ " split after the last dotted head before"
+ " this head.");
+ }
if (is_stacked_head (prefix_set, context_info))
- {
- context_info |= STACKED_HEAD;
- primitive->set_property ("context-info",
- scm_from_int (context_info));
- }
+ {
+ context_info |= STACKED_HEAD;
+ primitive->set_property ("context-info",
+ scm_from_int (context_info));
+ }
/*
* Now determine which head to typeset (this is context sensitive
*/
string glyph_name;
if (prefix_set & VIRGA)
- {
- glyph_name = "vaticana.punctum";
- primitive->set_property ("add-stem", ly_bool2scm (true));
- }
+ {
+ glyph_name = "vaticana.punctum";
+ primitive->set_property ("add-stem", ly_bool2scm (true));
+ }
else if (prefix_set & QUILISMA)
- glyph_name = "vaticana.quilisma";
+ glyph_name = "vaticana.quilisma";
else if (prefix_set & ORISCUS)
- glyph_name = "solesmes.oriscus";
+ glyph_name = "solesmes.oriscus";
else if (prefix_set & STROPHA)
- if (prefix_set & AUCTUM)
- glyph_name = "solesmes.stropha.aucta";
- else glyph_name = "solesmes.stropha";
+ if (prefix_set & AUCTUM)
+ glyph_name = "solesmes.stropha.aucta";
+ else glyph_name = "solesmes.stropha";
else if (prefix_set & INCLINATUM)
- if (prefix_set & AUCTUM)
- glyph_name = "solesmes.incl.auctum";
- else if (prefix_set & DEMINUTUM)
- glyph_name = "solesmes.incl.parvum";
- else
- glyph_name = "vaticana.inclinatum";
+ if (prefix_set & AUCTUM)
+ glyph_name = "solesmes.incl.auctum";
+ else if (prefix_set & DEMINUTUM)
+ glyph_name = "solesmes.incl.parvum";
+ else
+ glyph_name = "vaticana.inclinatum";
else if (prefix_set & DEMINUTUM)
- {
- if (i == 0)
- {
- // initio debilis
- glyph_name = "vaticana.reverse.plica";
- }
- else if (prev_delta_pitch > 0)
- {
- // epiphonus
- if (! (prev_context_info & FLEXA_RIGHT))
- {
- /* correct head of previous primitive */
- if (prev_delta_pitch > 1)
- prev_glyph_name = "vaticana.epiphonus";
- else
- prev_glyph_name = "vaticana.vepiphonus";
- }
- if (prev_delta_pitch > 1)
- glyph_name = "vaticana.plica";
- else
- glyph_name = "vaticana.vplica";
- }
- else if (prev_delta_pitch < 0)
- {
- // cephalicus
- if (! (prev_context_info & FLEXA_RIGHT))
- /* correct head of previous primitive */
- {
- if (i > 1)
- {
- /* cephalicus head with fixed size cauda */
- prev_glyph_name = "vaticana.inner.cephalicus";
- }
- else
- {
- /* cephalicus head without cauda */
- prev_glyph_name = "vaticana.cephalicus";
- }
-
- /*
- * Flexa has no variable size cauda if its left head is
- * stacked on the right head. This is true for
- * cephalicus. Hence, remove the cauda.
- *
- * Urgh: for the current implementation, this rule only
- * applies for cephalicus; but it is a fundamental rule.
- * Therefore, the following line of code should be
- * placed somewhere else.
- */
- prev_primitive->set_property ("add-cauda",
- ly_bool2scm (false));
- }
- if (prev_delta_pitch < - 1)
- glyph_name = "vaticana.reverse.plica";
- else
- glyph_name = "vaticana.reverse.vplica";
- }
- else // (prev_delta_pitch == 0)
- {
- primitive->programming_error ("Vaticana_ligature:"
- " deminutum head must have different"
- " pitch -> ignoring grob");
- }
- }
+ {
+ if (i == 0)
+ {
+ // initio debilis
+ glyph_name = "vaticana.reverse.plica";
+ }
+ else if (prev_delta_pitch > 0)
+ {
+ // epiphonus
+ if (! (prev_context_info & FLEXA_RIGHT))
+ {
+ /* correct head of previous primitive */
+ if (prev_delta_pitch > 1)
+ prev_glyph_name = "vaticana.epiphonus";
+ else
+ prev_glyph_name = "vaticana.vepiphonus";
+ }
+ if (prev_delta_pitch > 1)
+ glyph_name = "vaticana.plica";
+ else
+ glyph_name = "vaticana.vplica";
+ }
+ else if (prev_delta_pitch < 0)
+ {
+ // cephalicus
+ if (! (prev_context_info & FLEXA_RIGHT))
+ /* correct head of previous primitive */
+ {
+ if (i > 1)
+ {
+ /* cephalicus head with fixed size cauda */
+ prev_glyph_name = "vaticana.inner.cephalicus";
+ }
+ else
+ {
+ /* cephalicus head without cauda */
+ prev_glyph_name = "vaticana.cephalicus";
+ }
+
+ /*
+ * Flexa has no variable size cauda if its left head is
+ * stacked on the right head. This is true for
+ * cephalicus. Hence, remove the cauda.
+ *
+ * Urgh: for the current implementation, this rule only
+ * applies for cephalicus; but it is a fundamental rule.
+ * Therefore, the following line of code should be
+ * placed somewhere else.
+ */
+ prev_primitive->set_property ("add-cauda",
+ ly_bool2scm (false));
+ }
+ if (prev_delta_pitch < - 1)
+ glyph_name = "vaticana.reverse.plica";
+ else
+ glyph_name = "vaticana.reverse.vplica";
+ }
+ else // (prev_delta_pitch == 0)
+ {
+ primitive->programming_error ("Vaticana_ligature:"
+ " deminutum head must have different"
+ " pitch -> ignoring grob");
+ }
+ }
else if (prefix_set & (CAVUM | LINEA))
- if ((prefix_set & CAVUM) && (prefix_set & LINEA))
- glyph_name = "vaticana.linea.punctum.cavum";
- else if (prefix_set & CAVUM)
- glyph_name = "vaticana.punctum.cavum";
- else
- glyph_name = "vaticana.linea.punctum";
+ if ((prefix_set & CAVUM) && (prefix_set & LINEA))
+ glyph_name = "vaticana.linea.punctum.cavum";
+ else if (prefix_set & CAVUM)
+ glyph_name = "vaticana.punctum.cavum";
+ else
+ glyph_name = "vaticana.linea.punctum";
else if (prefix_set & AUCTUM)
- if (prefix_set & ASCENDENS)
- glyph_name = "solesmes.auct.asc";
- else
- glyph_name = "solesmes.auct.desc";
+ if (prefix_set & ASCENDENS)
+ glyph_name = "solesmes.auct.asc";
+ else
+ glyph_name = "solesmes.auct.desc";
else if ((context_info & STACKED_HEAD)
- && (context_info & PES_UPPER))
- if (prev_delta_pitch > 1)
- glyph_name = "vaticana.upes";
- else
- glyph_name = "vaticana.vupes";
+ && (context_info & PES_UPPER))
+ if (prev_delta_pitch > 1)
+ glyph_name = "vaticana.upes";
+ else
+ glyph_name = "vaticana.vupes";
else
- glyph_name = "vaticana.punctum";
+ glyph_name = "vaticana.punctum";
/*
* This head needs a cauda, if it starts a flexa, is not the upper
* head of a pes, and if it is a punctum.
*/
if ((context_info & FLEXA_LEFT) && ! (context_info & PES_UPPER))
- if (glyph_name == "vaticana.punctum")
- primitive->set_property ("add-cauda", ly_bool2scm (true));
+ if (glyph_name == "vaticana.punctum")
+ primitive->set_property ("add-cauda", ly_bool2scm (true));
/*
* Execptional rule for porrectus:
* the previous head into a single curved flexa shape.
*/
if ((context_info & FLEXA_RIGHT) && (context_info & PES_LOWER))
- {
- check_for_prefix_loss (prev_primitive);
- prev_glyph_name = "flexa";
- prev_primitive->set_property ("flexa-height",
- scm_from_int (prev_delta_pitch));
- prev_primitive->set_property ("flexa-width",
- scm_from_double (flexa_width));
- bool add_cauda = !(prev_prefix_set && PES_OR_FLEXA);
- prev_primitive->set_property ("add-cauda",
- ly_bool2scm (add_cauda));
- check_for_prefix_loss (primitive);
- glyph_name = "";
- primitive->set_property ("flexa-width",
- scm_from_double (flexa_width));
- }
+ {
+ check_for_prefix_loss (prev_primitive);
+ prev_glyph_name = "flexa";
+ prev_primitive->set_property ("flexa-height",
+ scm_from_int (prev_delta_pitch));
+ prev_primitive->set_property ("flexa-width",
+ scm_from_double (flexa_width));
+ bool add_cauda = !(prev_prefix_set && PES_OR_FLEXA);
+ prev_primitive->set_property ("add-cauda",
+ ly_bool2scm (add_cauda));
+ check_for_prefix_loss (primitive);
+ glyph_name = "";
+ primitive->set_property ("flexa-width",
+ scm_from_double (flexa_width));
+ }
/*
* Exceptional rule for pes:
* current head.
*/
if (prefix_set & PES_OR_FLEXA)
- {
- if ((context_info & PES_UPPER) && (context_info & STACKED_HEAD))
- {
- if (prev_glyph_name == "vaticana.punctum")
- {
- if (prev_delta_pitch > 1)
- prev_glyph_name = "vaticana.lpes";
- else
- prev_glyph_name = "vaticana.vlpes";
- }
- }
- }
+ {
+ if ((context_info & PES_UPPER) && (context_info & STACKED_HEAD))
+ {
+ if (prev_glyph_name == "vaticana.punctum")
+ {
+ if (prev_delta_pitch > 1)
+ prev_glyph_name = "vaticana.lpes";
+ else
+ prev_glyph_name = "vaticana.vlpes";
+ }
+ }
+ }
if (prev_primitive)
- prev_primitive->set_property ("glyph-name",
- ly_string2scm (prev_glyph_name));
+ prev_primitive->set_property ("glyph-name",
+ ly_string2scm (prev_glyph_name));
/*
* In the backend, flexa shapes and joins need to know about line
}
prev_primitive->set_property ("glyph-name",
- ly_string2scm (prev_glyph_name));
+ ly_string2scm (prev_glyph_name));
align_heads (primitives, flexa_width, thickness);
Item *first_primitive = dynamic_cast<Item *> (primitives[0].grob ());
Paper_column *paper_column = first_primitive->get_column ();
paper_column->warning (_f ("Vaticana_ligature_engraver:"
- " setting `spacing-increment = %f': ptr =%ul",
- ligature_width, paper_column));
+ " setting `spacing-increment = %f': ptr =%ul",
+ ligature_width, paper_column));
paper_column->
- set_property ("forced-spacing", scm_from_double (ligature_width));
+ set_property ("forced-spacing", scm_from_double (ligature_width));
#endif
}
ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, rest);
ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, ligature_head);
ADD_TRANSLATOR (Vaticana_ligature_engraver,
- /* doc */
- "Handle ligatures by glueing special ligature heads"
- " together.",
+ /* doc */
+ "Handle ligatures by glueing special ligature heads"
+ " together.",
- /* create */
- "VaticanaLigature "
- "DotColumn ",
+ /* create */
+ "VaticanaLigature "
+ "DotColumn ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Stencil
vaticana_brew_cauda (Grob *me,
- int pos,
- int delta_pitch,
- Real thickness,
- Real blotdiameter)
+ int pos,
+ int delta_pitch,
+ Real thickness,
+ Real blotdiameter)
{
bool on_staffline = Staff_symbol_referencer::on_line (me, pos);
int interspaces = Staff_symbol_referencer::line_count (me) - 1;
if (on_staffline)
{
if (delta_pitch >= -1)
- length = 1.30;
+ length = 1.30;
else if (delta_pitch >= -2)
- length = 1.35;
+ length = 1.35;
else
- length = 1.85;
+ length = 1.85;
}
else
{
if (delta_pitch >= -1)
- if (above_staff)
- length = 1.30;
- else
- length = 1.00;
+ if (above_staff)
+ length = 1.30;
+ else
+ length = 1.00;
else if (delta_pitch >= -2)
- length = 1.35;
+ length = 1.35;
else if (delta_pitch >= -3)
- length = 1.50;
+ length = 1.50;
else
- length = 1.85;
+ length = 1.85;
}
Box cauda_box (Interval (0, thickness), Interval (-length, 0));
return Lookup::round_filled_box (cauda_box, blotdiameter);
*/
Stencil
vaticana_brew_flexa (Grob *me,
- bool solid,
- Real line_thickness)
+ bool solid,
+ Real line_thickness)
{
Real staff_space = Staff_symbol_referencer::staff_space (me);
Stencil stencil;
else
{
me->warning ("Vaticana_ligature: "
- + _ ("flexa-height undefined; assuming 0"));
+ + _ ("flexa-height undefined; assuming 0"));
interval = 0.0;
}
*/
Real left_height
= right_height
- + min (0.12 * abs (interval), 0.3) * staff_space;
+ + min (0.12 * abs (interval), 0.3) * staff_space;
/*
* Compensate optical illusion regarding vertical position of left
if (solid)
{
Stencil solid_head
- = Lookup::bezier_sandwich (top_curve, bottom_curve, 0.0);
+ = Lookup::bezier_sandwich (top_curve, bottom_curve, 0.0);
stencil.add_stencil (solid_head);
}
else // outline
Bezier inner_top_curve = top_curve;
inner_top_curve.translate (Offset (0.0, -line_thickness));
Stencil top_edge
- = Lookup::bezier_sandwich (top_curve, inner_top_curve, 0.0);
+ = Lookup::bezier_sandwich (top_curve, inner_top_curve, 0.0);
stencil.add_stencil (top_edge);
Bezier inner_bottom_curve = bottom_curve;
inner_bottom_curve.translate (Offset (0.0, +line_thickness));
Stencil bottom_edge
- = Lookup::bezier_sandwich (bottom_curve, inner_bottom_curve, 0.0);
+ = Lookup::bezier_sandwich (bottom_curve, inner_bottom_curve, 0.0);
stencil.add_stencil (bottom_edge);
/*
* the left end of the bezier curve.
*/
Box left_edge_box (Interval (0, line_thickness),
- Interval (-0.5 * left_height, +0.5 * left_height));
+ Interval (-0.5 * left_height, +0.5 * left_height));
Stencil left_edge = Lookup::filled_box (left_edge_box);
stencil.add_stencil (left_edge);
Box right_edge_box (Interval (-line_thickness, 0),
- Interval (-0.5 * right_height, +0.5 * right_height));
+ Interval (-0.5 * right_height, +0.5 * right_height));
Stencil right_edge = Lookup::filled_box (right_edge_box);
right_edge.translate_axis (width, X_AXIS);
right_edge.translate_axis (corrected_interval / 2.0, Y_AXIS);
Stencil
vaticana_brew_join (Grob *me, int delta_pitch,
- Real join_thickness, Real blotdiameter)
+ Real join_thickness, Real blotdiameter)
{
Real staff_space = Staff_symbol_referencer::staff_space (me);
if (!delta_pitch)
{
me->programming_error (_ ("Vaticana_ligature: "
- "zero join (delta_pitch == 0)"));
+ "zero join (delta_pitch == 0)"));
return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
}
Interval x_extent = Interval (0, join_thickness);
Interval y_extent = (delta_pitch > 0)
- ? Interval (0, delta_pitch * 0.5 * staff_space) : // ascending join
- Interval (delta_pitch * 0.5 * staff_space, 0); // descending join
+ ? Interval (0, delta_pitch * 0.5 * staff_space) : // ascending join
+ Interval (delta_pitch * 0.5 * staff_space, 0); // descending join
Box join_box (x_extent, y_extent);
return Lookup::round_filled_box (join_box, blotdiameter);
}
if (glyph_name_scm == SCM_EOL)
{
me->programming_error ("Vaticana_ligature: "
- "undefined glyph-name -> ignoring grob");
+ "undefined glyph-name -> ignoring grob");
return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
}
Real staff_space = Staff_symbol_referencer::staff_space (me);
Real flexa_width = robust_scm2double (me->get_property ("flexa-width"), 2) * staff_space;
out
- = Lookup::blank (Box (Interval (0, 0.5 * flexa_width), Interval (0, 0)));
+ = Lookup::blank (Box (Interval (0, 0.5 * flexa_width), Interval (0, 0)));
}
else if (glyph_name == "flexa")
out = vaticana_brew_flexa (me, true, line_thickness);
else
{
out
- = Font_interface::get_default_font (me)->
- find_by_name ("noteheads.s" + glyph_name);
+ = Font_interface::get_default_font (me)->
+ find_by_name ("noteheads.s" + glyph_name);
}
out.translate_axis (x_offset, X_AXIS);
Real head_width = out.extent (X_AXIS).length ();
if (add_cauda)
{
Stencil cauda
- = vaticana_brew_cauda (me, pos, delta_pitch,
- line_thickness, blotdiameter);
+ = vaticana_brew_cauda (me, pos, delta_pitch,
+ line_thickness, blotdiameter);
out.add_stencil (cauda);
}
if (add_stem)
{
Stencil stem
- = vaticana_brew_cauda (me, pos, -1,
- line_thickness, blotdiameter);
+ = vaticana_brew_cauda (me, pos, -1,
+ line_thickness, blotdiameter);
stem.translate_axis (head_width - line_thickness, X_AXIS);
out.add_stencil (stem);
}
if (add_join)
{
Stencil join
- = vaticana_brew_join (me, delta_pitch, line_thickness, blotdiameter);
+ = vaticana_brew_join (me, delta_pitch, line_thickness, blotdiameter);
join.translate_axis (head_width - line_thickness, X_AXIS);
out.add_stencil (join);
}
}
ADD_INTERFACE (Vaticana_ligature,
- "A vaticana style Gregorian ligature.",
-
- /* properties */
- "glyph-name "
- "flexa-height "
- "flexa-width "
- "thickness "
- "add-cauda "
- "add-stem "
- "add-join "
- "delta-position "
- "x-offset "
- );
+ "A vaticana style Gregorian ligature.",
+
+ /* properties */
+ "glyph-name "
+ "flexa-height "
+ "flexa-width "
+ "thickness "
+ "add-cauda "
+ "add-stem "
+ "add-join "
+ "delta-position "
+ "x-offset "
+ );
ADD_ACKNOWLEDGER (Vertical_align_engraver, axis_group);
ADD_TRANSLATOR (Vertical_align_engraver,
- /* doc */
- "Catch groups (staves, lyrics lines, etc.) and stack them"
- " vertically.",
+ /* doc */
+ "Catch groups (staves, lyrics lines, etc.) and stack them"
+ " vertically.",
- /* create */
- "VerticalAlignment ",
+ /* create */
+ "VerticalAlignment ",
- /* read */
- "alignAboveContext "
- "alignBelowContext ",
+ /* read */
+ "alignAboveContext "
+ "alignBelowContext ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Vertical_align_engraver::Vertical_align_engraver ()
{
int sz = i.origin_contexts ((Translator *)this).size ();
return sz > 0 && Axis_group_interface::has_interface (i.grob ())
- && !i.grob ()->get_parent (Y_AXIS)
- && !to_boolean (i.grob ()->get_property ("no-alignment"))
- && Axis_group_interface::has_axis (i.grob (), Y_AXIS);
+ && !i.grob ()->get_parent (Y_AXIS)
+ && !to_boolean (i.grob ()->get_property ("no-alignment"))
+ && Axis_group_interface::has_axis (i.grob (), Y_AXIS);
}
void
string id = i.context ()->id_string ();
scm_hash_set_x (id_to_group_hashtab_, ly_string2scm (id),
- i.grob ()->self_scm ());
+ i.grob ()->self_scm ());
SCM before_id = i.context ()->get_property ("alignAboveContext");
SCM after_id = i.context ()->get_property ("alignBelowContext");
Grob *after_grob = unsmob_grob (after);
Align_interface::add_element (valign_, i.grob ());
-
+
if (before_grob || after_grob)
- {
- Grob_array *ga = unsmob_grob_array (valign_->get_object ("elements"));
- vector<Grob*> &arr = ga->array_reference ();
-
- Grob *added = arr.back ();
- arr.pop_back ();
- for (vsize i = 0; i < arr.size (); i++)
- {
- if (arr[i] == before_grob)
- {
- arr.insert (arr.begin () + i, added);
-
- /* Only set staff affinity if it already has one. That way we won't
- set staff-affinity on things that don't want it (like staves). */
- if (scm_is_number (added->get_property ("staff-affinity")))
- added->set_property ("staff-affinity", scm_from_int (DOWN));
- break;
- }
- else if (arr[i] == after_grob)
- {
- arr.insert (arr.begin () + i + 1, added);
- if (scm_is_number (added->get_property ("staff-affinity")))
- added->set_property ("staff-affinity", scm_from_int (UP));
- break;
- }
- }
- }
+ {
+ Grob_array *ga = unsmob_grob_array (valign_->get_object ("elements"));
+ vector<Grob *> &arr = ga->array_reference ();
+
+ Grob *added = arr.back ();
+ arr.pop_back ();
+ for (vsize i = 0; i < arr.size (); i++)
+ {
+ if (arr[i] == before_grob)
+ {
+ arr.insert (arr.begin () + i, added);
+
+ /* Only set staff affinity if it already has one. That way we won't
+ set staff-affinity on things that don't want it (like staves). */
+ if (scm_is_number (added->get_property ("staff-affinity")))
+ added->set_property ("staff-affinity", scm_from_int (DOWN));
+ break;
+ }
+ else if (arr[i] == after_grob)
+ {
+ arr.insert (arr.begin () + i + 1, added);
+ if (scm_is_number (added->get_property ("staff-affinity")))
+ added->set_property ("staff-affinity", scm_from_int (UP));
+ break;
+ }
+ }
+ }
}
else if (qualifies (i))
{
Pointer_group_interface::add_grob (valign_, ly_symbol2scm ("elements"), i.grob ());
if (!unsmob_grob (i.grob ()->get_object ("staff-grouper")))
- i.grob ()->set_object ("staff-grouper", valign_->self_scm ());
+ i.grob ()->set_object ("staff-grouper", valign_->self_scm ());
}
}
Spanner *me = unsmob_spanner (smob);
Spanner *orig_span = dynamic_cast<Spanner *> (me->original ());
bool broken_first_bracket = orig_span && (orig_span->broken_intos_[0]
- == (Spanner *)me);
-
+ == (Spanner *)me);
+
Output_def *layout = me->layout ();
Real half_space = 0.5;
{
Paper_column *pc = bound->get_column ();
left = pc->break_align_width (pc, ly_symbol2scm ("break-alignment"))[RIGHT]
- // For some reason, break_align_width is relative to
- // the x-parent of the column.
- - bound->relative_coordinate (pc->get_parent (X_AXIS), X_AXIS);
+ // For some reason, break_align_width is relative to
+ // the x-parent of the column.
+ - bound->relative_coordinate (pc->get_parent (X_AXIS), X_AXIS);
}
else
{
/*
- the volta spanner is attached to the bar-line, which is moved
- to the right. We don't need to compensate for the left edge.
+ the volta spanner is attached to the bar-line, which is moved
+ to the right. We don't need to compensate for the left edge.
*/
}
modify_edge_height (me);
if (!me->is_live ())
return SCM_EOL;
-
+
Drul_array<Real> edge_height = robust_scm2interval (me->get_property ("edge-height"),
- Interval (1.0, 1.0));
+ Interval (1.0, 1.0));
Drul_array<Real> flare = robust_scm2interval (me->get_property ("bracket-flare"),
- Interval (0, 0));
+ Interval (0, 0));
Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"),
- Interval (0, 0));
+ Interval (0, 0));
-
-
scale_drul (&edge_height, - Real (get_grob_direction (me)));
Interval empty;
Offset start;
start[X_AXIS] = me->spanner_length () - left - half_space;
-
+
/*
- ugh, Tuplet_bracket should use Horizontal_bracket, not the other way around.
+ ugh, Tuplet_bracket should use Horizontal_bracket, not the other way around.
*/
Stencil total
- = Tuplet_bracket::make_bracket (me, Y_AXIS, start,
- edge_height, empty, flare, shorten);
+ = Tuplet_bracket::make_bracket (me, Y_AXIS, start,
+ edge_height, empty, flare, shorten);
if (!orig_span || broken_first_bracket)
{
SCM text = me->get_property ("text");
SCM properties = me->get_property_alist_chain (SCM_EOL);
SCM snum = Text_interface::interpret_markup (layout->self_scm (),
- properties, text);
+ properties, text);
Stencil num = *unsmob_stencil (snum);
num.align_to (Y_AXIS, UP);
num.translate_axis (-0.5, Y_AXIS);
total.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length ()
- - 1.0);
+ - 1.0);
}
-
+
total.translate_axis (left, X_AXIS);
return total.smobbed_copy ();
}
-
void
Volta_bracket_interface::modify_edge_height (Spanner *me)
{
Spanner *orig_span = dynamic_cast<Spanner *> (me->original ());
-
+
bool broken_first_bracket = orig_span && (orig_span->broken_intos_[0] == (Spanner *)me);
bool broken_last_bracket = orig_span && (orig_span->broken_intos_.back () == (Spanner *)me);
bool no_vertical_start = orig_span && !broken_first_bracket;
str = "|";
no_vertical_end
- |= (str != ":|"
- && str != "|:"
- && str != "|."
- && str != ":|:"
- && str != ":|.|:"
- && str != ":|.:"
- && str != ".|");
+ |= (str != ":|"
+ && str != "|:"
+ && str != "|."
+ && str != ":|:"
+ && str != ":|.|:"
+ && str != ":|.:"
+ && str != ".|");
if (no_vertical_end || no_vertical_start)
{
Drul_array<Real> edge_height = robust_scm2interval (me->get_property ("edge-height"),
- Interval (1.0, 1.0));
+ Interval (1.0, 1.0));
if (no_vertical_start)
- edge_height[LEFT] = 0.0;
+ edge_height[LEFT] = 0.0;
if (no_vertical_end)
- edge_height[RIGHT] = 0.0;
+ edge_height[RIGHT] = 0.0;
me->set_property ("edge-height", ly_interval2scm (edge_height));
}
}
ADD_INTERFACE (Volta_bracket_interface,
- "Volta bracket with number.",
+ "Volta bracket with number.",
- /* properties */
- "bars "
- "thickness "
- "height "
- );
+ /* properties */
+ "bars "
+ "thickness "
+ "height "
+ );
SCM c = scm_car (cs);
if (scm_is_pair (c)
- && scm_car (c) == ly_symbol2scm ("volta")
- && scm_is_pair (scm_cdr (c)))
- {
- if (scm_cadr (c) == SCM_BOOL_F)
- end = true;
- else
- start_string_ = scm_cadr (c);
- }
+ && scm_car (c) == ly_symbol2scm ("volta")
+ && scm_is_pair (scm_cdr (c)))
+ {
+ if (scm_cadr (c) == SCM_BOOL_F)
+ end = true;
+ else
+ start_string_ = scm_cadr (c);
+ }
cs = scm_cdr (cs);
}
Moment now = now_mom ();
bool early_stop = unsmob_moment (l)
- && *unsmob_moment (l) <= now - started_mom_;
+ && *unsmob_moment (l) <= now - started_mom_;
end = end || early_stop;
}
warning (_ ("already have a volta spanner, ending that one prematurely"));
if (end_volta_bracket_)
- {
- warning (_ ("also already have an ended spanner"));
- warning (_ ("giving up"));
- return;
- }
+ {
+ warning (_ ("also already have an ended spanner"));
+ warning (_ ("giving up"));
+ return;
+ }
end_volta_bracket_ = volta_bracket_;
volta_bracket_ = 0;
volta_bracket_->set_property ("text", start_string_);
if (!volta_spanner_)
- volta_spanner_ = make_spanner ("VoltaBracketSpanner", SCM_EOL);
+ volta_spanner_ = make_spanner ("VoltaBracketSpanner", SCM_EOL);
Axis_group_interface::add_element (volta_spanner_, volta_bracket_);
}
if (end_volta_bracket_ && !volta_bracket_)
{
for (SCM s = get_property ("stavesFound"); scm_is_pair (s); s = scm_cdr (s))
- Side_position_interface::add_support (volta_spanner_, unsmob_grob (scm_car (s)));
+ Side_position_interface::add_support (volta_spanner_, unsmob_grob (scm_car (s)));
volta_spanner_ = 0;
}
*/
ADD_ACKNOWLEDGER (Volta_engraver, bar_line);
ADD_TRANSLATOR (Volta_engraver,
- /* doc */
- "Make volta brackets.",
+ /* doc */
+ "Make volta brackets.",
- /* create */
- "VoltaBracket "
- "VoltaBracketSpanner ",
+ /* create */
+ "VoltaBracket "
+ "VoltaBracketSpanner ",
- /* read */
- "repeatCommands "
- "voltaSpannerDuration "
- "stavesFound ",
+ /* read */
+ "repeatCommands "
+ "voltaSpannerDuration "
+ "stavesFound ",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );
Volta_repeat_iterator::get_music_list ()const
{
return scm_cons (get_music ()->get_property ("element"),
- get_music ()->get_property ("elements"));
+ get_music ()->get_property ("elements"));
}
void
Context *where = get_outlet ()->where_defined (reps, ¤t_reps);
if (where
- && (current_reps == SCM_EOL || scm_is_pair (current_reps)))
+ && (current_reps == SCM_EOL || scm_is_pair (current_reps)))
{
current_reps = scm_cons (what, current_reps);
where->set_property (reps, current_reps);
if (side_effect)
{
if (alt_count_)
- {
- string repstr = to_string (rep_count_ - alt_count_ + done_count_) + ".";
- if (done_count_ > 1)
- {
- add_repeat_command (scm_list_n (ly_symbol2scm ("volta"), SCM_BOOL_F, SCM_UNDEFINED));
-
- if (done_count_ - 1 < alt_count_)
- add_repeat_command (ly_symbol2scm ("end-repeat"));
- }
-
- if (done_count_ == 1 && alt_count_ < rep_count_)
- repstr = "1.--" + to_string (rep_count_ - alt_count_ + done_count_) + ".";
-
- if (done_count_ <= alt_count_)
- add_repeat_command (scm_list_n (ly_symbol2scm ("volta"),
- ly_string2scm (repstr), SCM_UNDEFINED));
- }
+ {
+ string repstr = to_string (rep_count_ - alt_count_ + done_count_) + ".";
+ if (done_count_ > 1)
+ {
+ add_repeat_command (scm_list_n (ly_symbol2scm ("volta"), SCM_BOOL_F, SCM_UNDEFINED));
+
+ if (done_count_ - 1 < alt_count_)
+ add_repeat_command (ly_symbol2scm ("end-repeat"));
+ }
+
+ if (done_count_ == 1 && alt_count_ < rep_count_)
+ repstr = "1.--" + to_string (rep_count_ - alt_count_ + done_count_) + ".";
+
+ if (done_count_ <= alt_count_)
+ add_repeat_command (scm_list_n (ly_symbol2scm ("volta"),
+ ly_string2scm (repstr), SCM_UNDEFINED));
+ }
else
- add_repeat_command (ly_symbol2scm ("end-repeat"));
+ add_repeat_command (ly_symbol2scm ("end-repeat"));
}
}
\remove "Hara_kiri_engraver"
\consists "Hara_kiri_engraver"
\override VerticalAxisGroup #'remove-empty = ##t
+ \description "Remove staves which are considered to be empty according
+to the list of interfaces set by @code{keepAliveInterfaces}."
}
auto-numbering must be turned on in the paper block. Otherwise, no
number will appear. Use like @code{\\once})")
#{
- \footnoteGrob $grob-name $offset \markup { "" } $footnote
+ \footnoteGrob $grob-name $offset \markup { \null } $footnote
#})
footnote =
(make-music 'FootnoteEvent
'X-offset (car offset)
'Y-offset (cdr offset)
- 'text (markup "")
+ 'text (make-null-markup)
'footnote-text footnote))
grace =
$(TEXI_FILES:%.texi=%)
TOPDIR_HTML_MANUALS =
-SPLITTED_HTML_MANUALS = $(foreach manual, $(TEXINFO_MANUALS),\
- $(if $(findstring $(manual), $(UNSPLITTED_HTML_MANUALS)),,$(manual)))
-NOT_TOPDIR_HTML_MANUALS = $(foreach manual, $(SPLITTED_HTML_MANUALS),\
+SPLIT_HTML_MANUALS = $(foreach manual, $(TEXINFO_MANUALS),\
+ $(if $(findstring $(manual), $(UNSPLIT_HTML_MANUALS)),,$(manual)))
+NOT_TOPDIR_HTML_MANUALS = $(foreach manual, $(SPLIT_HTML_MANUALS),\
$(if $(findstring $(manual), $(TOPDIR_HTML_MANUALS)),,$(manual)))
-OUT_HTML_FILES += $(UNSPLITTED_HTML_MANUALS:%=$(top-build-dir)/Documentation/$(outdir)/%.$(ISOLANG).html) \
+OUT_HTML_FILES += $(UNSPLIT_HTML_MANUALS:%=$(top-build-dir)/Documentation/$(outdir)/%.$(ISOLANG).html) \
$(TOPDIR_HTML_MANUALS:%=$(outdir)/index.$(ISOLANG).html)
-BIG_PAGE_HTML_FILES := $(SPLITTED_HTML_MANUALS:%=$(top-build-dir)/Documentation/$(outdir)/%-big-page.$(ISOLANG).html)
+BIG_PAGE_HTML_FILES := $(SPLIT_HTML_MANUALS:%=$(top-build-dir)/Documentation/$(outdir)/%-big-page.$(ISOLANG).html)
DEEP_HTML_FILES := $(NOT_TOPDIR_HTML_MANUALS:%=$(top-build-dir)/Documentation/$(outdir)/%/index.$(ISOLANG).html)
PDF_FILES := $(TELY_FILES:%.tely=$(top-build-dir)/Documentation/$(outdir)/%.$(ISOLANG).pdf)
fi;
-%
-% dimensions aren't entirely right.
-%
-def draw_brevis (expr linecount) =
+def draw_brevis (expr linecount, line_thickness_multiplier) =
save stemthick, fudge;
- stemthick# = 2 stafflinethickness#;
+ stemthick# = line_thickness_multiplier * 2 * stafflinethickness#;
define_whole_blacker_pixels (stemthick);
- fudge = hround (blot_diameter / 2);
+ % Breves of smaller design sizes should have their lines
+ % farther apart (the overlap should be smaller).
+ fudge = hround (blot_diameter
+ * min (max (-0.15,
+ (0.8
+ - (20 / (design_size + 4))
+ + .1 linecount)),
+ 0.3));
draw_outside_ellipse (1.80, 0, 0.707, 0);
undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
pickup pencircle scaled stemthick;
- bot y1 = -d;
- top y2 = h;
+ % Breves of smaller design sizes should have their lines longer.
+ line_length := min (max (0.7, (64/60 - (design_size / 60))), 0.85);
+
+ % Line lengths between 0.72 and 0.77 are not nice
+ % because they are neither separate nor connected
+ % when there is an interval of fourth.
+ if line_length < 0.75:
+ quanted_line_length := min (0.72, line_length);
+ else:
+ quanted_line_length := max (0.77, line_length);
+ fi;
+
+ bot y1 = -quanted_line_length * staff_space;
+ top y2 = quanted_line_length * staff_space;
rt x1 - fudge = 0;
x1 = x2;
y4 = y2;
y3 = y1;
+ % Breves of smaller design sizes should have their lines
+ % farther apart.
+ line_distance := (1.95 - 0.008 * design_size) * stemthick;
for i := 0 step 1 until linecount - 1:
- draw_gridline (z1 - (1.5 * i * stemthick, 0),
- z2 - (1.5 * i * stemthick, 0), stemthick);
- draw_gridline (z3 + (1.5 * i * stemthick, 0),
- z4 + (1.5 * i * stemthick, 0), stemthick);
+ draw_gridline (z1 - (i * line_distance, 0),
+ z2 - (i * line_distance, 0),
+ stemthick);
+ draw_gridline (z3 + (i * line_distance, 0),
+ z4 + (i * line_distance, 0),
+ stemthick);
endfor;
enddef;
fet_beginchar ("Brevis notehead", "sM1");
- draw_brevis (1);
+ draw_brevis (1, 1);
draw_staff (-2, 2, 0);
fet_endchar;
if test > 0:
fet_beginchar ("Brevis notehead", "sM1");
- draw_brevis(1);
+ draw_brevis(1, 1);
draw_staff (-2, 2, 0.5);
fet_endchar;
fet_beginchar ("Double-lined brevis notehead", "sM1double");
- draw_brevis (2);
+ draw_brevis (2, 0.8);
draw_staff (-2, 2, 0);
fet_endchar;
if test > 0:
fet_beginchar ("Double-lined brevis notehead", "sM1double");
- draw_brevis (2);
+ draw_brevis (2, 0.8);
draw_staff (-2, 2, 0.5);
fet_endchar;
#
msgid ""
msgstr ""
-"Project-Id-Version: lilypond 2.13.53\n"
+"Project-Id-Version: lilypond 2.15.9\n"
"Report-Msgid-Bugs-To: http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs\n"
-"POT-Creation-Date: 2011-03-02 10:34+0100\n"
-"PO-Revision-Date: 2011-04-06 19:38+0200\n"
+"POT-Creation-Date: 2011-08-02 19:43+0200\n"
+"PO-Revision-Date: 2011-08-03 23:06+0200\n"
"Last-Translator: Jean-Charles Malahieude <lilyfan@orange.fr>\n"
"Language-Team: French <traduc@traduc.org>\n"
"Language: fr\n"
msgid "%s has been replaced by %s"
msgstr "%s a été remplacé par %s"
-#: convertrules.py:24 lilylib.py:78 musicexp.py:17 convert-ly.py:64 warn.cc:66
-#: input.cc:109
+#: convertrules.py:24 lilylib.py:85 musicexp.py:17 convert-ly.py:64 warn.cc:66
+#: input.cc:108
#, c-format, python-format
msgid "warning: %s"
msgstr "Avertissement : %s"
#: convertrules.py:86 convertrules.py:1905 convertrules.py:2084
#: convertrules.py:2236 convertrules.py:2566 convertrules.py:2862
+#: convertrules.py:3206
msgid "bump version for release"
msgstr "sauter de version pour mise à jour"
#: convertrules.py:1349
msgid "attempting automatic \\figures conversion. Check results!"
msgstr ""
-"tentative de convesion automatique des \\figures. \n"
+"tentative de conversion automatique des \\figures. \n"
"Résultats à vérifier !"
#: convertrules.py:1400
msgid "woodwind-diagrams. Clarinet fingering changed to reflect actual anatomy of instrument.\n"
msgstr "Diagrammes pour vents : doigtés plus adaptés à la clarinette actuelle.\n"
+#: convertrules.py:3211
+msgid "Change in internal property for MultiMeasureRest"
+msgstr "MultiMeasureRest : modification des propriétés internes."
+
+#: convertrules.py:3214
+msgid "use-breve-rest. This internal property has been replaced by round-to-longer-rest and usable-duration-logs.\n"
+msgstr ""
+"use-breve-rest : cette propriété interne est remplacée par\n"
+"round-to-longer-rest et usable-duration-logs.\n"
+
+#: convertrules.py:3219
+msgid "Handling of non-automatic footnotes."
+msgstr "Gestion des notes de bas de page non automatisée."
+
+#: convertrules.py:3223
+msgid "If you are using non-automatic footnotes, make sure to set footnote-auto-numbering = ##f in the paper block.\n"
+msgstr ""
+"Pour une gestion non automatisée des notes de bas de page, n'oubliez pas\n"
+"de mentionner footnote-auto-numbering = ##f dans le bloc \\paper.\n"
+
#: book_base.py:24
#, python-format
msgid "file not found: %s"
msgid "Output function not implemented"
msgstr "Fonction de production non implémentée."
-#: lilylib.py:81 musicxml.py:13 convert-ly.py:67 warn.cc:72 input.cc:115
-#: input.cc:123
+#: lilylib.py:88 musicxml.py:13 convert-ly.py:67 warn.cc:72 input.cc:114
+#: input.cc:122
#, c-format, python-format
msgid "error: %s"
msgstr "Erreur : %s"
-#: lilylib.py:124 lilylib.py:175
+#: lilylib.py:131
+#, python-format
+msgid "Processing %s.ly"
+msgstr "Traitement de « %s.ly »"
+
+#: lilylib.py:135 lilylib.py:198
#, python-format
msgid "Invoking `%s'"
msgstr "Appel de « %s »"
-#: lilylib.py:126 lilylib.py:177
+#: lilylib.py:137 lilylib.py:200
#, python-format
msgid "Running %s..."
msgstr "Exécution de %s..."
-#: lilylib.py:253
+#: lilylib.py:276
#, python-format
msgid "Usage: %s"
msgstr "Utilisation : %s"
msgid "cannot find \\begin{document} in LaTeX document"
msgstr "Impossible de trouver \\begin{document} dans le document LaTeX."
-#: musicxml2ly.py:223
+#: musicxml2ly.py:224
#, python-format
msgid "Encountered file created by %s, containing wrong beaming information. All beaming information in the MusicXML file will be ignored"
msgstr ""
"erronées. Toutes les informations de ligature du fichier MusicXML seront\n"
"ignorées."
-#: musicxml2ly.py:239 musicxml2ly.py:241
+#: musicxml2ly.py:240 musicxml2ly.py:242
#, python-format
msgid "Unprocessed PartGroupInfo %s encountered"
msgstr "PartGroupInfo %s détecté, mais non traité"
-#: musicxml2ly.py:494
+#: musicxml2ly.py:495
#, python-format
msgid "Encountered note at %s without type and duration (=%s)"
msgstr "Une note se trouve en %s, sans type ni durée (=%s)"
-#: musicxml2ly.py:514
+#: musicxml2ly.py:515
#, python-format
msgid "Encountered rational duration with denominator %s, unable to convert to lilypond duration"
msgstr ""
"Durée rationnelle au dénominateur de %s détectée ;\n"
"impossible de traduire en durée LilyPond"
-#: musicxml2ly.py:761
+#: musicxml2ly.py:762
msgid "Unable to extract key signature!"
msgstr "Impossible de déterminer l'armure."
-#: musicxml2ly.py:788
+#: musicxml2ly.py:789
#, python-format
msgid "unknown mode %s, expecting 'major' or 'minor' or a church mode!"
msgstr ""
"%s : mode inconnu.\n"
"Devrait être « majeur », « mineur » ou « mode d'église »"
-#: musicxml2ly.py:926
+#: musicxml2ly.py:927
#, python-format
msgid "Encountered unprocessed marker %s\n"
msgstr "Détection d'un marqueur non traité : %s\n"
-#: musicxml2ly.py:1020
+#: musicxml2ly.py:1021
#, python-format
msgid "unknown span event %s"
msgstr "Événement de prolongation inconnu : « %s »"
-#: musicxml2ly.py:1030
+#: musicxml2ly.py:1031
#, python-format
msgid "unknown span type %s for %s"
msgstr "%s n'est pas un type de prolongateur reconnu pour %s"
-#: musicxml2ly.py:1450
+#: musicxml2ly.py:1451
msgid "Unknown metronome mark, ignoring"
msgstr "Indication métronomique inconnue et ignorée."
#. TODO: Implement the other (more complex) way for tempo marks!
-#: musicxml2ly.py:1455
+#: musicxml2ly.py:1456
msgid "Metronome marks with complex relations (<metronome-note> in MusicXML) are not yet implemented."
msgstr ""
"Les indications métronomiques aux relations complexes (<metronome-note> pour \n"
"MusicXML) n'ont pas encore été implémentées."
-#: musicxml2ly.py:1657
+#: musicxml2ly.py:1658
#, python-format
msgid "Unable to convert chord type %s to lilypond."
msgstr "Impossible de convertir le type d'accord %s au format LilyPond"
-#: musicxml2ly.py:1806
+#: musicxml2ly.py:1807
#, python-format
msgid "drum %s type unknown, please add to instrument_drumtype_dict"
msgstr ""
-"%s n'est pas un type de percussion connu. \n"
+"%s n'est pas un type de percussion connu.\n"
"L'ajouter à instrument_drumtype_dict"
-#: musicxml2ly.py:1810
+#: musicxml2ly.py:1811
msgid "cannot find suitable event"
msgstr "Aucun événement correspondant"
-#: musicxml2ly.py:1958
+#: musicxml2ly.py:1959
#, python-format
msgid "Negative skip %s (from position %s to %s)"
msgstr "Retour en arrière de %s (partant de %s et jusqu'à %s)"
-#: musicxml2ly.py:2099
+#: musicxml2ly.py:2100
#, python-format
msgid "Negative skip found: from %s to %s, difference is %s"
msgstr "Retour en arrière, de %s à %s ; différence = %s"
-#: musicxml2ly.py:2180
+#: musicxml2ly.py:2181
#, python-format
msgid "unexpected %s; expected %s or %s or %s"
msgstr "%s détecté, au lieu de %s, %s ou %s"
-#: musicxml2ly.py:2286
+#: musicxml2ly.py:2287
msgid "Encountered closing slur, but no slur is open"
msgstr "Terminaison d'une liaison qui n'a pas été débutée"
-#: musicxml2ly.py:2289
+#: musicxml2ly.py:2290
msgid "Cannot have two simultaneous (closing) slurs"
msgstr "deux liaisons ne peuvent se terminer simultanément"
-#: musicxml2ly.py:2298
+#: musicxml2ly.py:2299
msgid "Cannot have a slur inside another slur"
msgstr "des liaisons ne peuvent s'imbriquer"
-#: musicxml2ly.py:2301
+#: musicxml2ly.py:2302
msgid "Cannot have two simultaneous slurs"
msgstr "deux liaisons ne peuvent intervenir simultanément"
-#: musicxml2ly.py:2435
+#: musicxml2ly.py:2436
#, python-format
msgid "cannot simultaneously have more than one mode: %s"
msgstr "SVP, un seul mode à la fois : %s"
-#: musicxml2ly.py:2543
+#: musicxml2ly.py:2544
msgid "Converting to LilyPond expressions..."
msgstr "Conversion en expressions LilyPond..."
-#: musicxml2ly.py:2554
+#: musicxml2ly.py:2555
msgid "musicxml2ly [OPTION]... FILE.xml"
-msgstr "musicxml2ly [options]... FICHIER.xml"
+msgstr "musicxml2ly [OPTION]... FICHIER.xml"
-#: musicxml2ly.py:2556
+#: musicxml2ly.py:2557
msgid ""
"Convert MusicXML from FILE.xml to LilyPond input.\n"
"If the given filename is -, musicxml2ly reads from the command line.\n"
"Convertit FICHIER.xml (MusicXML) au format LilyPond.\n"
"Si le nom du fichier est « - », musicxml2ly lira la ligne de commande.\n"
-#: musicxml2ly.py:2562 midi2ly.py:987 abc2ly.py:1386 lilypond-book.py:140
-#: convert-ly.py:98 etf2ly.py:1202 main.cc:157
+#: musicxml2ly.py:2563 midi2ly.py:1060 abc2ly.py:1386 lilypond-book.py:140
+#: convert-ly.py:98 etf2ly.py:1202 main.cc:159
msgid "show this help and exit"
msgstr "visualiser cette aide et quitter"
-#: musicxml2ly.py:2566
+#: musicxml2ly.py:2567
msgid ""
"Copyright (c) 2005--2011 by\n"
" Han-Wen Nienhuys <hanwen@xs4all.nl>,\n"
" Jan Nieuwenhuizen <janneke@gnu.org> and\n"
" Reinhold Kainhofer <reinhold@kainhofer.com>\n"
-#: musicxml2ly.py:2580 midi2ly.py:1015 abc2ly.py:1382 lilypond-book.py:212
-#: convert-ly.py:94 etf2ly.py:1206 main.cc:168
+#: musicxml2ly.py:2581 midi2ly.py:1091 abc2ly.py:1382 lilypond-book.py:217
+#: convert-ly.py:94 etf2ly.py:1206 main.cc:174
msgid "show version number and exit"
-msgstr "afficher le numéro de version et quitter"
+msgstr "affiche le numéro de version et quitte"
-#: musicxml2ly.py:2585 midi2ly.py:1009 lilypond-book.py:204 main.cc:169
+#: musicxml2ly.py:2586 midi2ly.py:1085 lilypond-book.py:209 main.cc:175
msgid "be verbose"
-msgstr "Passe en mode verbeux"
+msgstr "passe en mode verbeux"
-#: musicxml2ly.py:2591
+#: musicxml2ly.py:2592
msgid "use lxml.etree; uses less memory and cpu time"
msgstr ""
"utilise lxml.etree pour consommer moins de mémoire\n"
"et de temps processeur."
-#: musicxml2ly.py:2597
+#: musicxml2ly.py:2598
msgid "input file is a zip-compressed MusicXML file"
msgstr "le fichier d'entrée est un fichier MusicXML compressé"
-#: musicxml2ly.py:2603
+#: musicxml2ly.py:2604
msgid "convert pitches in relative mode (default)"
msgstr "convertit les hauteurs en mode relatif (par défaut)"
-#: musicxml2ly.py:2608
+#: musicxml2ly.py:2609
msgid "convert pitches in absolute mode"
msgstr "convertit les hauteurs en mode absolu"
-#: musicxml2ly.py:2611
+#: musicxml2ly.py:2612
msgid "LANG"
msgstr "LANG"
-#: musicxml2ly.py:2613
+#: musicxml2ly.py:2614
msgid "use LANG for pitch names, e.g. 'deutsch' for note names in German"
-msgstr "utilise une autre définition linguistique (LANG), p.ex. deutsch l'allemand"
+msgstr ""
+"utilise une autre définition linguistique (LANG),\n"
+"p.ex. deutsch pour l'allemand"
-#: musicxml2ly.py:2619
+#: musicxml2ly.py:2620
msgid "do not convert directions (^, _ or -) for articulations, dynamics, etc."
msgstr ""
"ne convertit pas les emplacements (^, _ ou -) des articulations, \n"
"nuances, etc."
-#: musicxml2ly.py:2625
+#: musicxml2ly.py:2626
msgid "do not convert exact vertical positions of rests"
msgstr "ne convertit pas le positionnement absolu des silences"
-#: musicxml2ly.py:2631
+#: musicxml2ly.py:2632
msgid "do not convert the exact page layout and breaks"
msgstr "ne convertit pas les sauts et la mise en page"
-#: musicxml2ly.py:2637
+#: musicxml2ly.py:2638
msgid "do not convert beaming information, use lilypond's automatic beaming instead"
msgstr ""
"ne convertit pas les informations de ligature ; \n"
"laisse LilyPond gérer les ligatures automatiques"
-#: musicxml2ly.py:2640 midi2ly.py:992 midi2ly.py:997 etf2ly.py:1208
-#: main.cc:161 main.cc:166
+#: musicxml2ly.py:2641 midi2ly.py:1065 midi2ly.py:1070 etf2ly.py:1208
+#: main.cc:165 main.cc:172
msgid "FILE"
msgstr "FICHIER"
-#: musicxml2ly.py:2645
+#: musicxml2ly.py:2646
msgid "set output filename to FILE, stdout if -"
msgstr "produit la sortie dans FICHIER (stdout si -)"
#. "Report bugs in English via %s",
#. or if there is a LilyPond users list or forum in your language
#. "Report bugs in English via %s or in YOUR_LANG via URI"
-#: musicxml2ly.py:2648 midi2ly.py:1028 abc2ly.py:1395 lilypond-book.py:234
-#: convert-ly.py:144 etf2ly.py:1216 main.cc:281
+#: musicxml2ly.py:2649 midi2ly.py:1104 abc2ly.py:1395 lilypond-book.py:239
+#: convert-ly.py:144 etf2ly.py:1216 main.cc:285
#, c-format, python-format
msgid "Report bugs via %s"
msgstr ""
"ou en anglais à\n"
"%s"
-#: musicxml2ly.py:2728
+#: musicxml2ly.py:2729
#, python-format
msgid "unknown part in part-list: %s"
msgstr "la partie %s n'est pas mentionnée dans part-list"
-#: musicxml2ly.py:2790
+#: musicxml2ly.py:2791
msgid "Input is compressed, extracting raw MusicXML data from stdin"
msgstr ""
"Le fichier d'entrée est compressé.\n"
"Extraction des données MusicXML brutes à partir de stdin"
-#: musicxml2ly.py:2793
+#: musicxml2ly.py:2804
#, python-format
msgid "Input file %s is compressed, extracting raw MusicXML data"
msgstr ""
"Le fichier d'entrée (%s) est compressé.\n"
"Extraction des données MusicXML brutes"
-#: musicxml2ly.py:2823
+#: musicxml2ly.py:2834
msgid "Reading MusicXML from Standard input ..."
msgstr "Lecture du fichier MusicXML à partir de l'entrée standard..."
-#: musicxml2ly.py:2825
+#: musicxml2ly.py:2836
#, python-format
msgid "Reading MusicXML from %s ..."
msgstr "Lecture du fichier MusicXML %s..."
-#: musicxml2ly.py:2858
+#: musicxml2ly.py:2869
#, python-format
msgid "Output to `%s'"
msgstr "Fichier de sortie : « %s »"
-#: musicxml2ly.py:2925
+#: musicxml2ly.py:2936
#, python-format
msgid "Unable to find input file %s"
msgstr "Impossible de trouver le fichier d'entrée : « %s »"
-#: midi2ly.py:90 lilypond-book.py:116 convert-ly.py:81 etf2ly.py:1189
+#: midi2ly.py:81 lilypond-book.py:116 convert-ly.py:81 etf2ly.py:1189
#, python-format
msgid "Copyright (c) %s by"
msgstr "Copyright (c) %s détenu par"
-#: midi2ly.py:92 lilypond-book.py:118 convert-ly.py:83 etf2ly.py:1191
+#: midi2ly.py:83 lilypond-book.py:118 convert-ly.py:83 etf2ly.py:1191
msgid "Distributed under terms of the GNU General Public License."
msgstr "Distribué selon les termes de la GNU General Public License."
-#: midi2ly.py:93 lilypond-book.py:119 convert-ly.py:84 etf2ly.py:1192
+#: midi2ly.py:84 lilypond-book.py:119 convert-ly.py:84 etf2ly.py:1192
msgid "It comes with NO WARRANTY."
msgstr "Le logiciel est distribué SANS GARANTIE."
-#: midi2ly.py:99
+#: midi2ly.py:90
msgid "warning: "
msgstr "Avertissement : "
-#: midi2ly.py:102 midi2ly.py:1041
+#: midi2ly.py:93 midi2ly.py:1121
msgid "error: "
msgstr "Erreur : "
-#: midi2ly.py:103
+#: midi2ly.py:94
msgid "Exiting... "
msgstr "Fin d'exécution... "
-#: midi2ly.py:960
+#: midi2ly.py:834
+msgid "found more than 5 voices on a staff, expect bad output"
+msgstr ""
+"l'une des portées contient plus de cinq voix ;\n"
+"attendez-vous à un piètre résultat."
+
+#: midi2ly.py:1030
#, python-format
msgid "%s output to `%s'..."
msgstr "%s reproduit dans « %s »..."
-#: midi2ly.py:972 abc2ly.py:1373 lilypond-book.py:122 convert-ly.py:87
+#: midi2ly.py:1042 abc2ly.py:1373 lilypond-book.py:122 convert-ly.py:87
#, python-format
msgid "%s [OPTION]... FILE"
msgstr "%s [OPTIONS]... FICHIER"
-#: midi2ly.py:973
+#: midi2ly.py:1043
#, python-format
msgid "Convert %s to LilyPond input.\n"
-msgstr "Convertir %s au format source LilyPond.\n"
+msgstr "convertit %s au format source LilyPond.\n"
-#: midi2ly.py:978
+#: midi2ly.py:1048
msgid "print absolute pitches"
-msgstr "Afficher des hauteurs absolues"
+msgstr "affecte des hauteurs absolues"
-#: midi2ly.py:980 midi2ly.py:1002
+#: midi2ly.py:1050 midi2ly.py:1075
msgid "DUR"
msgstr "DUR"
-#: midi2ly.py:981
+#: midi2ly.py:1051
msgid "quantise note durations on DUR"
-msgstr "Quantifier les durées de note d'après DUR"
+msgstr "quantifie les durées de note d'après DUR"
+
+#: midi2ly.py:1054
+msgid "debug printing"
+msgstr "affiche des informations de débogage"
-#: midi2ly.py:984
+#: midi2ly.py:1057
msgid "print explicit durations"
-msgstr "Écrit des durées explicites"
+msgstr "affecte des durées explicites"
-#: midi2ly.py:989
+#: midi2ly.py:1062
msgid "prepend FILE to output"
-msgstr "ajout de FICHIER à la sortie"
+msgstr "ajoute FICHIER à la sortie"
-#: midi2ly.py:993
+#: midi2ly.py:1066
msgid "set key: ALT=+sharps|-flats; MINOR=1"
-msgstr "Définit l'armure : ALT=+dièse|-bémol; MINEUR=1"
+msgstr "définit l'armure : ALT=+dièse|-bémol; MINEUR=1"
-#: midi2ly.py:994
+#: midi2ly.py:1067
msgid "ALT[:MINOR]"
msgstr "ALT[:MINEUR]"
-#: midi2ly.py:996 abc2ly.py:1388 etf2ly.py:1207
+#: midi2ly.py:1069 abc2ly.py:1388 etf2ly.py:1207
msgid "write output to FILE"
-msgstr "produire la sortie dans le FICHIER"
+msgstr "produit la sortie dans le FICHIER"
-#: midi2ly.py:999
+#: midi2ly.py:1072
msgid "preview of first 4 bars"
msgstr "prévisualisation des quatre premières mesures"
-#: midi2ly.py:1001
+#: midi2ly.py:1074
msgid "quantise note starts on DUR"
-msgstr "Quantifie les débuts de note sur DUR"
+msgstr "quantifie les débuts de note sur DUR"
-#: midi2ly.py:1004
+#: midi2ly.py:1078
+msgid "use s instead of r for rests"
+msgstr "traduit les silences en « s », non en « r »"
+
+#: midi2ly.py:1080
msgid "DUR*NUM/DEN"
msgstr "DUR*NUM/DEN"
-#: midi2ly.py:1007
+#: midi2ly.py:1083
msgid "allow tuplet durations DUR*NUM/DEN"
-msgstr "Permet des n-olets de durée DUR*NUM/DEN"
+msgstr "permet des n-olets de durée DUR*NUM/DEN"
-#: midi2ly.py:1016 lilypond-book.py:215 convert-ly.py:139 etf2ly.py:1210
-#: main.cc:170
+#: midi2ly.py:1092 lilypond-book.py:220 convert-ly.py:139 etf2ly.py:1210
+#: main.cc:176
msgid "show warranty and copyright"
-msgstr "afficher les notices de garantie et du droit d'auteur"
+msgstr "affiche les notices de garantie et du droit d'auteur"
-#: midi2ly.py:1019
+#: midi2ly.py:1095
msgid "treat every text as a lyric"
-msgstr "Traite tout texte comme étant des paroles"
+msgstr "traite tout texte comme étant des paroles"
-#: midi2ly.py:1022
+#: midi2ly.py:1098
msgid "Examples"
msgstr "Exemples"
-#: midi2ly.py:1042
+#: midi2ly.py:1122
msgid "no files specified on command line."
msgstr "aucun fichier spéficié sur la ligne de commande."
#: lilypond-book.py:130
msgid "pipe snippets through FILTER [default: `convert-ly -n -']"
-msgstr "Passe les extraits à travers le FILTRE [par défaut : `convert-ly -n -']"
+msgstr "passe les extraits à travers le FILTRE [par défaut : `convert-ly -n -']"
#: lilypond-book.py:134
msgid "use output format FORMAT (texi [default], texi-html, latex, html, docbook)"
msgstr ""
-"Utilise le format de sortie FORMAT (texi par défaut, texi-html, latex,\n"
+"utilise le format de sortie FORMAT (texi par défaut, texi-html, latex,\n"
"html ou docbook)"
#: lilypond-book.py:135
#: lilypond-book.py:142
msgid "add DIR to include path"
-msgstr "Ajoute le RÉP au chemin de recherche des inclusions"
+msgstr "ajoute le RÉP au chemin de recherche des inclusions"
#: lilypond-book.py:143 lilypond-book.py:150 lilypond-book.py:163
-#: lilypond-book.py:173 lilypond-book.py:189 lilypond-book.py:195 main.cc:160
+#: lilypond-book.py:173 lilypond-book.py:194 lilypond-book.py:200 main.cc:164
msgid "DIR"
msgstr "RÉP"
#: lilypond-book.py:148
msgid "format Texinfo output so that Info will look for images of music in DIR"
-msgstr "Formate la sortie Texinfo pour qu'Info cherche les images dans RÉP"
+msgstr "formate la sortie Texinfo pour qu'Info cherche les images dans RÉP"
#: lilypond-book.py:155
msgid "PAD"
#: lilypond-book.py:157
msgid "pad left side of music to align music inspite of uneven bar numbers (in mm)"
msgstr ""
-"Tasse la musique par la gauche pour la répartir en dépit du nombre irrégulier\n"
+"tasse la musique par la gauche pour la répartir en dépit du nombre irrégulier\n"
"de mesures (en mm)"
#: lilypond-book.py:162
msgid "write lily-XXX files to DIR, link into --output dir"
msgstr ""
-"Ã\89crit les fichiers lily-XXX dans RÉP et crée un lien vers le répertoire\n"
+"écrit les fichiers lily-XXX dans RÉP et crée un lien vers le répertoire\n"
"spécifié par --output"
#: lilypond-book.py:167
msgid "Load the additional python PACKAGE (containing e.g. a custom output format)"
msgstr ""
-"Charge le PAQUETAGE python supplémentaire (contenant p.ex. un format\n"
+"charge le PAQUETAGE python supplémentaire (contenant p.ex. un format\n"
"de sortie particulier)"
#: lilypond-book.py:168
#: lilypond-book.py:172
msgid "write output to DIR"
-msgstr "Produit la sortie dans RÉP"
+msgstr "produit la sortie dans RÉP"
#: lilypond-book.py:177
msgid "COMMAND"
#: lilypond-book.py:178
msgid "process ly_files using COMMAND FILE..."
-msgstr "Traîte ly_files en utilisant COMMANDE FICHIER..."
+msgstr "traîte ly_files en utilisant COMMANDE FICHIER..."
+
+#: lilypond-book.py:183
+msgid "Redirect the lilypond output"
+msgstr "redirige la sortie la sortie lilypond"
-#: lilypond-book.py:182
+#: lilypond-book.py:187
msgid "Compile snippets in safe mode"
-msgstr "Compile des extraits en mode protégé"
+msgstr "compile des extraits en mode protégé"
-#: lilypond-book.py:188
+#: lilypond-book.py:193
msgid "do not fail if no lilypond output is found"
-msgstr "Désactive la mise en échec en l’absence de sortie de lilypond"
+msgstr "désactive la mise en échec en l’absence de sortie de lilypond"
-#: lilypond-book.py:194
+#: lilypond-book.py:199
msgid "do not fail if no PNG images are found for EPS files"
msgstr ""
-"Désactive la mise en échec en l’absence d’images PNG correspondant aux\n"
-"fichiers EPS"
+"désactive la mise en échec en l’absence d’images PNG\n"
+"correspondant aux fichiers EPS"
-#: lilypond-book.py:200
+#: lilypond-book.py:205
msgid "write snippet output files with the same base name as their source file"
msgstr ""
-"Affecte au résultat des extraits la même racine\n"
+"affecte au résultat des extraits la même racine\n"
"que celle des fichiers source"
-#: lilypond-book.py:220
+#: lilypond-book.py:225
msgid ""
"run executable PROG instead of latex, or in\n"
"case --pdf option is set instead of pdflatex"
msgstr ""
-"Utilise l’exécutable PROG en lieu et place de latex,\n"
+"utilise l’exécutable PROG en lieu et place de latex,\n"
"ou lorsque l'option --pdf remplace pdflatex"
-#: lilypond-book.py:222
+#: lilypond-book.py:227
msgid "PROG"
msgstr "PROG"
-#: lilypond-book.py:228
+#: lilypond-book.py:233
msgid "create PDF files for use with PDFTeX"
-msgstr "Crée des fichiers PDF pour utilisation par PDFTeX"
+msgstr "crée des fichiers PDF pour utilisation par PDFTeX"
-#: lilypond-book.py:419
+#: lilypond-book.py:428
msgid "Writing snippets..."
msgstr "Écriture des extraits..."
-#: lilypond-book.py:425
+#: lilypond-book.py:434
msgid "Processing..."
msgstr "Traitement..."
-#: lilypond-book.py:431
+#: lilypond-book.py:440
msgid "All snippets are up to date..."
msgstr "Tous les extraits sont à jour..."
-#: lilypond-book.py:452
+#: lilypond-book.py:461
#, python-format
msgid "cannot determine format for: %s"
msgstr "format indéterminé pour %s"
-#: lilypond-book.py:461
+#: lilypond-book.py:470
#, python-format
msgid "%s is up to date."
msgstr "%s est à jour."
-#: lilypond-book.py:475
+#: lilypond-book.py:484
#, python-format
msgid "Writing `%s'..."
msgstr "Écriture de « %s »..."
-#: lilypond-book.py:537
+#: lilypond-book.py:546
msgid "Output would overwrite input file; use --output."
msgstr "La sortie va écraser le fichier d'entrée ; utiliser --output"
-#: lilypond-book.py:541
+#: lilypond-book.py:550
#, python-format
msgid "Reading %s..."
msgstr "Lecture en cours de %s..."
-#: lilypond-book.py:549
+#: lilypond-book.py:558
msgid "Dissecting..."
msgstr "Dissection en cours..."
-#: lilypond-book.py:561
+#: lilypond-book.py:570
#, python-format
msgid "Compiling %s..."
msgstr "Compilation de %s..."
-#: lilypond-book.py:570
+#: lilypond-book.py:579
#, python-format
msgid "Processing include: %s"
msgstr "Traitement d'inclusion : %s"
-#: lilypond-book.py:582
+#: lilypond-book.py:591
#, python-format
msgid "Removing `%s'"
msgstr "Suppression de « %s »"
#: convert-ly.py:339
#, python-format
msgid "%s: Unable to determine version. Skipping"
-msgstr "impossible de déterminer la version de « %s ». Au suivant !"
+msgstr ""
+"impossible de déterminer la version de « %s ».\n"
+" Au suivant !"
#: convert-ly.py:344
#, python-format
msgid "success: %s"
msgstr "Résultat : %s"
-#: warn.cc:86 grob.cc:617 input.cc:97
+#: warn.cc:86 grob.cc:613 input.cc:97
#, c-format
msgid "programming error: %s"
msgstr "erreur de programmation : %s"
msgid "Vaticana_ligature: zero join (delta_pitch == 0)"
msgstr "Vaticana_ligature: aucun joint (delta_pitch == 0)"
-#: parse-scm.cc:101
+#: parse-scm.cc:100
msgid "GUILE signaled an error for the expression beginning here"
msgstr "GUILE a signalé une erreur pour l'expression débutant ici"
msgstr "tête rythmique non rattachée à un empilement rythmique"
#. if we get to here, just put everything on one line
-#: constrained-breaking.cc:189 constrained-breaking.cc:207
+#: constrained-breaking.cc:187 constrained-breaking.cc:205
msgid "cannot find line breaking that satisfies constraints"
msgstr "impossible de trouver un saut de ligne qui satisfasse aux contraintes"
-#: horizontal-bracket-engraver.cc:78
+#: horizontal-bracket-engraver.cc:62
msgid "do not have that many brackets"
msgstr "n'a pas autant de crochets"
-#: horizontal-bracket-engraver.cc:87
+#: horizontal-bracket-engraver.cc:71
msgid "conflicting note group events"
msgstr "événements de groupe de notes conflictuels"
msgid "unterminated hyphen; removing"
msgstr "trait d'union sans suite ; escamoté"
-#: pango-font.cc:187 open-type-font.cc:319
+#: pango-font.cc:189 open-type-font.cc:318
#, c-format
msgid "FT_Get_Glyph_Name () error: %s"
msgstr "Erreur FT_Get_Glyph_Name () : %s"
-#: pango-font.cc:204
+#: pango-font.cc:205
#, c-format
msgid ""
"Glyph has no name, but font supports glyph naming.\n"
"Le glyphe n'a pas de nom alors que la fonte prend en charge leur nommage.\n"
"Glyphe U+%0X ignoré dans le fichier %s"
-#: pango-font.cc:241
+#: pango-font.cc:242
#, c-format
msgid "no PostScript font name for font `%s'"
msgstr "« %s » n'est pas un fichier de fonte PostScript"
-#: pango-font.cc:290
+#: pango-font.cc:291
msgid "FreeType face has no PostScript font name"
msgstr "Caractère FreeType sans nom de police PostScript"
-#: midi-item.cc:92
+#: midi-item.cc:89
#, c-format
msgid "no such MIDI instrument: `%s'"
msgstr "instrument MIDI non répertorié : « %s »"
msgid "NoteEvent without pitch"
msgstr "NoteEvent sans hauteur"
-#: rest.cc:159
+#: rest.cc:160
#, c-format
msgid "rest `%s' not found"
msgstr "silence « %s » inconnu"
msgid "unterminated beam"
msgstr "ligature non terminée"
-#: beam-engraver.cc:266 chord-tremolo-engraver.cc:150
+#: beam-engraver.cc:266 chord-tremolo-engraver.cc:149
msgid "stem must have Rhythmic structure"
msgstr "la hampe doit avoir une structure Rythmic"
msgid "beam was started here"
msgstr "la ligature a débuté ici"
-#: music-iterator.cc:182
+#: music-iterator.cc:181
msgid "Sending non-event to context"
msgstr "Envoi d'un non-événement au contexte"
-#: context.cc:149
+#: context.cc:148
#, c-format
msgid "cannot find or create new `%s'"
msgstr "impossible de trouver ou créer un nouveau « %s »"
-#: context.cc:207
+#: context.cc:206
#, c-format
msgid "cannot find or create `%s' called `%s'"
msgstr "impossible de trouver ou créer « %s » appelé « %s »"
-#: context.cc:269
+#: context.cc:268
#, c-format
msgid "Invalid CreateContext event: Cannot create %s context"
-msgstr "Événement CreateContext invalide : impossible de créer le contexte %s"
+msgstr ""
+"Événement CreateContext invalide :\n"
+" impossible de créer le contexte %s"
-#: context.cc:400
+#: context.cc:399
#, c-format
msgid "cannot find or create: `%s'"
msgstr "impossible de trouver ou créer « %s »"
"Un saut explicite a été outrepassé par un autre événement.\n"
"Positionnez quelques contrôles de mesure (bar check) pour vérifier."
-#: tie-engraver.cc:116
+#: tie-engraver.cc:117
msgid "unterminated tie"
msgstr "liaison de prolongation non terminée"
-#: tie-engraver.cc:312
+#: tie-engraver.cc:348
msgid "lonely tie"
msgstr "liaison de prolongation orpheline"
"l'avant dernière note doit en être une autre,\n"
"sinon la ligature doit être LB ou SSB"
-#: mensural-ligature-engraver.cc:386
+#: mensural-ligature-engraver.cc:387
msgid "unexpected case fall-through"
msgstr "cas inattendu et non interprétable"
-#: piano-pedal-engraver.cc:298
+#: piano-pedal-engraver.cc:296
#, c-format
msgid "expect 3 strings for piano pedals, found: %ld"
msgstr "Les pédales de piano nécessitent 3 cordes. Il y en a %ld"
-#: piano-pedal-engraver.cc:313 piano-pedal-engraver.cc:324
+#: piano-pedal-engraver.cc:311 piano-pedal-engraver.cc:322
#: piano-pedal-performer.cc:104
#, c-format
msgid "cannot find start of piano pedal: `%s'"
msgstr "début de la pédale de piano indéterminé : « %s »"
-#: piano-pedal-engraver.cc:359
+#: piano-pedal-engraver.cc:357
#, c-format
msgid "cannot find start of piano pedal bracket: `%s'"
msgstr "début du crochet de la pédale de piano indéterminé : « %s »"
-#: input.cc:131 source-file.cc:179 source-file.cc:194
+#: input.cc:130 source-file.cc:178 source-file.cc:193
msgid "position unknown"
msgstr "position inconnue"
msgid "Layout output to `%s'..."
msgstr "Sortie mise en page vers « %s »..."
-#: general-scheme.cc:306
+#: general-scheme.cc:305
msgid "infinity or NaN encountered while converting Real number"
msgstr "Infini ou valeur non numérique rencontré lors de la conversion d'un nombre réel"
-#: general-scheme.cc:307
+#: general-scheme.cc:306
msgid "setting to zero"
msgstr "initialisation à zéro"
-#: general-scheme.cc:543
+#: general-scheme.cc:540
msgid "Found infinity or nan in output. Substituting 0.0"
msgstr ""
"La sortie contient l'infini ou une valeur non numérique.\n"
"Substitution par 0.0"
-#: music.cc:151
+#: music.cc:150
#, c-format
msgid "octave check failed; expected \"%s\", found: \"%s\""
msgstr ""
"Échec de vérification d'octave.\n"
"Aurait dû être \"%s\", \"%s\" obtenu"
-#: music.cc:219
+#: music.cc:218
msgid "(normalized pitch)"
msgstr "(hauteur normalisée)"
-#: music.cc:223
+#: music.cc:222
#, c-format
msgid "Transposing %s by %s makes alteration larger than double"
msgstr "La transposition de %s à %s crée des altérations supérieures aux doubles"
msgid "trying to use \\partial after the start of a piece"
msgstr "\\partial ne devrait intervenir qu'en début de morceau"
-#: new-fingering-engraver.cc:106
+#: new-fingering-engraver.cc:105
msgid "cannot add text scripts to individual note heads"
msgstr "impossible d'ajouter du texte à des têtes de notes individuelles"
-#: new-fingering-engraver.cc:250
+#: new-fingering-engraver.cc:249
msgid "no placement found for fingerings"
msgstr "nulle part où positionner des doigtés"
-#: new-fingering-engraver.cc:251
+#: new-fingering-engraver.cc:250
msgid "placing below"
msgstr "on les place en dessous"
#: ligature-engraver.cc:104 ligature-bracket-engraver.cc:72
msgid "cannot find start of ligature"
-msgstr "impossible de trouver le début d'une ligature"
+msgstr "impossible de trouver le début de la ligature"
#: ligature-engraver.cc:109
msgid "no right bound"
msgid "no left bound"
msgstr "pas de borne à gauche"
-#: ligature-engraver.cc:185
+#: ligature-engraver.cc:184
msgid "unterminated ligature"
msgstr "ligature non terminée"
-#: ligature-engraver.cc:214
+#: ligature-engraver.cc:211
msgid "ignoring rest: ligature may not contain rest"
msgstr "le silence est ignoré : une ligature ne peut contenir de silence"
-#: ligature-engraver.cc:215
+#: ligature-engraver.cc:212
msgid "ligature was started here"
msgstr "la ligature a débuté ici"
msgid "cannot change, already in translator: %s"
msgstr "modification impossible, c'est déjà dans le translateur : %s"
-#: accidental-engraver.cc:180
+#: accidental-engraver.cc:179
#, c-format
msgid "accidental typesetting list must begin with context-name: %s"
msgstr ""
"La saisie d'une liste d'altérations accidentelles doit débuter \n"
"par un nom de contexte : %s"
-#: accidental-engraver.cc:210
+#: accidental-engraver.cc:209
#, c-format
msgid "procedure or context-name expected for accidental rule, found %s"
msgstr ""
"procédure ou nom de contexte requis pour la règle d'altération accidentelle,\n"
"%s trouvé"
-#: ttf.cc:481 ttf.cc:530
+#: ttf.cc:480 ttf.cc:529
#, c-format
msgid "font index %d too large for font `%s', using index 0"
msgstr ""
"index %d trop grand pour la fonte « %s » ;\n"
"réindexé sur 0"
-#: ttf.cc:513 ttf.cc:565
+#: ttf.cc:512 ttf.cc:564
msgid "font index must be non-negative, using index 0"
msgstr "l'index de fonte ne peut être négatif ; réindexé sur 0"
-#: break-alignment-interface.cc:206
+#: break-alignment-interface.cc:199
#, c-format
msgid "No spacing entry from %s to `%s'"
msgstr "Pas d'espacement entre %s et « %s »"
msgid "Aborting"
msgstr "Abandon"
-#: note-collision.cc:497
+#: note-collision.cc:494
msgid "ignoring too many clashing note columns"
msgstr "trop d'empilements de notes se chevauchent. On fera au mieux."
msgid "giving up"
msgstr "abandon"
-#: page-layout-problem.cc:322
+#: page-layout-problem.cc:603
msgid "cannot fit music on page: ragged-spacing was requested, but page was compressed"
msgstr ""
"impossible de faire tenir la musique sur la page :\n"
" justification demandée, mais page déjà compressée"
-#: page-layout-problem.cc:325
+#: page-layout-problem.cc:606
#, c-format
msgid "cannot fit music on page: overflow is %f"
msgstr "impossible de faire tenir la musique sur la page. Débordement de %f"
-#: page-layout-problem.cc:327
+#: page-layout-problem.cc:608
msgid "compressing music to fit"
msgstr "compression de la musique pour que cela tienne"
-#: page-layout-problem.cc:765
+#: page-layout-problem.cc:1047
msgid "staff-affinities should only decrease"
msgstr "staff-affinities devraient aller en ordre décroissant"
msgid "mark label must be a markup object"
msgstr "les étiquettes de marque doivent être des objets de type \"markup\""
-#: new-dynamic-engraver.cc:142
+#: new-dynamic-engraver.cc:168
#, c-format
msgid ""
"unknown crescendo style: %s\n"
"style de crescendo inconnu : %s\n"
"retour à la valeur par défaut (soufflet)."
-#: new-dynamic-engraver.cc:200
+#: new-dynamic-engraver.cc:233
#, c-format
msgid "unterminated %s"
msgstr "%s non terminé(e)"
-#: stem-engraver.cc:103
+#: stem-engraver.cc:102
msgid "tremolo duration is too long"
msgstr "durée du tremolo trop longue"
-#. FIXME:
-#: stem-engraver.cc:140
+#: stem-engraver.cc:154
#, c-format
-msgid "adding note head to incompatible stem (type = %d)"
-msgstr "Ajout d'une tête de note à une hampe incompatible (type = %d)"
+msgid "adding note head to incompatible stem (type = %d/%d)"
+msgstr "Ajout d'une tête de note à une hampe incompatible (type = %d/%d)"
-#: stem-engraver.cc:142
+#: stem-engraver.cc:157
msgid "maybe input should specify polyphonic voices"
msgstr "la source devrait spécifier des voix polyphoniques"
-#: lily-lexer.cc:264
+#: lily-lexer.cc:265
msgid "include files are not allowed in safe mode"
msgstr "l'inclusion de fichiers n'est pas permise en mode sans échec"
-#: lily-lexer.cc:291
+#: lily-lexer.cc:292
#, c-format
msgid "identifier name is a keyword: `%s'"
msgstr "Le nom de l'identificateur est un mot clé : « %s »"
-#: lily-lexer.cc:312
+#: lily-lexer.cc:313
#, c-format
msgid "error at EOF: %s"
msgstr "erreur à la fin du fichier (EOF) : %s"
msgid "cannot find Voice `%s'"
msgstr "impossible de repérer la voix (Voice) « %s »"
-#: includable-lexer.cc:71 lily-guile.cc:87 lily-parser-scheme.cc:109
+#: includable-lexer.cc:71 lily-guile.cc:86 lily-parser-scheme.cc:109
#, c-format
msgid "cannot find file: `%s'"
msgstr "fichier non trouvé : « %s »"
-#: includable-lexer.cc:73 lily-parser-scheme.cc:100
+#: includable-lexer.cc:73 lily-parser-scheme.cc:101
#, c-format
msgid "(search path: `%s')"
msgstr "(chemin de recherche : « %s »)"
msgstr "suppression d'une ligature ayant moins de deux hampes"
#. We are completely screwed.
-#: beam.cc:1274
+#: beam.cc:1350
msgid "no viable initial configuration found: may not find good beam slope"
msgstr ""
"pas de configuration initiale viable repérée : \n"
"la pente de la ligature pourrait être inesthétique."
-#: slur-engraver.cc:93
+#: staff-performer.cc:257
+msgid "MIDI channel wrapped around"
+msgstr "Bouclage du canal MIDI"
+
+#: staff-performer.cc:258
+msgid "remapping modulo 16"
+msgstr "réaffectation modulo 16"
+
+#: slur-engraver.cc:90 phrasing-slur-engraver.cc:89
#, c-format
msgid "direction of %s invalid: %d"
msgstr "l'orientation de %s n'est pas valide : %d"
-#: slur-engraver.cc:162
+#: slur-engraver.cc:158
msgid "unterminated slur"
msgstr "liaison non terminée"
-#: slur-engraver.cc:174
+#: slur-engraver.cc:183
msgid "cannot end slur"
msgstr "impossible de terminer la liaison"
-#: font-config.cc:40
+#. We already have a slur, so give a warning and completely ignore
+#. the new slur.
+#: slur-engraver.cc:200
+msgid "already have slur"
+msgstr "a déjà une liaison"
+
+#: font-config.cc:39
msgid "Initializing FontConfig..."
msgstr "Initialisation de FontConfig..."
-#: font-config.cc:55 font-config-scheme.cc:152
+#: font-config.cc:54 font-config-scheme.cc:151
#, c-format
msgid "failed adding font directory: %s"
msgstr "échec lors de l'ajout d'un répertoire de fontes : « %s »"
-#: font-config.cc:57 font-config-scheme.cc:154
+#: font-config.cc:56 font-config-scheme.cc:153
#, c-format
msgid "adding font directory: %s"
msgstr "ajout d'un répertoire de fontes : « %s »"
-#: font-config.cc:61
+#: font-config.cc:60
msgid "Building font database..."
msgstr "Construction de la base de donnée des fontes..."
msgid "natural alteration glyph not found"
msgstr "pas de glyphe correspondant au bécarre"
-#: system.cc:197
+#: system.cc:201
#, c-format
msgid "Element count %d"
msgstr "%d éléments dénombrés."
-#: system.cc:303
+#: system.cc:402
#, c-format
msgid "Grob count %d"
msgstr "%d objet graphiques (grob) dénombrés"
-#: slur.cc:362
+#: slur.cc:359
#, c-format
msgid "Ignoring grob for slur: %s. avoid-slur not set?"
msgstr ""
"objet graphique (grob) non concerné par la liaison : %s.\n"
"avoid-slur non définie ?"
-#: font-config-scheme.cc:168
+#: font-config-scheme.cc:167
#, c-format
msgid "failed adding font file: %s"
msgstr "échec lors de l'ajout d'un fichier de fontes : « %s »"
-#: font-config-scheme.cc:170
+#: font-config-scheme.cc:169
#, c-format
msgid "adding font file: %s"
msgstr "ajout d'un fichier de fontes : « %s »"
msgid "decrescendo too small"
msgstr "decrescendo trop petit"
-#: extender-engraver.cc:170 extender-engraver.cc:179
+#: extender-engraver.cc:169 extender-engraver.cc:178
msgid "unterminated extender"
msgstr "prolongation ou extenseur non terminé"
-#: lily-guile.cc:89
+#: lily-guile.cc:88
#, c-format
msgid "(load path: `%s')"
msgstr "(chemin de chargement : « %s »)"
-#: lily-guile.cc:437
+#: lily-guile.cc:431
#, c-format
msgid "cannot find property type-check for `%s' (%s)."
msgstr "vérification du type de propriété pour « %s » (%s) non trouvée"
-#: lily-guile.cc:440
+#: lily-guile.cc:434
msgid "perhaps a typing error?"
msgstr "Probable faute de frappe"
-#: lily-guile.cc:447
+#: lily-guile.cc:441
msgid "doing assignment anyway"
msgstr "affectation faite malgré tout"
-#: lily-guile.cc:459
+#: lily-guile.cc:453
#, c-format
msgid "type check for `%s' failed; value `%s' must be of type `%s'"
msgstr ""
"la vérification du type de « %s » a échoué ; \n"
" la valeur « %s » doit être du type « %s »"
-#: main.cc:109
+#: main.cc:107
#, c-format
msgid ""
"This program is free software. It is covered by the GNU General Public\n"
"sous certaines conditions.\n"
"Invoquez « %s --warranty » pour plus d'informations.\n"
-#: main.cc:115
+#: main.cc:113
msgid ""
" This program is free software; you can redistribute it and/or\n"
-"modify it under the terms of the GNU General Public License version 2\n"
-"as published by the Free Software Foundation.\n"
+"modify it under the terms of the GNU General Public License as \n"
+"published by the Free Software Foundation, either version 3 of\n"
+"the License, or (at your option) any later version.\n"
"\n"
" This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
" écrire à la Free Software Foundation, Inc., 59 Temple Place - Suite 330, \n"
"Boston, MA 02111-1307, USA.\n"
-#: main.cc:146
+#: main.cc:147
msgid "SYM[=VAL]"
msgstr "SYM[=VAL]"
-#: main.cc:147
+#: main.cc:148
msgid ""
"set Scheme option SYM to VAL (default: #t).\n"
"Use -dhelp for help."
"à l'option Scheme SYM.\n"
"Utiliser -dhelp pour avoir de l'aide."
-#: main.cc:150
+#: main.cc:152
msgid "EXPR"
msgstr "EXPR"
-#: main.cc:150
+#: main.cc:152
msgid "evaluate scheme code"
msgstr "évaluation du code Scheme"
#. Bug in option parser: --output =foe is taken as an abbreviation
#. for --output-format.
-#: main.cc:153
+#: main.cc:155
msgid "FORMATs"
msgstr "FORMATs"
-#: main.cc:153
+#: main.cc:155
msgid "dump FORMAT,... Also as separate options:"
msgstr ""
"produire FORMAT,...\n"
"Aussi comme options séparées :"
-#: main.cc:154
+#: main.cc:156
msgid "generate PDF (default)"
msgstr "générer le PDF (par défaut)"
-#: main.cc:155
+#: main.cc:157
msgid "generate PNG"
msgstr "générer le PNG"
-#: main.cc:156
+#: main.cc:158
msgid "generate PostScript"
msgstr "générer le PostScript"
-#: main.cc:158
+#: main.cc:161
msgid "FIELD"
msgstr "CHAMP"
-#: main.cc:158
+#: main.cc:161
msgid ""
"dump header field FIELD to file\n"
"named BASENAME.FIELD"
"écrire le champ d'entête CHAMP dans le\n"
"fichier nommé BASENAME.CHAMP"
-#: main.cc:160
+#: main.cc:164
msgid "add DIR to search path"
msgstr "ajouter RÉPERTOIRE au chemin de recherche"
-#: main.cc:161
+#: main.cc:165
msgid "use FILE as init file"
msgstr ""
"utiliser FICHIER comme\n"
"fichier d'initialisation"
-#: main.cc:163
+#: main.cc:168
msgid "USER, GROUP, JAIL, DIR"
msgstr "USER,GROUP,CAGE,RÉP"
-#: main.cc:163
+#: main.cc:168
msgid ""
"chroot to JAIL, become USER:GROUP\n"
"and cd into DIR"
"chroot dans CAGE, devenir UTILISATEUR:GROUPE\n"
"et cd dans RÉPERTOIRE"
-#: main.cc:166
+#: main.cc:172
msgid "write output to FILE (suffix will be added)"
msgstr ""
"produire la sortie dans FICHIER \n"
"(adjonction automatique du suffixe)"
-#: main.cc:167
+#: main.cc:173
msgid "relocate using directory of lilypond program"
msgstr ""
"redétermine le chemin d'exécution\n"
"des composants de LilyPond"
#. Do not update the copyright years here, run `make grand-replace'
-#: main.cc:238
+#: main.cc:242
#, c-format
msgid ""
"Copyright (c) %s by\n"
"%s et autres."
#. No version number or newline here. It confuses help2man.
-#: main.cc:265
+#: main.cc:269
#, c-format
msgid "Usage: %s [OPTION]... FILE..."
msgstr "Utilisation : %s [OPTIONS]... FICHIER..."
-#: main.cc:267
+#: main.cc:271
msgid "Typeset music and/or produce MIDI from FILE."
msgstr "Composer la musique ou jouer en format MIDI à partir du FICHIER"
-#: main.cc:269
+#: main.cc:273
msgid "LilyPond produces beautiful music notation."
msgstr "LilyPond produit une jolie notation musicale"
-#: main.cc:271
+#: main.cc:275
#, c-format
msgid "For more information, see %s"
msgstr "Pour plus d'informations, voir %s"
-#: main.cc:273
+#: main.cc:277
msgid "Options:"
msgstr "Options :"
-#: main.cc:327
+#: main.cc:331
#, c-format
msgid "expected %d arguments with jail, found: %u"
msgstr "une cage requiert %d arguments, il y en a %u"
-#: main.cc:341
+#: main.cc:345
#, c-format
msgid "no such user: %s"
msgstr "utilisateur inconnu : « %s »"
-#: main.cc:343
+#: main.cc:347
#, c-format
msgid "cannot get user id from user name: %s: %s"
msgstr ""
"impossible de repérer l'identifiant utilisateur à partir du nom d'utilisateur :\n"
"%s : %s"
-#: main.cc:358
+#: main.cc:362
#, c-format
msgid "no such group: %s"
msgstr "groupe inconnu : %s"
-#: main.cc:360
+#: main.cc:364
#, c-format
msgid "cannot get group id from group name: %s: %s"
msgstr ""
"impossible de repérer l'identifiant groupe à partir du nom de groupe :\n"
"%s : %s "
-#: main.cc:368
+#: main.cc:372
#, c-format
msgid "cannot chroot to: %s: %s"
msgstr "impossible de chrooter vers : %s : %s"
-#: main.cc:375
+#: main.cc:379
#, c-format
msgid "cannot change group id to: %d: %s"
msgstr "impossible de changer l'identifiant de groupe en %d : %s"
-#: main.cc:381
+#: main.cc:385
#, c-format
msgid "cannot change user id to: %d: %s"
msgstr "impossible de changer l'identifiant utilisateur en %d : %s"
-#: main.cc:387
+#: main.cc:391
#, c-format
msgid "cannot change working directory to: %s: %s"
msgstr "impossible de changer le répertoire de travail en %s : %s"
-#: main.cc:628
+#: main.cc:631
#, c-format
msgid "exception caught: %s"
msgstr "exception capturée : %s"
-#: key-signature-interface.cc:78
+#: key-signature-interface.cc:77
#, c-format
msgid "No glyph found for alteration: %s"
msgstr "Pas de glyphe pour l'altération « %s »"
-#: key-signature-interface.cc:88
+#: key-signature-interface.cc:87
msgid "alteration not found"
msgstr "altération non trouvée"
msgid "dot `%s' not found"
msgstr "point « %s » introuvable"
-#: translator.cc:359
+#: translator.cc:356
#, c-format
msgid "Two simultaneous %s events, junking this one"
msgstr "Deux événements %s simultanés, rejet de celui-ci"
-#: translator.cc:360
+#: translator.cc:357
#, c-format
msgid "Previous %s event here"
msgstr "Événement %s précédent ici"
-#: glissando-engraver.cc:105
+#: glissando-engraver.cc:156
msgid "unterminated glissando"
msgstr "glissando non terminé"
-#: text-spanner-engraver.cc:73
+#: text-spanner-engraver.cc:72
msgid "cannot find start of text spanner"
msgstr "impossible de repérer le point de départ de l'extension de texte"
-#: text-spanner-engraver.cc:86
+#: text-spanner-engraver.cc:85
msgid "already have a text spanner"
msgstr "a déjà une extension de texte"
-#: text-spanner-engraver.cc:132
+#: text-spanner-engraver.cc:130
msgid "unterminated text spanner"
msgstr "extension de texte non terminée"
#: clef.cc:65
#, c-format
msgid "clef `%s' not found"
-msgstr "clé `%s' introuvable"
+msgstr "clé « %s » introuvable"
#.
#. Todo: should make typecheck?
msgid "strange time signature found: %d/%d"
msgstr "Chiffrage de mesure inhabituel : %d/%d"
-#: lily-parser-scheme.cc:82
+#: lily-parser-scheme.cc:83
#, c-format
msgid "Changing working directory to: `%s'"
-msgstr "Modification du répertoire de travail pour « %s »"
+msgstr ""
+"Modification du répertoire de travail pour\n"
+" « %s »"
-#: lily-parser-scheme.cc:99
+#: lily-parser-scheme.cc:100
#, c-format
msgid "cannot find init file: `%s'"
msgstr "impossible de trouver le fichier d'initialisation « %s »"
msgid "Processing `%s'"
msgstr "Traitement de « %s »"
-#: lily-parser-scheme.cc:204
+#: lily-parser-scheme.cc:203
msgid "ly:parser-parse-string is only valid with a new parser. Use ly:parser-include-string instead."
msgstr ""
"ly:parser-parse-string ne peut foncionner qu'avec un nouvel analyseur.\n"
msgid "custos `%s' not found"
msgstr "custode « %s » introuvable"
-#: program-option-scheme.cc:237
+#: program-option-scheme.cc:232
#, c-format
msgid "no such internal option: %s"
msgstr "option interne inconnue : %s"
msgid "cannot resolve rest collision: rest direction not set"
msgstr "collision de silences insoluble : positionnement du silence indéterminée"
-#: rest-collision.cc:160 rest-collision.cc:205
+#: rest-collision.cc:160 rest-collision.cc:275
msgid "too many colliding rests"
msgstr "trop de silences se chevauchent"
+#: pdf-scheme.cc:50
+#, c-format
+msgid "Conversion of string `%s' to UTF-16be failed: %s"
+msgstr ""
+"La conversion de la chaîne « %s » en UTF-16be a échoué :\n"
+" %s"
+
#: episema-engraver.cc:75
msgid "already have an episema"
msgstr "épisème déjà présent"
msgid "%d: %s"
msgstr "%d : %s"
-#: grob-property.cc:173
+#: grob-property.cc:169
#, c-format
msgid "cyclic dependency: calculation-in-progress encountered for #'%s (%s)"
msgstr "dépendance circulaire : calculation-in-progress rencontrée pour #'%s (%s)"
-#: relocate.cc:54
+#: relocate.cc:53
#, c-format
msgid "Setting %s to %s"
msgstr "%s fixé à %s"
-#: relocate.cc:74
+#: relocate.cc:73
#, c-format
msgid "no such file: %s for %s"
msgstr "fichier inexistant : %s pour %s"
-#: relocate.cc:84 relocate.cc:102
+#: relocate.cc:83 relocate.cc:101
#, c-format
msgid "no such directory: %s for %s"
msgstr "répertoire inexistant : %s pour %s"
-#: relocate.cc:94
+#: relocate.cc:93
#, c-format
msgid "%s=%s (prepend)\n"
msgstr "%s=%s (ajout)\n"
-#: relocate.cc:124
+#: relocate.cc:123
#, c-format
msgid "not relocating, no %s/ or current/ found under %s"
msgstr "relocalisation non effectuée, ni %s/ ni courrant/ n'existent sous %s"
-#: relocate.cc:135
+#: relocate.cc:134
#, c-format
msgid "Relocation: compile datadir=%s, new datadir=%s"
msgstr "Relocalisation : datadir de compilation=%s, nouveau datadir=%s"
-#: relocate.cc:148
+#: relocate.cc:147
#, c-format
msgid "Relocation: framework_prefix=%s"
msgstr "Relocalisation : framework_prefix=%s"
-#: relocate.cc:189
+#: relocate.cc:188
#, c-format
msgid "Relocation: is absolute: argv0=%s"
msgstr "Relocalisation : argv0=%s est absolu"
-#: relocate.cc:196
+#: relocate.cc:195
#, c-format
msgid "Relocation: from cwd: argv0=%s"
msgstr "Relocalisation : argv0=%s à partir du répertoire courant"
-#: relocate.cc:213
+#: relocate.cc:212
#, c-format
msgid ""
"Relocation: from PATH=%s\n"
"Relocalisation : à partir de PATH=%s\n"
"argv0=%s"
-#: relocate.cc:240
+#: relocate.cc:239
msgid "LILYPONDPREFIX is obsolete, use LILYPOND_DATADIR"
msgstr "LILYPONDPREFIX est obsolète, utiliser LILYPOND_DATADIR"
-#: relocate.cc:367
+#: relocate.cc:365
#, c-format
msgid "Relocation file: %s"
msgstr "Fichier de relocalisation : %s"
-#: relocate.cc:373 source-file.cc:65
+#: relocate.cc:371 source-file.cc:65
#, c-format
msgid "cannot open file: `%s'"
msgstr "Impossible d'ouvrir le fichier « %s »"
-#: relocate.cc:403
+#: relocate.cc:401
#, c-format
msgid "Unknown relocation command %s"
msgstr "Commande de relocalisation inconnue : %s"
+#: gregorian-ligature-engraver.cc:70
+#, c-format
+msgid "\\%s ignored"
+msgstr "\\%s ignoré(e)"
+
+#: gregorian-ligature-engraver.cc:75
+#, c-format
+msgid "implied \\%s added"
+msgstr "\\%s implicite ajouté(e)"
+
+#. ligature may not start with 2nd head of pes or flexa
+#: gregorian-ligature-engraver.cc:224
+msgid "cannot apply `\\~' on first head of ligature"
+msgstr "Impossible d'appliquer « \\~ » à la première tête de ligature"
+
+#. (pitch == prev_pitch)
+#: gregorian-ligature-engraver.cc:236
+msgid "cannot apply `\\~' on heads with identical pitch"
+msgstr "Impossible d'appliquer « \\~ » à des têtes ayant la même hauteur"
+
#: translator-group.cc:188
#, c-format
msgid "cannot find: `%s'"
msgid "unterminated phrasing slur"
msgstr "liaison de phrasé non terminée"
-#: lyric-engraver.cc:176
+#: phrasing-slur-engraver.cc:182
+msgid "cannot end phrasing slur"
+msgstr "impossible de terminer la liaison de phrasé"
+
+#: phrasing-slur-engraver.cc:196
+msgid "already have phrasing slur"
+msgstr "il y a déjà une liaison de phrasé"
+
+#: lyric-engraver.cc:186
msgid "Lyric syllable does not have note. Use \\lyricsto or associatedVoice."
msgstr "Syllabe sans note de rattachement. Utiliser \\lyricsto ou associatedVoice."
-#: page-breaking.cc:248
+#: page-breaking.cc:274
msgid "ignoring min-systems-per-page and max-systems-per-page because systems-per-page was set"
msgstr ""
"systems-per-page non défini :\n"
" min-systems-per-page et max-systems-per-page ignorés"
-#: page-breaking.cc:253
+#: page-breaking.cc:279
msgid "min-systems-per-page is larger than max-systems-per-page, ignoring both values"
msgstr ""
"min-systems-per-page supérieur à max-systems-per-page :\n"
" tous deux seront ignorés"
-#: performance.cc:54
+#: performance.cc:55
msgid "Track..."
msgstr "Piste..."
-#: performance.cc:83
-msgid "MIDI channel wrapped around"
-msgstr "Bouclage du canal MIDI"
-
-#: performance.cc:84
-msgid "remapping modulo 16"
-msgstr "réaffectation modulo 16"
-
-#: performance.cc:111
+#: performance.cc:85
#, c-format
msgid "MIDI output to `%s'..."
msgstr "Sortie MIDI vers « %s »..."
msgid "No tuplet to end"
msgstr "Aucun n-olet à terminer"
-#: gregorian-ligature-engraver.cc:70
-#, c-format
-msgid "\\%s ignored"
-msgstr "\\%s ignoré(e)"
-
-#: gregorian-ligature-engraver.cc:75
-#, c-format
-msgid "implied \\%s added"
-msgstr "\\%s implicite ajouté(e)"
-
-#. ligature may not start with 2nd head of pes or flexa
-#: gregorian-ligature-engraver.cc:224
-msgid "cannot apply `\\~' on first head of ligature"
-msgstr "Impossible d'appliquer « \\~ » à la première tête de ligature"
-
-#. (pitch == prev_pitch)
-#: gregorian-ligature-engraver.cc:236
-msgid "cannot apply `\\~' on heads with identical pitch"
-msgstr "Impossible d'appliquer « \\~ » à des têtes ayant la même hauteur"
-
#: chord-tremolo-engraver.cc:88
msgid "No tremolo to end"
-msgstr "Il n'y a aucun trémolo à terminer"
+msgstr "Aucun trémolo à terminer"
#: chord-tremolo-engraver.cc:109
msgid "unterminated chord tremolo"
msgid "expected to read %d characters, got %d"
msgstr "au lieu de %d caractères à lire, il y en a %d"
-#: axis-group-interface.cc:631
+#: axis-group-interface.cc:627
msgid "an outside-staff object should have a direction, defaulting to up"
msgstr ""
"un objet externe à la portée devrait avoir un positionnement.\n"
-"Placé par défaut au-dessus."
+" Placé par défaut au-dessus."
-#: coherent-ligature-engraver.cc:111
+#: coherent-ligature-engraver.cc:110
#, c-format
msgid "Coherent_ligature_engraver: setting `spacing-increment=0.01': ptr=%ul"
msgstr "Coherent_ligature_engraver : initialise `spacing-increment=0.01': ptr=%ul"
-#: percent-repeat-engraver.cc:148
+#: percent-repeat-engraver.cc:147
msgid "unterminated percent repeat"
msgstr "répétition en pourcent non terminée"
-#: note-head.cc:76
+#: note-head.cc:75
#, c-format
msgid "none of note heads `%s' or `%s' found"
msgstr "tête de note « %s » ou « %s » non trouvée"
msgid " scheme encoding: "
msgstr "encodage Scheme : "
-#: all-font-metrics.cc:156
+#: all-font-metrics.cc:153
#, c-format
msgid "cannot find font: `%s'"
msgstr "fonte « %s » introuvable"
-#: property-iterator.cc:85
+#: property-iterator.cc:93
#, c-format
msgid "not a grob name, `%s'"
msgstr " « %s » n'est pas un nom d'objet graphique (grob)"
#: bar-check-iterator.cc:84
#, c-format
msgid "barcheck failed at: %s"
-msgstr "échec du contrôle de mesure (barcheck) à : %s"
+msgstr "échec du contrôle de mesure (barcheck) à %s"
-#: stem.cc:116
+#: stem.cc:114
msgid "weird stem size, check for narrow beams"
msgstr "taille de hampe bizarre ; vérifier la présence de liens étroits"
-#: stem.cc:657
+#: stem.cc:652
#, c-format
msgid "flag `%s' not found"
msgstr "crochet inconnu : « %s »"
-#: stem.cc:673
+#: stem.cc:668
#, c-format
msgid "flag stroke `%s' not found"
msgstr "type de crochet inconnu : « %s »"
msgid "\tprevious break: %d"
msgstr " coupure précédente : %d"
-#: lily-parser.cc:106
+#: lily-parser.cc:105
msgid "Parsing..."
msgstr "Analyse..."
-#: lily-parser.cc:134
+#: lily-parser.cc:133
msgid "braces do not match"
msgstr "accolades non pairées"
-#: score.cc:178
+#: score.cc:176
msgid "already have music in score"
msgstr "il y a déjà de la musique dans la partition"
-#: score.cc:179
+#: score.cc:177
msgid "this is the previous music"
msgstr "voici la musique précédente"
-#: score.cc:184
+#: score.cc:182
msgid "errors found, ignoring music expression"
msgstr "suite à des erreurs répétées, l'expression musicale sera ignorée"
#: grob-interface.cc:79
#, c-format
msgid "Grob `%s' has no interface for property `%s'"
-msgstr "L'objet graphique (Grob) « %s » n'a pas d'interface pour la propriété « %s »"
+msgstr ""
+"L'objet graphique (Grob) « %s »\n"
+" n'a pas d'interface pour la propriété « %s »"
#: open-type-font.cc:44
#, c-format
msgid "FreeType error: %s"
msgstr "Erreur FreeType : %s"
-#: open-type-font.cc:111
+#: open-type-font.cc:110
#, c-format
msgid "unsupported font format: %s"
msgstr "format de police non supporté : %s"
-#: open-type-font.cc:113
+#: open-type-font.cc:112
#, c-format
msgid "error reading font file %s: %s"
msgstr "erreur de lecture du fichier de fontes %s : %s"
-#: open-type-font.cc:188
+#: open-type-font.cc:187
#, c-format
msgid "FT_Get_Glyph_Name () Freetype error: %s"
msgstr "erreur Freetype FT_Get_Glyph_Name () : %s"
msgid "cannot write to file: `%s'"
msgstr "impossible d'écrire dans le fichier « %s »"
-#: parser.yy:820
+#: parser.yy:825
msgid "\\paper cannot be used in \\score, use \\layout instead"
msgstr "dans la section \\score, utiliser \\layout au lieu de \\paper"
-#: parser.yy:844
+#: parser.yy:849
msgid "need \\paper for paper block"
msgstr "\\paper est nécessaire pour définir les paramètres de la page"
-#: parser.yy:1363
+#: parser.yy:1369
msgid "only \\consists takes non-string argument."
msgstr "seul \\consists peut prendre un argument autre qu'une chaîne"
-#: parser.yy:1376
+#: parser.yy:1382
msgid "Grob name should be alphanumeric"
msgstr "Un nom de Grob devrait être alphanumérique"
-#: parser.yy:1685
+#: parser.yy:1697
msgid "second argument must be pitch list"
msgstr "le second argument doit être une liste de hauteurs"
-#: parser.yy:1716 parser.yy:1721 parser.yy:2194
+#: parser.yy:1728 parser.yy:1733 parser.yy:2206
msgid "have to be in Lyric mode for lyrics"
msgstr "doit être en mode Lyric pour des paroles"
-#: parser.yy:1818
+#: parser.yy:1830
msgid "expecting string as script definition"
msgstr "chaîne requise pour définir un script"
-#: parser.yy:1973 parser.yy:2024
+#: parser.yy:1985 parser.yy:2036
#, c-format
msgid "not a duration: %d"
msgstr "%d n'est pas une durée"
-#: parser.yy:2148
+#: parser.yy:2160
msgid "have to be in Note mode for notes"
msgstr "doit être en mode Note pour des notes"
-#: parser.yy:2209
+#: parser.yy:2221
msgid "have to be in Chord mode for chords"
msgstr "doit être en mode Chord pour des accords"
-#: lexer.ll:190
+#: lexer.ll:192
msgid "stray UTF-8 BOM encountered"
msgstr "parasitage par UTF-8 BOM"
-#: lexer.ll:194
+#: lexer.ll:196
msgid "Skipping UTF-8 BOM"
msgstr "Escamotage d'UTF-8 BOM"
-#: lexer.ll:249
+#: lexer.ll:251
#, c-format
msgid "Renaming input to: `%s'"
msgstr "L'entrée a été renommée en « %s »"
-#: lexer.ll:266
+#: lexer.ll:268
msgid "quoted string expected after \\version"
msgstr "\\version doit être suivi d'une chaîne entre guillemets"
-#: lexer.ll:270
+#: lexer.ll:272
msgid "quoted string expected after \\sourcefilename"
msgstr "\\sourcefilename doit être suivi d'une chaîne entre guillemets"
-#: lexer.ll:274
+#: lexer.ll:276
msgid "integer expected after \\sourcefileline"
msgstr "\\sourcefilename doit être suivi d'un nombre entier"
-#: lexer.ll:287
+#: lexer.ll:289
msgid "EOF found inside a comment"
msgstr "Fin de fichier (EOF) à l'intérieur du commentaire"
-#: lexer.ll:302
+#: lexer.ll:304
msgid "\\maininput not allowed outside init files"
msgstr "\\maininput n'est pas permis en dehors des fichiers d'initialisation"
-#: lexer.ll:326
+#: lexer.ll:328
#, c-format
msgid "wrong or undefined identifier: `%s'"
msgstr "identificateur erroné ou non défini : « %s »"
#. backup rule
-#: lexer.ll:335
+#: lexer.ll:337
msgid "end quote missing"
msgstr "absence de guillemet fermant"
-#: lexer.ll:485
+#: lexer.ll:487
msgid "Brace found at end of lyric. Did you forget a space?"
msgstr "Accolade repérée à la fin d'une parole. Manquerait-il une espace ?"
-#: lexer.ll:595
+#: lexer.ll:597
msgid "Brace found at end of markup. Did you forget a space?"
msgstr "Accolade repérée à la fin d'un \"markup\". Manquerait-il une espace ?"
-#: lexer.ll:699
+#: lexer.ll:701
#, c-format
msgid "invalid character: `%c'"
msgstr "caractère invalide : « %c »"
-#: lexer.ll:814 lexer.ll:815
+#: lexer.ll:822 lexer.ll:823
#, c-format
msgid "unknown escaped string: `\\%s'"
msgstr "chaîne d'échappement inconnue : « \\%s »"
-#: lexer.ll:924 lexer.ll:925
+#: lexer.ll:932 lexer.ll:933
#, c-format
msgid "file too old: %s (oldest supported: %s)"
msgstr ""
"%s est plus qu'obsolète ;\n"
"le plus ancien pouvant être supporté est %s"
-#: lexer.ll:925 lexer.ll:926
+#: lexer.ll:933 lexer.ll:934
msgid "consider updating the input with the convert-ly script"
msgstr "Envisagez la mise à jour de la source à l'aide du script convert-ly"
-#: lexer.ll:931 lexer.ll:932
+#: lexer.ll:939 lexer.ll:940
#, c-format
msgid "program too old: %s (file requires: %s)"
msgstr "Programme plus qu'obsolète : %s (le fichier requiert %s)"
msgid "Writing ~S..."
msgstr "Écriture de ~S..."
-#: documentation-lib.scm:198
+#: documentation-lib.scm:184
+#, scheme-format
+msgid "cannot find description for property `~S' (~S)"
+msgstr ""
+"impossible de trouver une description de la propriété « ~S »\n"
+" (~S)"
+
+#: documentation-lib.scm:205
#, scheme-format
msgid "cannot find description for property ~S (~S)"
-msgstr "impossible de trouver une description de la propriété ~S (~S)"
+msgstr ""
+"impossible de trouver une description de la propriété ~S\n"
+" (~S)"
#: parser-clef.scm:141 parser-clef.scm:181
#, scheme-format
msgid "symbol ~S redefined"
msgstr "symbole « ~S » redéfini"
-#: paper.scm:115
+#: paper.scm:117
msgid "set-global-staff-size: not in toplevel scope"
msgstr "set-global-staff-size n'est pas à un niveau de portée globale"
-#: paper.scm:296
+#: paper.scm:301
#, scheme-format
msgid "This is not a \\layout {} object, ~S"
msgstr "~S n'est pas un objet de \\layout {}"
-#: paper.scm:308
+#: paper.scm:313
#, scheme-format
msgid "Unknown paper size: ~a"
msgstr "Format de papier inconnu : ~a"
#. TODO: should raise (generic) exception with throw, and catch
#. that in parse-scm.cc
-#: paper.scm:323
+#: paper.scm:328
msgid "Must use #(set-paper-size .. ) within \\paper { ... }"
msgstr "#(set-paper-size ..) doit être dans la section \\paper { ... }"
#: lily.scm:350
#, scheme-format
msgid "wrong type for argument ~a. Expecting ~a, found ~s"
-msgstr "type d'argument erroné pour ~a. Attendait ~a, ~s trouvé"
+msgstr ""
+"type d'argument erroné pour ~a.\n"
+" Attendait ~a, ~s trouvé"
-#: lily.scm:716
+#: lily.scm:710
msgid "Compilation successfully completed"
msgstr "Compilation menée à son terme, avec succès."
-#: lily.scm:717
+#: lily.scm:711
msgid "Compilation completed with warnings or errors"
msgstr "Compilation menée à son terme, avec des avertissements ou erreurs."
-#: lily.scm:779
+#: lily.scm:773
#, scheme-format
msgid "job ~a terminated with signal: ~a"
msgstr "le travail ~a s'est terminé avec le signal ~a"
-#: lily.scm:782
+#: lily.scm:776
#, scheme-format
msgid ""
"logfile ~a (exit ~a):\n"
"fichier journal ~a (sortie ~a) :\n"
"~a"
-#: lily.scm:804 lily.scm:882
+#: lily.scm:798 lily.scm:876
#, scheme-format
msgid "failed files: ~S"
msgstr "erreur sur les fichiers ~S"
-#: lily.scm:873
+#: lily.scm:867
#, scheme-format
msgid "Redirecting output to ~a..."
msgstr "Redirection de la sortie vers ~a..."
-#: lily.scm:892
+#: lily.scm:886
#, scheme-format
msgid "Invoking `~a'...\n"
msgstr "Appel de « ~a »...\n"
#: modal-transforms.scm:46
msgid "pitch to be transposed not in scale; ignoring"
-msgstr "hauteur à laquelle transposer absente de la gamme ; ignorée"
+msgstr "hauteur à laquelle transposer absente de la gamme ; rien à transposer"
#: modal-transforms.scm:71
msgid "'around' pitch not in scale; ignoring"
#: modal-transforms.scm:79
msgid "pitch to be inverted not in scale; ignoring"
-msgstr "hauteur d'inversion absente de la gamme : ignorée"
+msgstr "hauteur d'inversion absente de la gamme : rien à transposer"
#: modal-transforms.scm:95
msgid "negative replication count; ignoring"
msgid "Found infinity or nan in output. Substituting 0.0"
msgstr "Détection d'une valeur infini ou non numérique. Substitution par 0.0"
-#: output-ps.scm:289 output-svg.scm:550
+#: output-ps.scm:299 output-svg.scm:550
#, scheme-format
msgid "unknown line-cap-style: ~S"
msgstr "line-cap-style inconnu : ~S"
-#: output-ps.scm:294 output-svg.scm:556
+#: output-ps.scm:304 output-svg.scm:556
#, scheme-format
msgid "unknown line-join-style: ~S"
msgstr "line-join-style inconnu : ~S"
msgid "Could not find language `~a'. Ignoring."
msgstr "`~a' n'est pas une langue reconnue pour les noms de note. Abandon."
-#: define-music-types.scm:740
+#: define-music-types.scm:747
#, scheme-format
msgid "symbol expected: ~S"
msgstr "symbole requis : ~S"
-#: define-music-types.scm:743
+#: define-music-types.scm:750
#, scheme-format
msgid "cannot find music object: ~S"
msgstr "impossible de trouver l'objet de type musique : ~S"
-#: define-music-types.scm:762
+#: define-music-types.scm:769
#, scheme-format
msgid "unknown repeat type `~S'"
msgstr "type de répétition inconnu : « ~S »"
-#: define-music-types.scm:763
+#: define-music-types.scm:770
msgid "See define-music-types.scm for supported repeats"
msgstr "Consulter define-music-types.scm pour connaître les répétitions prises en charge"
-#: translation-functions.scm:341
+#: translation-functions.scm:350
#, scheme-format
msgid "Negative fret for pitch ~a on string ~a"
msgstr "La hauteur ~a sur la corde ~a donne un fret négatif"
-#: translation-functions.scm:385
+#: translation-functions.scm:401
#, scheme-format
msgid "No open string for pitch ~a"
msgstr "Pas de corde à vide pour la hauteur ~a"
-#: translation-functions.scm:400
+#: translation-functions.scm:416 translation-functions.scm:428
#, scheme-format
msgid "Requested string for pitch requires negative fret: string ~a pitch ~a"
-msgstr "Hauteur et corde requises demandent un fret négatif : corde ~a hauteur ~a"
+msgstr ""
+"Hauteur et corde requises demandent un fret négatif :\n"
+" corde ~a hauteur ~a"
-#: translation-functions.scm:401
-msgid "Ignoring string request."
-msgstr "Cette corde sera ignorée"
+#: translation-functions.scm:419
+msgid "Ignoring string request and recalculating."
+msgstr "Cette corde sera ignorée et redéfinie."
-#: translation-functions.scm:414
+#: translation-functions.scm:431
+msgid "Ignoring note in tablature."
+msgstr "Cette note sera ignorée dans la tablature."
+
+#: translation-functions.scm:454
#, scheme-format
msgid "No string for pitch ~a (given frets ~a)"
msgstr "Aucune corde ne contient la hauteur ~a avec un fret ~a"
-#: translation-functions.scm:515
+#: translation-functions.scm:559
#, scheme-format
msgid ""
"No label for fret ~a (on string ~a);\n"
msgid "do not know how to embed font ~s ~s ~s"
msgstr "impossible d'intégrer les fontes ~s ~s ~s"
-#: framework-ps.scm:669
+#: framework-ps.scm:686
msgid ""
"\n"
"The PostScript backend does not support the\n"
msgid "invalid tremolo repeat count: ~a"
msgstr "nombre de répétition en trémolo invalide : ~a"
-#: music-functions.scm:618
+#: music-functions.scm:619
#, scheme-format
msgid "music expected: ~S"
msgstr "~S requiert de la musique"
"Échec du contrôle de barre de mesure. \n"
"Aurait dû se trouver à ~a au lieu de ~a"
-#: music-functions.scm:846
+#: music-functions.scm:845
#, scheme-format
msgid "cannot find quoted music: `~S'"
msgstr "impossible de trouver la citation de musique « ~S »"
-#: music-functions.scm:982
+#: music-functions.scm:979
msgid "Add @var{octave-shift} to the octave of @var{pitch}."
msgstr "Ajoute @var{octave-shift} à l'octave de @var{hauteur}."
-#: music-functions.scm:1037
+#: music-functions.scm:1039
#, scheme-format
msgid "Unknown octaveness type: ~S "
msgstr "Octave inconnue : « ~S »"
-#: music-functions.scm:1038
+#: music-functions.scm:1040
msgid "Defaulting to 'any-octave."
msgstr "Application de la valeur par défaut 'any-octave."
#: define-event-classes.scm:155
#, scheme-format
msgid "translator listens to nonexisting event class ~A"
-msgstr "le traducteur écoute la classe d'événements ~A inexistante"
+msgstr "le traducteur écoute une classe d'événements ~A inexistante"
#: markup.scm:223
#, scheme-format
msgid "Wrong number of arguments. Expect: ~A, found ~A: ~S"
-msgstr "Nombre d'arguments erroné. Requis : ~A, présent(s) ~A : ~S"
+msgstr ""
+"Nombre d'arguments erroné : ~A requis, ~A présent(s) :\n"
+" ~S"
#: markup.scm:229
#, scheme-format
msgid "Invalid argument in position ~A. Expect: ~A, found: ~S."
-msgstr "Argument invalide à la position ~A. ~A attendu, ~S trouvé."
+msgstr ""
+"Argument invalide à la position ~A.\n"
+" ~A requis, trouvé ~S ."
#: markup.scm:292
#, scheme-format
msgid "Not a markup command: ~A"
-msgstr "~A n'est pas une commande de type « markup»"
+msgstr "~A n'est pas une commande de type « markup »"
#: ps-to-png.scm:74
#, scheme-format
msgid "~a exited with status: ~S"
msgstr "~a s'est terminé avec le statut ~S"
-#: define-markup-commands.scm:803
+#: define-markup-commands.scm:883
msgid "no systems found in \\score markup, does it have a \\layout block?"
msgstr "pas de système trouvé dans le bloc \\score, contient-il un bloc \\layout ?"
-#: define-markup-commands.scm:2404
+#: define-markup-commands.scm:2561
#, scheme-format
msgid "Cannot find glyph ~a"
msgstr "impossible de trouver le glyphe ~a"
-#: define-markup-commands.scm:2830
+#: define-markup-commands.scm:2987
#, scheme-format
msgid "no brace found for point size ~S "
msgstr "il n'y a pas d'accolade qui fasse ~S points"
-#: define-markup-commands.scm:2831
+#: define-markup-commands.scm:2988
#, scheme-format
msgid "defaulting to ~S pt"
msgstr "application de la taille par défaut (~S pt)"
-#: define-markup-commands.scm:2984
+#: define-markup-commands.scm:3141
#, scheme-format
msgid "not a valid duration string: ~a"
msgstr "chaîne de durée invalide : ~a"
#
# Tineke de Munnik <jantien@xs4all.nl>, 1998.
# Maurizio Umberto Puxeddu <umbpux@tin.it>, 1999
-# Federico Bruni <fedelogy@gmail.com>, 2010-2011, 2011.
+# Federico Bruni <fedelogy@gmail.com>, 2009-2011.
#
msgid ""
msgstr ""
-"Project-Id-Version: lilypond 2.13.53\n"
+"Project-Id-Version: lilypond 2.15.9\n"
"Report-Msgid-Bugs-To: http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs\n"
-"POT-Creation-Date: 2011-03-02 10:34+0100\n"
-"PO-Revision-Date: 2011-04-05 00:25+0200\n"
+"POT-Creation-Date: 2011-08-02 19:43+0200\n"
+"PO-Revision-Date: 2011-08-08 00:25+0200\n"
"Last-Translator: Federico Bruni <fedelogy@gmail.com>\n"
"Language-Team: Italian <tp@lists.linux.it>\n"
"Language: it\n"
msgid "%s has been replaced by %s"
msgstr "%s è stato sostituito da %s"
-#: convertrules.py:24 lilylib.py:78 musicexp.py:17 convert-ly.py:64 warn.cc:66
-#: input.cc:109
+#: convertrules.py:24 lilylib.py:85 musicexp.py:17 convert-ly.py:64 warn.cc:66
+#: input.cc:108
#, c-format, python-format
msgid "warning: %s"
msgstr "attenzione: %s"
#: convertrules.py:86 convertrules.py:1905 convertrules.py:2084
#: convertrules.py:2236 convertrules.py:2566 convertrules.py:2862
+#: convertrules.py:3206
msgid "bump version for release"
msgstr "aumentare il numero di versione per il rilascio"
msgid "woodwind-diagrams. Clarinet fingering changed to reflect actual anatomy of instrument.\n"
msgstr "woodwind-diagrams. La diteggiatura del clarinetto è stata modificata per riflettere l'effettiva anatomia dello strumento.\n"
+#: convertrules.py:3211
+msgid "Change in internal property for MultiMeasureRest"
+msgstr "Modifica della proprietà interna di MultiMeasureRest"
+
+#: convertrules.py:3214
+msgid "use-breve-rest. This internal property has been replaced by round-to-longer-rest and usable-duration-logs.\n"
+msgstr "use-breve-rest. Questa proprietà interna è stata sostituita da round-to-longer-rest e usable-duration-logs.\n"
+
+#: convertrules.py:3219
+msgid "Handling of non-automatic footnotes."
+msgstr "Gestione delle note a pié di pagina non automatiche."
+
+#: convertrules.py:3223
+msgid "If you are using non-automatic footnotes, make sure to set footnote-auto-numbering = ##f in the paper block.\n"
+msgstr "Se si sta usando note a pié di pagina non automatiche, occorre impostare footnote-auto-numbering = ##f nel blocco paper.\n"
+
#: book_base.py:24
#, python-format
msgid "file not found: %s"
msgid "Output function not implemented"
msgstr "Funzione di output non implementata"
-#: lilylib.py:81 musicxml.py:13 convert-ly.py:67 warn.cc:72 input.cc:115
-#: input.cc:123
+#: lilylib.py:88 musicxml.py:13 convert-ly.py:67 warn.cc:72 input.cc:114
+#: input.cc:122
#, c-format, python-format
msgid "error: %s"
msgstr "errore: %s"
-#: lilylib.py:124 lilylib.py:175
+#: lilylib.py:131
+#, python-format
+msgid "Processing %s.ly"
+msgstr "Elaborazione di %s.ly"
+
+#: lilylib.py:135 lilylib.py:198
#, python-format
msgid "Invoking `%s'"
msgstr "Invocazione di «%s»"
-#: lilylib.py:126 lilylib.py:177
+#: lilylib.py:137 lilylib.py:200
#, python-format
msgid "Running %s..."
msgstr "Esecuzione di %s..."
-#: lilylib.py:253
+#: lilylib.py:276
#, python-format
msgid "Usage: %s"
msgstr "Uso: %s"
msgid "cannot find \\begin{document} in LaTeX document"
msgstr "impossibile trovare \\begin{document} nel documento LaTeX"
-#: musicxml2ly.py:223
+#: musicxml2ly.py:224
#, python-format
msgid "Encountered file created by %s, containing wrong beaming information. All beaming information in the MusicXML file will be ignored"
msgstr "Si è trovato un file creato da %s che contiene informazioni sbagliate sulla disposizione delle travature. Tutte le informazioni sulle travature presenti nel file MusicXML verranno ignorate"
-#: musicxml2ly.py:239 musicxml2ly.py:241
+#: musicxml2ly.py:240 musicxml2ly.py:242
#, python-format
msgid "Unprocessed PartGroupInfo %s encountered"
msgstr "PartGroupInfo %s rilevato ma non elaborato"
-#: musicxml2ly.py:494
+#: musicxml2ly.py:495
#, python-format
msgid "Encountered note at %s without type and duration (=%s)"
msgstr "Trovata una nota in %s senza tipo e durata (=%s)"
-#: musicxml2ly.py:514
+#: musicxml2ly.py:515
#, python-format
msgid "Encountered rational duration with denominator %s, unable to convert to lilypond duration"
msgstr "Trovata una durata razionale con denominatore %s, impossibile convertire in una durata di lilypond"
-#: musicxml2ly.py:761
+#: musicxml2ly.py:762
msgid "Unable to extract key signature!"
msgstr "Impossibile estrarre l'armatura di chiave!"
-#: musicxml2ly.py:788
+#: musicxml2ly.py:789
#, python-format
msgid "unknown mode %s, expecting 'major' or 'minor' or a church mode!"
msgstr "modo %s sconosciuto, è richiesto \"major\" o \"minor\" o un modo ecclesiastico!"
-#: musicxml2ly.py:926
+#: musicxml2ly.py:927
#, python-format
msgid "Encountered unprocessed marker %s\n"
msgstr "Trovato un marcatore non elaborato %s\n"
-#: musicxml2ly.py:1020
+#: musicxml2ly.py:1021
#, python-format
msgid "unknown span event %s"
msgstr "evento di estensione %s sconosciuto"
-#: musicxml2ly.py:1030
+#: musicxml2ly.py:1031
#, python-format
msgid "unknown span type %s for %s"
msgstr "tipo di estensione %s sconosciuto per %s"
-#: musicxml2ly.py:1450
+#: musicxml2ly.py:1451
msgid "Unknown metronome mark, ignoring"
msgstr "Indicazione metronomica sconosciuta, si ignora"
#. TODO: Implement the other (more complex) way for tempo marks!
-#: musicxml2ly.py:1455
+#: musicxml2ly.py:1456
msgid "Metronome marks with complex relations (<metronome-note> in MusicXML) are not yet implemented."
msgstr "Indicazioni metronomiche con relazioni complesse (<metronome-note> in MusicXML) non sono ancora implementate."
-#: musicxml2ly.py:1657
+#: musicxml2ly.py:1658
#, python-format
msgid "Unable to convert chord type %s to lilypond."
msgstr "Impossibile convertire l'accordo di tipo %s in un'espressione di lilypond."
-#: musicxml2ly.py:1806
+#: musicxml2ly.py:1807
#, python-format
msgid "drum %s type unknown, please add to instrument_drumtype_dict"
msgstr "tipo di percussione %s sconosciuto, si prega di aggiungerlo a instrument_drumtype_dict"
-#: musicxml2ly.py:1810
+#: musicxml2ly.py:1811
msgid "cannot find suitable event"
msgstr "impossibile trovare un evento adatto"
-#: musicxml2ly.py:1958
+#: musicxml2ly.py:1959
#, python-format
msgid "Negative skip %s (from position %s to %s)"
msgstr "Salto negativo %s (dalla posizione %s a %s)"
-#: musicxml2ly.py:2099
+#: musicxml2ly.py:2100
#, python-format
msgid "Negative skip found: from %s to %s, difference is %s"
msgstr "Trovato un salto negativo: da %s a %s, la differenza è %s"
-#: musicxml2ly.py:2180
+#: musicxml2ly.py:2181
#, python-format
msgid "unexpected %s; expected %s or %s or %s"
msgstr "%s inaspettato; previsto %s o %s o %s"
-#: musicxml2ly.py:2286
+#: musicxml2ly.py:2287
msgid "Encountered closing slur, but no slur is open"
msgstr "Trovata la chiusura di una legatura di portamento, ma non ne è stata aperta alcuna"
-#: musicxml2ly.py:2289
+#: musicxml2ly.py:2290
msgid "Cannot have two simultaneous (closing) slurs"
msgstr "Due legature di portamento non possono chiudersi simultaneamente"
-#: musicxml2ly.py:2298
+#: musicxml2ly.py:2299
msgid "Cannot have a slur inside another slur"
msgstr "Due legature di portamento non possono sovrapporsi"
-#: musicxml2ly.py:2301
+#: musicxml2ly.py:2302
msgid "Cannot have two simultaneous slurs"
msgstr "Due legature di portamento non possono intervenire simultaneamente"
-#: musicxml2ly.py:2435
+#: musicxml2ly.py:2436
#, python-format
msgid "cannot simultaneously have more than one mode: %s"
msgstr "non si può avere simultaneamente più di un modo: %s"
-#: musicxml2ly.py:2543
+#: musicxml2ly.py:2544
msgid "Converting to LilyPond expressions..."
msgstr "Conversione nelle espressioni di LilyPond..."
-#: musicxml2ly.py:2554
+#: musicxml2ly.py:2555
msgid "musicxml2ly [OPTION]... FILE.xml"
msgstr "musicxml2ly [OPZIONE]... FILE.xml"
-#: musicxml2ly.py:2556
+#: musicxml2ly.py:2557
msgid ""
"Convert MusicXML from FILE.xml to LilyPond input.\n"
"If the given filename is -, musicxml2ly reads from the command line.\n"
"Converte FILE.xml (MusicXML) in input di LilyPond.\n"
"Se il nome del file è -, musicxml2ly legge dalla riga di comando.\n"
-#: musicxml2ly.py:2562 midi2ly.py:987 abc2ly.py:1386 lilypond-book.py:140
-#: convert-ly.py:98 etf2ly.py:1202 main.cc:157
+#: musicxml2ly.py:2563 midi2ly.py:1060 abc2ly.py:1386 lilypond-book.py:140
+#: convert-ly.py:98 etf2ly.py:1202 main.cc:159
msgid "show this help and exit"
msgstr "mostra questo messaggio di aiuto ed esce"
-#: musicxml2ly.py:2566
+#: musicxml2ly.py:2567
msgid ""
"Copyright (c) 2005--2011 by\n"
" Han-Wen Nienhuys <hanwen@xs4all.nl>,\n"
" Jan Nieuwenhuizen <janneke@gnu.org> e\n"
" Reinhold Kainhofer <reinhold@kainhofer.com>\n"
-#: musicxml2ly.py:2580 midi2ly.py:1015 abc2ly.py:1382 lilypond-book.py:212
-#: convert-ly.py:94 etf2ly.py:1206 main.cc:168
+#: musicxml2ly.py:2581 midi2ly.py:1091 abc2ly.py:1382 lilypond-book.py:217
+#: convert-ly.py:94 etf2ly.py:1206 main.cc:174
msgid "show version number and exit"
msgstr "mostra il numero di versione ed esce"
-#: musicxml2ly.py:2585 midi2ly.py:1009 lilypond-book.py:204 main.cc:169
+#: musicxml2ly.py:2586 midi2ly.py:1085 lilypond-book.py:209 main.cc:175
msgid "be verbose"
msgstr "passa in modalità prolissa"
-#: musicxml2ly.py:2591
+#: musicxml2ly.py:2592
msgid "use lxml.etree; uses less memory and cpu time"
msgstr "usa lxml.etree per limitare il consumo di memoria e i tempi del processore"
-#: musicxml2ly.py:2597
+#: musicxml2ly.py:2598
msgid "input file is a zip-compressed MusicXML file"
msgstr "il file di input è un file MusicXML compresso in ZIP"
-#: musicxml2ly.py:2603
+#: musicxml2ly.py:2604
msgid "convert pitches in relative mode (default)"
msgstr "converte le altezze in modo relativo (predefinito)"
-#: musicxml2ly.py:2608
+#: musicxml2ly.py:2609
msgid "convert pitches in absolute mode"
msgstr "converte le altezze in modo assoluto"
-#: musicxml2ly.py:2611
+#: musicxml2ly.py:2612
msgid "LANG"
msgstr "LINGUA"
-#: musicxml2ly.py:2613
+#: musicxml2ly.py:2614
msgid "use LANG for pitch names, e.g. 'deutsch' for note names in German"
msgstr "usa LINGUA per i nomi delle altezze, ad esempio 'deutsch' per i nomi delle note in tedesco"
-#: musicxml2ly.py:2619
+#: musicxml2ly.py:2620
msgid "do not convert directions (^, _ or -) for articulations, dynamics, etc."
msgstr "non converte le direzioni (^, _ o -) per articolazioni, dinamiche, etc."
-#: musicxml2ly.py:2625
+#: musicxml2ly.py:2626
msgid "do not convert exact vertical positions of rests"
msgstr "non converte le esatte posizioni verticali delle pause"
-#: musicxml2ly.py:2631
+#: musicxml2ly.py:2632
msgid "do not convert the exact page layout and breaks"
msgstr "non converte l'esatta formattazione di pagina e gli a capo"
-#: musicxml2ly.py:2637
+#: musicxml2ly.py:2638
msgid "do not convert beaming information, use lilypond's automatic beaming instead"
msgstr "non converte le informazioni relative alle travature, usare invece la disposizione automatica delle travature di lilypond"
-#: musicxml2ly.py:2640 midi2ly.py:992 midi2ly.py:997 etf2ly.py:1208
-#: main.cc:161 main.cc:166
+#: musicxml2ly.py:2641 midi2ly.py:1065 midi2ly.py:1070 etf2ly.py:1208
+#: main.cc:165 main.cc:172
msgid "FILE"
msgstr "FILE"
-#: musicxml2ly.py:2645
+#: musicxml2ly.py:2646
msgid "set output filename to FILE, stdout if -"
msgstr "imposta il nome del file di output su FILE (stdout se -)"
#. "Report bugs in English via %s",
#. or if there is a LilyPond users list or forum in your language
#. "Report bugs in English via %s or in YOUR_LANG via URI"
-#: musicxml2ly.py:2648 midi2ly.py:1028 abc2ly.py:1395 lilypond-book.py:234
-#: convert-ly.py:144 etf2ly.py:1216 main.cc:281
+#: musicxml2ly.py:2649 midi2ly.py:1104 abc2ly.py:1395 lilypond-book.py:239
+#: convert-ly.py:144 etf2ly.py:1216 main.cc:285
#, c-format, python-format
msgid "Report bugs via %s"
msgstr "Segnalare i bug in inglese attraverso %s"
-#: musicxml2ly.py:2728
+#: musicxml2ly.py:2729
#, python-format
msgid "unknown part in part-list: %s"
msgstr "parte sconosciuta in part-list: %s"
-#: musicxml2ly.py:2790
+#: musicxml2ly.py:2791
msgid "Input is compressed, extracting raw MusicXML data from stdin"
msgstr "L'input è compresso. Estrazione dei dati MusicXML da stdin"
-#: musicxml2ly.py:2793
+#: musicxml2ly.py:2804
#, python-format
msgid "Input file %s is compressed, extracting raw MusicXML data"
msgstr "Il file di input %s è compresso. Estrazione dei dati MusicXML"
-#: musicxml2ly.py:2823
+#: musicxml2ly.py:2834
msgid "Reading MusicXML from Standard input ..."
msgstr "Lettura di MusicXML da Standard input ..."
-#: musicxml2ly.py:2825
+#: musicxml2ly.py:2836
#, python-format
msgid "Reading MusicXML from %s ..."
msgstr "Lettura di MusicXML da %s ..."
-#: musicxml2ly.py:2858
+#: musicxml2ly.py:2869
#, python-format
msgid "Output to `%s'"
msgstr "Output inviato a «%s»"
-#: musicxml2ly.py:2925
+#: musicxml2ly.py:2936
#, python-format
msgid "Unable to find input file %s"
msgstr "Impossibile trovare il file di input %s"
-#: midi2ly.py:90 lilypond-book.py:116 convert-ly.py:81 etf2ly.py:1189
+#: midi2ly.py:81 lilypond-book.py:116 convert-ly.py:81 etf2ly.py:1189
#, python-format
msgid "Copyright (c) %s by"
msgstr "Copyright (c) %s di"
-#: midi2ly.py:92 lilypond-book.py:118 convert-ly.py:83 etf2ly.py:1191
+#: midi2ly.py:83 lilypond-book.py:118 convert-ly.py:83 etf2ly.py:1191
msgid "Distributed under terms of the GNU General Public License."
msgstr "Distribuito secondo i termini della GNU General Public License."
-#: midi2ly.py:93 lilypond-book.py:119 convert-ly.py:84 etf2ly.py:1192
+#: midi2ly.py:84 lilypond-book.py:119 convert-ly.py:84 etf2ly.py:1192
msgid "It comes with NO WARRANTY."
msgstr "È distribuito con NESSUNA GARANZIA."
-#: midi2ly.py:99
+#: midi2ly.py:90
msgid "warning: "
msgstr "attenzione: "
-#: midi2ly.py:102 midi2ly.py:1041
+#: midi2ly.py:93 midi2ly.py:1121
msgid "error: "
msgstr "errore: "
-#: midi2ly.py:103
+#: midi2ly.py:94
msgid "Exiting... "
msgstr "Uscita... "
-#: midi2ly.py:960
+#: midi2ly.py:834
+msgid "found more than 5 voices on a staff, expect bad output"
+msgstr "trovate più di 5 voci in un rigo, è probabile che l'output sia sbagliato"
+
+#: midi2ly.py:1030
#, python-format
msgid "%s output to `%s'..."
msgstr "%s output inviato a «%s»..."
-#: midi2ly.py:972 abc2ly.py:1373 lilypond-book.py:122 convert-ly.py:87
+#: midi2ly.py:1042 abc2ly.py:1373 lilypond-book.py:122 convert-ly.py:87
#, python-format
msgid "%s [OPTION]... FILE"
msgstr "%s [OPZIONE]... FILE"
-#: midi2ly.py:973
+#: midi2ly.py:1043
#, python-format
msgid "Convert %s to LilyPond input.\n"
msgstr "Converte %s in input LilyPond.\n"
-#: midi2ly.py:978
+#: midi2ly.py:1048
msgid "print absolute pitches"
msgstr "stampa altezze assolute"
-#: midi2ly.py:980 midi2ly.py:1002
+#: midi2ly.py:1050 midi2ly.py:1075
msgid "DUR"
msgstr "DURATA"
-#: midi2ly.py:981
+#: midi2ly.py:1051
msgid "quantise note durations on DUR"
msgstr "quantificare la durata delle note in DURATA"
-#: midi2ly.py:984
+#: midi2ly.py:1054
+msgid "debug printing"
+msgstr "mostra le informazioni di debug"
+
+#: midi2ly.py:1057
msgid "print explicit durations"
msgstr "stampa durate esplicite"
-#: midi2ly.py:989
+#: midi2ly.py:1062
msgid "prepend FILE to output"
msgstr "antepone FILE all'output"
-#: midi2ly.py:993
+#: midi2ly.py:1066
msgid "set key: ALT=+sharps|-flats; MINOR=1"
msgstr "imposta la tonalità: ALTERAZIONE=+diesis|-bemolle; MINORE=1"
-#: midi2ly.py:994
+#: midi2ly.py:1067
msgid "ALT[:MINOR]"
msgstr "ALTERAZIONE[:MINORE]"
-#: midi2ly.py:996 abc2ly.py:1388 etf2ly.py:1207
+#: midi2ly.py:1069 abc2ly.py:1388 etf2ly.py:1207
msgid "write output to FILE"
msgstr "scrive l'output in FILE"
-#: midi2ly.py:999
+#: midi2ly.py:1072
msgid "preview of first 4 bars"
msgstr "anteprima delle prime 4 battute"
-#: midi2ly.py:1001
+#: midi2ly.py:1074
msgid "quantise note starts on DUR"
msgstr "quantifica l'inizio di una nota in DURATA"
-#: midi2ly.py:1004
+#: midi2ly.py:1078
+msgid "use s instead of r for rests"
+msgstr "si usi s invece di r per indicare le pause"
+
+#: midi2ly.py:1080
msgid "DUR*NUM/DEN"
msgstr "DURATA*NUMERATORE/DENOMINATORE"
-#: midi2ly.py:1007
+#: midi2ly.py:1083
msgid "allow tuplet durations DUR*NUM/DEN"
msgstr "consente le durate DURATA*NUMERATORE/DENOMINATORE nei gruppi irregolari"
-#: midi2ly.py:1016 lilypond-book.py:215 convert-ly.py:139 etf2ly.py:1210
-#: main.cc:170
+#: midi2ly.py:1092 lilypond-book.py:220 convert-ly.py:139 etf2ly.py:1210
+#: main.cc:176
msgid "show warranty and copyright"
msgstr "mostra la garanzia e il copyright"
-#: midi2ly.py:1019
+#: midi2ly.py:1095
msgid "treat every text as a lyric"
msgstr "tratta ogni testo come il testo di una canzone"
-#: midi2ly.py:1022
+#: midi2ly.py:1098
msgid "Examples"
msgstr "Esempi"
-#: midi2ly.py:1042
+#: midi2ly.py:1122
msgid "no files specified on command line."
msgstr "nessun file specificato nella riga di comando."
msgstr "aggiunge DIR al percorso di inclusione"
#: lilypond-book.py:143 lilypond-book.py:150 lilypond-book.py:163
-#: lilypond-book.py:173 lilypond-book.py:189 lilypond-book.py:195 main.cc:160
+#: lilypond-book.py:173 lilypond-book.py:194 lilypond-book.py:200 main.cc:164
msgid "DIR"
msgstr "DIR"
msgid "process ly_files using COMMAND FILE..."
msgstr "elabora ly_files con COMANDO FILE..."
-#: lilypond-book.py:182
+#: lilypond-book.py:183
+msgid "Redirect the lilypond output"
+msgstr "Redirezione dell'output di lilypond"
+
+#: lilypond-book.py:187
msgid "Compile snippets in safe mode"
msgstr "Compila i frammenti di codice in modalità sicura"
-#: lilypond-book.py:188
+#: lilypond-book.py:193
msgid "do not fail if no lilypond output is found"
msgstr "non si interrompe se non si trova alcun output di lilypond"
-#: lilypond-book.py:194
+#: lilypond-book.py:199
msgid "do not fail if no PNG images are found for EPS files"
msgstr "non si interrompe se non si trovano immagini PNG per i file EPS"
-#: lilypond-book.py:200
+#: lilypond-book.py:205
msgid "write snippet output files with the same base name as their source file"
msgstr "scrive i file di output dei frammenti di codice con lo stesso nome di base dei file sorgenti"
-#: lilypond-book.py:220
+#: lilypond-book.py:225
msgid ""
"run executable PROG instead of latex, or in\n"
"case --pdf option is set instead of pdflatex"
"eseguire il PROGRAMMA eseguibile invece di latex, o nel caso in\n"
"cui viene impostata l'opzione --pdf invece di usare pdflatex"
-#: lilypond-book.py:222
+#: lilypond-book.py:227
msgid "PROG"
msgstr "PROGRAMMA"
-#: lilypond-book.py:228
+#: lilypond-book.py:233
msgid "create PDF files for use with PDFTeX"
msgstr "creare file PDF per l'utilizzo con PDFTeX"
-#: lilypond-book.py:419
+#: lilypond-book.py:428
msgid "Writing snippets..."
msgstr "Scrittura dei frammenti di codice..."
-#: lilypond-book.py:425
+#: lilypond-book.py:434
msgid "Processing..."
msgstr "In elaborazione..."
-#: lilypond-book.py:431
+#: lilypond-book.py:440
msgid "All snippets are up to date..."
msgstr "Tutti i frammenti di codice sono aggiornati..."
-#: lilypond-book.py:452
+#: lilypond-book.py:461
#, python-format
msgid "cannot determine format for: %s"
msgstr "impossibile determinare il formato per: %s"
-#: lilypond-book.py:461
+#: lilypond-book.py:470
#, python-format
msgid "%s is up to date."
msgstr "%s è aggiornato."
-#: lilypond-book.py:475
+#: lilypond-book.py:484
#, python-format
msgid "Writing `%s'..."
msgstr "Scrittura di «%s»..."
-#: lilypond-book.py:537
+#: lilypond-book.py:546
msgid "Output would overwrite input file; use --output."
msgstr "L'output sovrascriverebbe il file di input; usare --output."
-#: lilypond-book.py:541
+#: lilypond-book.py:550
#, python-format
msgid "Reading %s..."
msgstr "Lettura di %s..."
-#: lilypond-book.py:549
+#: lilypond-book.py:558
msgid "Dissecting..."
msgstr "Dissezione di..."
-#: lilypond-book.py:561
+#: lilypond-book.py:570
#, python-format
msgid "Compiling %s..."
msgstr "Compilazione di %s"
-#: lilypond-book.py:570
+#: lilypond-book.py:579
#, python-format
msgid "Processing include: %s"
msgstr "Elaborazione di include: %s"
-#: lilypond-book.py:582
+#: lilypond-book.py:591
#, python-format
msgid "Removing `%s'"
msgstr "Eliminazione di «%s»"
msgid "success: %s"
msgstr "riuscito: %s"
-#: warn.cc:86 grob.cc:617 input.cc:97
+#: warn.cc:86 grob.cc:613 input.cc:97
#, c-format
msgid "programming error: %s"
msgstr "errore di programmazione: %s"
msgid "Vaticana_ligature: zero join (delta_pitch == 0)"
msgstr "Vaticana_ligature: unione nulla (delta_pitch == 0)"
-#: parse-scm.cc:101
+#: parse-scm.cc:100
msgid "GUILE signaled an error for the expression beginning here"
msgstr "GUILE ha segnalato un errore per l'espressione che inizia qui"
msgstr "la testa ritmica non fa parte di una colonna ritmica"
#. if we get to here, just put everything on one line
-#: constrained-breaking.cc:189 constrained-breaking.cc:207
+#: constrained-breaking.cc:187 constrained-breaking.cc:205
msgid "cannot find line breaking that satisfies constraints"
msgstr "impossibile trovare interruzioni di linea che soddisfino i vincoli"
-#: horizontal-bracket-engraver.cc:78
+#: horizontal-bracket-engraver.cc:62
msgid "do not have that many brackets"
msgstr "non ci sono così tante parentesi"
-#: horizontal-bracket-engraver.cc:87
+#: horizontal-bracket-engraver.cc:71
msgid "conflicting note group events"
msgstr "eventi di gruppi di note in conflitto"
msgid "unterminated hyphen; removing"
msgstr "trattino non terminato; eliminazione"
-#: pango-font.cc:187 open-type-font.cc:319
+#: pango-font.cc:189 open-type-font.cc:318
#, c-format
msgid "FT_Get_Glyph_Name () error: %s"
msgstr "errore in FT_Get_Glyph_Name (): %s"
-#: pango-font.cc:204
+#: pango-font.cc:205
#, c-format
msgid ""
"Glyph has no name, but font supports glyph naming.\n"
"Il glifo non ha un nome, ma il tipo di carattere permette di dare un nome al glifo.\n"
"Si salta il glifo U+%0X, file %s"
-#: pango-font.cc:241
+#: pango-font.cc:242
#, c-format
msgid "no PostScript font name for font `%s'"
msgstr "nessun nome di tipo di carattere PostScript per «%s»"
-#: pango-font.cc:290
+#: pango-font.cc:291
msgid "FreeType face has no PostScript font name"
msgstr "Il tipo FreeType non ha un nome per il tipo di carattere PostScript"
-#: midi-item.cc:92
+#: midi-item.cc:89
#, c-format
msgid "no such MIDI instrument: `%s'"
msgstr "non esiste questo strumento MIDI: «%s»"
msgid "NoteEvent without pitch"
msgstr "NoteEvent senza altezza"
-#: rest.cc:159
+#: rest.cc:160
#, c-format
msgid "rest `%s' not found"
msgstr "pausa «%s» non trovata"
msgid "unterminated beam"
msgstr "travatura non terminata"
-#: beam-engraver.cc:266 chord-tremolo-engraver.cc:150
+#: beam-engraver.cc:266 chord-tremolo-engraver.cc:149
msgid "stem must have Rhythmic structure"
msgstr "il gambo deve avere una struttura ritmica"
msgid "beam was started here"
msgstr "la travatura è iniziata qui"
-#: music-iterator.cc:182
+#: music-iterator.cc:181
msgid "Sending non-event to context"
msgstr "Invio di un non-evento al contesto"
-#: context.cc:149
+#: context.cc:148
#, c-format
msgid "cannot find or create new `%s'"
msgstr "impossibile trovare o creare un nuovo «%s»"
-#: context.cc:207
+#: context.cc:206
#, c-format
msgid "cannot find or create `%s' called `%s'"
msgstr "impossibile trovare o creare «%s» chiamato «%s»"
-#: context.cc:269
+#: context.cc:268
#, c-format
msgid "Invalid CreateContext event: Cannot create %s context"
msgstr "Evento CreateContext non valido: impossibile creare il contesto %s"
-#: context.cc:400
+#: context.cc:399
#, c-format
msgid "cannot find or create: `%s'"
msgstr "impossibile trovare o creare: «%s»"
msgid "forced break was overridden by some other event, should you be using bar checks?"
msgstr "l'interruzione forzata è stata sovrascritta da qualche altro evento, considerare l'uso dei controlli di battuta"
-#: tie-engraver.cc:116
+#: tie-engraver.cc:117
msgid "unterminated tie"
msgstr "legatura di valore non terminata"
-#: tie-engraver.cc:312
+#: tie-engraver.cc:348
msgid "lonely tie"
msgstr "legatura di valore solitaria"
"lo deve essere anche la penultima nota,\n"
"oppure la legatura deve essere LB o SSB"
-#: mensural-ligature-engraver.cc:386
+#: mensural-ligature-engraver.cc:387
msgid "unexpected case fall-through"
msgstr "caso inatteso e non interpretabile"
-#: piano-pedal-engraver.cc:298
+#: piano-pedal-engraver.cc:296
#, c-format
msgid "expect 3 strings for piano pedals, found: %ld"
msgstr "previste tre corde per i pedali del pianoforte, trovate: %ld"
-#: piano-pedal-engraver.cc:313 piano-pedal-engraver.cc:324
+#: piano-pedal-engraver.cc:311 piano-pedal-engraver.cc:322
#: piano-pedal-performer.cc:104
#, c-format
msgid "cannot find start of piano pedal: `%s'"
msgstr "impossibile trovare l'inizio del pedale del pianoforte: «%s»"
-#: piano-pedal-engraver.cc:359
+#: piano-pedal-engraver.cc:357
#, c-format
msgid "cannot find start of piano pedal bracket: `%s'"
msgstr "impossibile trovare la parentesi di apertura del pedale del pianoforte: «%s»"
-#: input.cc:131 source-file.cc:179 source-file.cc:194
+#: input.cc:130 source-file.cc:178 source-file.cc:193
msgid "position unknown"
msgstr "posizione sconosciuta"
msgid "Layout output to `%s'..."
msgstr "Output della formattazione inviato a «%s»..."
-#: general-scheme.cc:306
+#: general-scheme.cc:305
msgid "infinity or NaN encountered while converting Real number"
msgstr "si è incontrato infinito o un valore non numerico durante la conversione di un numero reale"
-#: general-scheme.cc:307
+#: general-scheme.cc:306
msgid "setting to zero"
msgstr "impostato a zero"
-#: general-scheme.cc:543
+#: general-scheme.cc:540
msgid "Found infinity or nan in output. Substituting 0.0"
msgstr "Trovato infinito o un valore non numerico nell'output. Sostituito con 0.0"
-#: music.cc:151
+#: music.cc:150
#, c-format
msgid "octave check failed; expected \"%s\", found: \"%s\""
msgstr "controllo dell'ottava fallito: previsto \"%s\", trovato: \"%s\""
-#: music.cc:219
+#: music.cc:218
msgid "(normalized pitch)"
msgstr "(altezza normalizzata)"
-#: music.cc:223
+#: music.cc:222
#, c-format
msgid "Transposing %s by %s makes alteration larger than double"
msgstr "La trasposizione di %s da %s ingrandisce le alterazioni più del doppio"
msgid "trying to use \\partial after the start of a piece"
msgstr "tentativo di usare \\partial all'inizio di un brano"
-#: new-fingering-engraver.cc:106
+#: new-fingering-engraver.cc:105
msgid "cannot add text scripts to individual note heads"
msgstr "impossibile aggiungere delle scritte testuali alle teste delle note individuali"
-#: new-fingering-engraver.cc:250
+#: new-fingering-engraver.cc:249
msgid "no placement found for fingerings"
msgstr "nessuna posizione trovata per le diteggiature"
-#: new-fingering-engraver.cc:251
+#: new-fingering-engraver.cc:250
msgid "placing below"
msgstr "si colloca in basso"
msgid "no left bound"
msgstr "manca il limite sinistro"
-#: ligature-engraver.cc:185
+#: ligature-engraver.cc:184
msgid "unterminated ligature"
msgstr "legatura non terminata"
-#: ligature-engraver.cc:214
+#: ligature-engraver.cc:211
msgid "ignoring rest: ligature may not contain rest"
msgstr "pausa ignorata: la legatura non può contenere una pausa"
-#: ligature-engraver.cc:215
+#: ligature-engraver.cc:212
msgid "ligature was started here"
msgstr "la legatura è iniziata qui"
msgid "cannot change, already in translator: %s"
msgstr "impossibile cambiare, già nel traduttore: %s"
-#: accidental-engraver.cc:180
+#: accidental-engraver.cc:179
#, c-format
msgid "accidental typesetting list must begin with context-name: %s"
msgstr "la lista tipografica delle alterazioni deve iniziare con context-name: %s"
-#: accidental-engraver.cc:210
+#: accidental-engraver.cc:209
#, c-format
msgid "procedure or context-name expected for accidental rule, found %s"
msgstr "si aspettava una procedura o un nome di contesto per la regola di alterazione accidentale, si è trovato %s"
-#: ttf.cc:481 ttf.cc:530
+#: ttf.cc:480 ttf.cc:529
#, c-format
msgid "font index %d too large for font `%s', using index 0"
msgstr "l'indice del tipo di carattere %d è troppo grande per il tipo di carattere «%s», si usa l'indice 0"
-#: ttf.cc:513 ttf.cc:565
+#: ttf.cc:512 ttf.cc:564
msgid "font index must be non-negative, using index 0"
msgstr "l'indice del tipo di carattere deve essere non negativo, si usa l'indice 0"
-#: break-alignment-interface.cc:206
+#: break-alignment-interface.cc:199
#, c-format
msgid "No spacing entry from %s to `%s'"
msgstr "Nessuno spazio da %s a «%s»"
msgid "Aborting"
msgstr "Si sospende l'esecuzione"
-#: note-collision.cc:497
+#: note-collision.cc:494
msgid "ignoring too many clashing note columns"
msgstr "troppe collisioni tra colonne di note, ignorate"
msgid "giving up"
msgstr "rinuncia"
-#: page-layout-problem.cc:322
+#: page-layout-problem.cc:603
msgid "cannot fit music on page: ragged-spacing was requested, but page was compressed"
msgstr "impossibile far entrare la musica nella pagina: richiesta la spaziatura ridotta, ma la pagina è già stata compressa"
-#: page-layout-problem.cc:325
+#: page-layout-problem.cc:606
#, c-format
msgid "cannot fit music on page: overflow is %f"
msgstr "impossibile far entrare la musica nella pagina: l'eccesso è %f"
-#: page-layout-problem.cc:327
+#: page-layout-problem.cc:608
msgid "compressing music to fit"
msgstr "si comprime la musica per farla entrare"
-#: page-layout-problem.cc:765
+#: page-layout-problem.cc:1047
msgid "staff-affinities should only decrease"
msgstr "staff-affinities deve solo diminuire"
msgid "mark label must be a markup object"
msgstr "l'etichetta del segno deve essere un oggetto di markup"
-#: new-dynamic-engraver.cc:142
+#: new-dynamic-engraver.cc:168
#, c-format
msgid ""
"unknown crescendo style: %s\n"
"stile di crescendo sconosciuto: %s\n"
"si usa la forcella predefinita."
-#: new-dynamic-engraver.cc:200
+#: new-dynamic-engraver.cc:233
#, c-format
msgid "unterminated %s"
msgstr "%s non terminato"
-#: stem-engraver.cc:103
+#: stem-engraver.cc:102
msgid "tremolo duration is too long"
msgstr "la durata del tremolo è troppo lunga"
-#. FIXME:
-#: stem-engraver.cc:140
+#: stem-engraver.cc:154
#, c-format
-msgid "adding note head to incompatible stem (type = %d)"
-msgstr "si aggiunge la testa della nota a un gambo incompatibile (tipo = %d)"
+msgid "adding note head to incompatible stem (type = %d/%d)"
+msgstr "si aggiunge la testa della nota a un gambo incompatibile (tipo = %d/%d)"
-#: stem-engraver.cc:142
+#: stem-engraver.cc:157
msgid "maybe input should specify polyphonic voices"
msgstr "forse l'input dovrebbe specificare le voci polifoniche"
-#: lily-lexer.cc:264
+#: lily-lexer.cc:265
msgid "include files are not allowed in safe mode"
msgstr "l'inclusione di file non è permessa in modalità sicura"
-#: lily-lexer.cc:291
+#: lily-lexer.cc:292
#, c-format
msgid "identifier name is a keyword: `%s'"
msgstr "Il nome dell'identificatore è una parola chiave: «%s»"
-#: lily-lexer.cc:312
+#: lily-lexer.cc:313
#, c-format
msgid "error at EOF: %s"
msgstr "errore alla fine del file (EOF): %s"
msgid "cannot find Voice `%s'"
msgstr "impossibile trovare la voce (Voice) «%s»"
-#: includable-lexer.cc:71 lily-guile.cc:87 lily-parser-scheme.cc:109
+#: includable-lexer.cc:71 lily-guile.cc:86 lily-parser-scheme.cc:109
#, c-format
msgid "cannot find file: `%s'"
msgstr "impossibile trovare il file: «%s»"
-#: includable-lexer.cc:73 lily-parser-scheme.cc:100
+#: includable-lexer.cc:73 lily-parser-scheme.cc:101
#, c-format
msgid "(search path: `%s')"
msgstr "(percorso di ricerca: «%s»)"
msgstr "rimozione delle travature senza gambi"
#. We are completely screwed.
-#: beam.cc:1274
+#: beam.cc:1350
msgid "no viable initial configuration found: may not find good beam slope"
msgstr "nessuna configurazione iniziale fattibile trovata: si potrebbe non trovare una buona inclinazione delle travature"
-#: slur-engraver.cc:93
+#: staff-performer.cc:257
+msgid "MIDI channel wrapped around"
+msgstr "Numerazione canale MIDI ricominciata"
+
+#: staff-performer.cc:258
+msgid "remapping modulo 16"
+msgstr "riassegnata con modulo 16"
+
+#: slur-engraver.cc:90 phrasing-slur-engraver.cc:89
#, c-format
msgid "direction of %s invalid: %d"
msgstr "direzione di %s non valida: %d"
-#: slur-engraver.cc:162
+#: slur-engraver.cc:158
msgid "unterminated slur"
msgstr "legatura di portamento non terminata"
-#: slur-engraver.cc:174
+#: slur-engraver.cc:183
msgid "cannot end slur"
msgstr "impossibile terminare la legatura di portamento"
-#: font-config.cc:40
+#. We already have a slur, so give a warning and completely ignore
+#. the new slur.
+#: slur-engraver.cc:200
+msgid "already have slur"
+msgstr "legatura già presente"
+
+#: font-config.cc:39
msgid "Initializing FontConfig..."
msgstr "Inizializzazione di FontConfig..."
-#: font-config.cc:55 font-config-scheme.cc:152
+#: font-config.cc:54 font-config-scheme.cc:151
#, c-format
msgid "failed adding font directory: %s"
msgstr "errore nell'aggiungere la directory dei tipi di carattere: %s"
-#: font-config.cc:57 font-config-scheme.cc:154
+#: font-config.cc:56 font-config-scheme.cc:153
#, c-format
msgid "adding font directory: %s"
msgstr "aggiungere la directory dei tipi di carattere: %s"
-#: font-config.cc:61
+#: font-config.cc:60
msgid "Building font database..."
msgstr "Creazione del database dei tipi di carattere..."
msgid "natural alteration glyph not found"
msgstr "alterazione naturale del glifo non trovata"
-#: system.cc:197
+#: system.cc:201
#, c-format
msgid "Element count %d"
msgstr "Numero degli elementi %d"
-#: system.cc:303
+#: system.cc:402
#, c-format
msgid "Grob count %d"
msgstr "Numero degli oggetti grafici %d"
-#: slur.cc:362
+#: slur.cc:359
#, c-format
msgid "Ignoring grob for slur: %s. avoid-slur not set?"
msgstr "Si ignora il grob per la legatura di portamento: %s. Non si è impostato avoid-slur?"
-#: font-config-scheme.cc:168
+#: font-config-scheme.cc:167
#, c-format
msgid "failed adding font file: %s"
msgstr "errore nell'aggiungere il file dei tipi di carattere: %s"
-#: font-config-scheme.cc:170
+#: font-config-scheme.cc:169
#, c-format
msgid "adding font file: %s"
msgstr "aggiungere il file dei tipi di carattere: %s"
msgid "decrescendo too small"
msgstr "decrescendo troppo piccolo"
-#: extender-engraver.cc:170 extender-engraver.cc:179
+#: extender-engraver.cc:169 extender-engraver.cc:178
msgid "unterminated extender"
msgstr "estensore non terminato"
-#: lily-guile.cc:89
+#: lily-guile.cc:88
#, c-format
msgid "(load path: `%s')"
msgstr "(percorso di caricamento: «%s»)"
-#: lily-guile.cc:437
+#: lily-guile.cc:431
#, c-format
msgid "cannot find property type-check for `%s' (%s)."
msgstr "impossibile trovare la proprietà type-check per «%s» (%s)."
-#: lily-guile.cc:440
+#: lily-guile.cc:434
msgid "perhaps a typing error?"
msgstr "forse un errore di digitazione?"
-#: lily-guile.cc:447
+#: lily-guile.cc:441
msgid "doing assignment anyway"
msgstr "compito comunque in corso"
-#: lily-guile.cc:459
+#: lily-guile.cc:453
#, c-format
msgid "type check for `%s' failed; value `%s' must be of type `%s'"
msgstr "controllo del tipo per «%s» fallito; il valore «%s» deve essere del tipo «%s»"
-#: main.cc:109
+#: main.cc:107
#, c-format
msgid ""
"This program is free software. It is covered by the GNU General Public\n"
"License che permette di modificarlo o distribuirne copie rispettando certe\n"
"condizioni. Per maggiori informazioni, invocare «%s --warranty».\n"
-#: main.cc:115
+#: main.cc:113
msgid ""
" This program is free software; you can redistribute it and/or\n"
-"modify it under the terms of the GNU General Public License version 2\n"
-"as published by the Free Software Foundation.\n"
+"modify it under the terms of the GNU General Public License as \n"
+"published by the Free Software Foundation, either version 3 of\n"
+"the License, or (at your option) any later version.\n"
"\n"
" This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"Boston, MA 02111-1307, USA.\n"
msgstr ""
" Questo programma è software libero; puoi ridistribuirlo e/o\n"
-"modificarlo sotto le condizioni della GNU General Public License, versione 2,\n"
-"come pubblicata dalla Free Software Foundation.\n"
+"modificarlo sotto le condizioni della GNU General Public License,\n"
+"come pubblicata dalla Free Software Foundation, nella versione 3 della\n"
+"licenza o in qualsiasi versione successiva.\n"
"\n"
" Questo programma è distribuito nella speranza che possa essere utile,\n"
"ma SENZA ALCUNA GARANZIA; è privo anche di garanzia implicita di\n"
"Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n"
"Boston, MA 02111-1307, USA.\n"
-#: main.cc:146
+#: main.cc:147
msgid "SYM[=VAL]"
msgstr "SIMBOLO[=VALORE]"
-#: main.cc:147
+#: main.cc:148
msgid ""
"set Scheme option SYM to VAL (default: #t).\n"
"Use -dhelp for help."
"imposta l'opzione di Scheme SIMBOLO a VALORE (predefinito: #t).\n"
"Usare -dhelp per ottenere aiuto."
-#: main.cc:150
+#: main.cc:152
msgid "EXPR"
msgstr "ESPRESSIONE"
-#: main.cc:150
+#: main.cc:152
msgid "evaluate scheme code"
msgstr "valuta il codice scheme"
#. Bug in option parser: --output =foe is taken as an abbreviation
#. for --output-format.
-#: main.cc:153
+#: main.cc:155
msgid "FORMATs"
msgstr "FORMATO"
-#: main.cc:153
+#: main.cc:155
msgid "dump FORMAT,... Also as separate options:"
msgstr "scarica FORMATO,... Anche come opzioni separate:"
-#: main.cc:154
+#: main.cc:156
msgid "generate PDF (default)"
msgstr "genera PDF (predefinito)"
-#: main.cc:155
+#: main.cc:157
msgid "generate PNG"
msgstr "genera PNG"
-#: main.cc:156
+#: main.cc:158
msgid "generate PostScript"
msgstr "genera PostScript"
-#: main.cc:158
+#: main.cc:161
msgid "FIELD"
msgstr "CAMPO"
-#: main.cc:158
+#: main.cc:161
msgid ""
"dump header field FIELD to file\n"
"named BASENAME.FIELD"
"scrive il campo di intestazione CAMPO sul\n"
"file chiamato BASENAME.CAMPO"
-#: main.cc:160
+#: main.cc:164
msgid "add DIR to search path"
msgstr "aggiunge DIRECTORY ai percorsi di ricerca"
-#: main.cc:161
+#: main.cc:165
msgid "use FILE as init file"
msgstr "usa FILE come file di inizializzazione"
-#: main.cc:163
+#: main.cc:168
msgid "USER, GROUP, JAIL, DIR"
msgstr "UTENTE, GRUPPO, GABBIA, DIRECTORY"
-#: main.cc:163
+#: main.cc:168
msgid ""
"chroot to JAIL, become USER:GROUP\n"
"and cd into DIR"
"chroot a GABBIA, diventa UTENTE:GRUPPO\n"
"ed entra in DIRECTORY"
-#: main.cc:166
+#: main.cc:172
msgid "write output to FILE (suffix will be added)"
msgstr "scrive l'output su FILE (verrà aggiunto un suffisso)"
-#: main.cc:167
+#: main.cc:173
msgid "relocate using directory of lilypond program"
msgstr "trasferisce alla directory del programma lilypond"
#. Do not update the copyright years here, run `make grand-replace'
-#: main.cc:238
+#: main.cc:242
#, c-format
msgid ""
"Copyright (c) %s by\n"
"%s e altri."
#. No version number or newline here. It confuses help2man.
-#: main.cc:265
+#: main.cc:269
#, c-format
msgid "Usage: %s [OPTION]... FILE..."
msgstr "Uso: %s [OPZIONE]... [FILE]..."
-#: main.cc:267
+#: main.cc:271
msgid "Typeset music and/or produce MIDI from FILE."
msgstr "Stampa partitura oppure crea MIDI da FILE."
-#: main.cc:269
+#: main.cc:273
msgid "LilyPond produces beautiful music notation."
msgstr "LilyPond produce bella notazione musicale."
-#: main.cc:271
+#: main.cc:275
#, c-format
msgid "For more information, see %s"
msgstr "Per maggiori informazioni si veda %s"
-#: main.cc:273
+#: main.cc:277
msgid "Options:"
msgstr "Opzioni:"
-#: main.cc:327
+#: main.cc:331
#, c-format
msgid "expected %d arguments with jail, found: %u"
msgstr "previsti gli argomenti %d per la gabbia, trovati: %u"
-#: main.cc:341
+#: main.cc:345
#, c-format
msgid "no such user: %s"
msgstr "non esiste questo utente: %s"
-#: main.cc:343
+#: main.cc:347
#, c-format
msgid "cannot get user id from user name: %s: %s"
msgstr "impossibile acquisire l'id dell'utente dal nome utente: %s: %s"
-#: main.cc:358
+#: main.cc:362
#, c-format
msgid "no such group: %s"
msgstr "non esiste questo gruppo: %s"
-#: main.cc:360
+#: main.cc:364
#, c-format
msgid "cannot get group id from group name: %s: %s"
msgstr "impossibile acquisire l'id del gruppo dal nome del gruppo: %s:%s"
-#: main.cc:368
+#: main.cc:372
#, c-format
msgid "cannot chroot to: %s: %s"
msgstr "non si può fare il chroot a: %s: %s"
-#: main.cc:375
+#: main.cc:379
#, c-format
msgid "cannot change group id to: %d: %s"
msgstr "non si può cambiare l'id del gruppo in: %d: %s"
-#: main.cc:381
+#: main.cc:385
#, c-format
msgid "cannot change user id to: %d: %s"
msgstr "non si può cambiare l'id dell'utente in: %d: %s"
-#: main.cc:387
+#: main.cc:391
#, c-format
msgid "cannot change working directory to: %s: %s"
msgstr "non si può passare alla directory di lavoro: %s: %s"
-#: main.cc:628
+#: main.cc:631
#, c-format
msgid "exception caught: %s"
msgstr "ricevuta un'eccezione: %s"
-#: key-signature-interface.cc:78
+#: key-signature-interface.cc:77
#, c-format
msgid "No glyph found for alteration: %s"
msgstr "Nessun glifo trovato per l'alterazione: %s"
-#: key-signature-interface.cc:88
+#: key-signature-interface.cc:87
msgid "alteration not found"
msgstr "alterazione non trovata"
msgid "dot `%s' not found"
msgstr "punto «%s» non trovato"
-#: translator.cc:359
+#: translator.cc:356
#, c-format
msgid "Two simultaneous %s events, junking this one"
msgstr "Due eventi %s simultanei, si butta via questo"
-#: translator.cc:360
+#: translator.cc:357
#, c-format
msgid "Previous %s event here"
msgstr "L'evento %s precedente sta qui"
-#: glissando-engraver.cc:105
+#: glissando-engraver.cc:156
msgid "unterminated glissando"
msgstr "glissando non terminato"
-#: text-spanner-engraver.cc:73
+#: text-spanner-engraver.cc:72
msgid "cannot find start of text spanner"
msgstr "impossibile trovare l'inizio di uno spanner testuale"
-#: text-spanner-engraver.cc:86
+#: text-spanner-engraver.cc:85
msgid "already have a text spanner"
msgstr "spanner testuale già presente"
-#: text-spanner-engraver.cc:132
+#: text-spanner-engraver.cc:130
msgid "unterminated text spanner"
msgstr "spanner testuale non terminato"
msgid "strange time signature found: %d/%d"
msgstr "si è incontrato uno strano segno di tempo: %d/%d"
-#: lily-parser-scheme.cc:82
+#: lily-parser-scheme.cc:83
#, c-format
msgid "Changing working directory to: `%s'"
msgstr "Si cambia la directory di lavoro a: «%s»"
-#: lily-parser-scheme.cc:99
+#: lily-parser-scheme.cc:100
#, c-format
msgid "cannot find init file: `%s'"
msgstr "impossibile trovare il file di init: «%s»"
msgid "Processing `%s'"
msgstr "Elaborazione di «%s»"
-#: lily-parser-scheme.cc:204
+#: lily-parser-scheme.cc:203
msgid "ly:parser-parse-string is only valid with a new parser. Use ly:parser-include-string instead."
msgstr "ly:parser-parse-string è valido solo con un nuovo parser. Usare ly:parser-include-string al suo posto."
msgid "custos `%s' not found"
msgstr "custos «%s» non trovato"
-#: program-option-scheme.cc:237
+#: program-option-scheme.cc:232
#, c-format
msgid "no such internal option: %s"
msgstr "opzione interna sconosciuta: %s"
msgid "cannot resolve rest collision: rest direction not set"
msgstr "impossibile risolvere la collisione di pause: direzione delle pause non impostata"
-#: rest-collision.cc:160 rest-collision.cc:205
+#: rest-collision.cc:160 rest-collision.cc:275
msgid "too many colliding rests"
msgstr "troppe collisioni tra pause"
+#: pdf-scheme.cc:50
+#, c-format
+msgid "Conversion of string `%s' to UTF-16be failed: %s"
+msgstr "Fallita la conversione della stringa \"%s\" in UTF-16be: %s"
+
#: episema-engraver.cc:75
msgid "already have an episema"
msgstr "episema già presente"
msgid "%d: %s"
msgstr "%d: %s"
-#: grob-property.cc:173
+#: grob-property.cc:169
#, c-format
msgid "cyclic dependency: calculation-in-progress encountered for #'%s (%s)"
msgstr "dipendenza ciclica: calculation-in-progress incontrato per #'%s (%s)"
-#: relocate.cc:54
+#: relocate.cc:53
#, c-format
msgid "Setting %s to %s"
msgstr "Si imposta %s su %s"
-#: relocate.cc:74
+#: relocate.cc:73
#, c-format
msgid "no such file: %s for %s"
msgstr "file inesistente: %s per %s"
-#: relocate.cc:84 relocate.cc:102
+#: relocate.cc:83 relocate.cc:101
#, c-format
msgid "no such directory: %s for %s"
msgstr "directory inesistente: %s per %s"
-#: relocate.cc:94
+#: relocate.cc:93
#, c-format
msgid "%s=%s (prepend)\n"
msgstr "%s=%s (prefisso)\n"
-#: relocate.cc:124
+#: relocate.cc:123
#, c-format
msgid "not relocating, no %s/ or current/ found under %s"
msgstr "non si riloca, non si è incontrato %s/ o current/ in %s"
-#: relocate.cc:135
+#: relocate.cc:134
#, c-format
msgid "Relocation: compile datadir=%s, new datadir=%s"
msgstr "Rilocazione: compilare datadir=%s, nuova datadir=%s"
-#: relocate.cc:148
+#: relocate.cc:147
#, c-format
msgid "Relocation: framework_prefix=%s"
msgstr "Rilocazione: framework_prefix=%s"
-#: relocate.cc:189
+#: relocate.cc:188
#, c-format
msgid "Relocation: is absolute: argv0=%s"
msgstr "Rilocazione: è assoluta: argv0=%s"
-#: relocate.cc:196
+#: relocate.cc:195
#, c-format
msgid "Relocation: from cwd: argv0=%s"
msgstr "Rilocazione: da cwd: argv0=%s"
-#: relocate.cc:213
+#: relocate.cc:212
#, c-format
msgid ""
"Relocation: from PATH=%s\n"
"Rilocazione: da PATH=%s\n"
"argv0=%s"
-#: relocate.cc:240
+#: relocate.cc:239
msgid "LILYPONDPREFIX is obsolete, use LILYPOND_DATADIR"
msgstr "LILYPONDPREFIX è obsoleto, usare LILYPOND_DATADIR"
-#: relocate.cc:367
+#: relocate.cc:365
#, c-format
msgid "Relocation file: %s"
msgstr "File di rilocazione: %s"
-#: relocate.cc:373 source-file.cc:65
+#: relocate.cc:371 source-file.cc:65
#, c-format
msgid "cannot open file: `%s'"
msgstr "impossibile aprire il file: «%s»"
-#: relocate.cc:403
+#: relocate.cc:401
#, c-format
msgid "Unknown relocation command %s"
msgstr "Comando di rilocazione sconosciuto %s"
+#: gregorian-ligature-engraver.cc:70
+#, c-format
+msgid "\\%s ignored"
+msgstr "\\%s ignorato"
+
+#: gregorian-ligature-engraver.cc:75
+#, c-format
+msgid "implied \\%s added"
+msgstr "aggiunto il \\%s implicato"
+
+#. ligature may not start with 2nd head of pes or flexa
+#: gregorian-ligature-engraver.cc:224
+msgid "cannot apply `\\~' on first head of ligature"
+msgstr "impossibile applicare «\\~» sulla prima testa della legatura"
+
+#. (pitch == prev_pitch)
+#: gregorian-ligature-engraver.cc:236
+msgid "cannot apply `\\~' on heads with identical pitch"
+msgstr "impossibile applicare «\\~» su teste di identica altezza"
+
#: translator-group.cc:188
#, c-format
msgid "cannot find: `%s'"
msgid "unterminated phrasing slur"
msgstr "legatura di frase non terminata"
-#: lyric-engraver.cc:176
+#: phrasing-slur-engraver.cc:182
+msgid "cannot end phrasing slur"
+msgstr "impossibile chiudere la legatura di frase"
+
+#: phrasing-slur-engraver.cc:196
+msgid "already have phrasing slur"
+msgstr "legatura di frase già presente"
+
+#: lyric-engraver.cc:186
msgid "Lyric syllable does not have note. Use \\lyricsto or associatedVoice."
msgstr "Le sillabe del testo non hanno note. Usare \\lyricsto o associatedVoice."
-#: page-breaking.cc:248
+#: page-breaking.cc:274
msgid "ignoring min-systems-per-page and max-systems-per-page because systems-per-page was set"
msgstr "si ignorano min-systems-per-page e max-systems-per-page perché è stato impostato systems-per-page"
-#: page-breaking.cc:253
+#: page-breaking.cc:279
msgid "min-systems-per-page is larger than max-systems-per-page, ignoring both values"
msgstr "min-systems-per-page è maggiore di max-systems-per-page, si ignorano entrambi i valori"
-#: performance.cc:54
+#: performance.cc:55
msgid "Track..."
msgstr "Traccia..."
-#: performance.cc:83
-msgid "MIDI channel wrapped around"
-msgstr "Numerazione canale MIDI ricominciata"
-
-#: performance.cc:84
-msgid "remapping modulo 16"
-msgstr "riassegnata con modulo 16"
-
-#: performance.cc:111
+#: performance.cc:85
#, c-format
msgid "MIDI output to `%s'..."
msgstr "L'output MIDI è inviato a «%s»..."
msgid "No tuplet to end"
msgstr "Nessun gruppo irregolare da terminare"
-#: gregorian-ligature-engraver.cc:70
-#, c-format
-msgid "\\%s ignored"
-msgstr "\\%s ignorato"
-
-#: gregorian-ligature-engraver.cc:75
-#, c-format
-msgid "implied \\%s added"
-msgstr "aggiunto il \\%s implicato"
-
-#. ligature may not start with 2nd head of pes or flexa
-#: gregorian-ligature-engraver.cc:224
-msgid "cannot apply `\\~' on first head of ligature"
-msgstr "impossibile applicare «\\~» sulla prima testa della legatura"
-
-#. (pitch == prev_pitch)
-#: gregorian-ligature-engraver.cc:236
-msgid "cannot apply `\\~' on heads with identical pitch"
-msgstr "impossibile applicare «\\~» su teste di identica altezza"
-
#: chord-tremolo-engraver.cc:88
msgid "No tremolo to end"
msgstr "Nessun tremolo alla fine"
msgid "expected to read %d characters, got %d"
msgstr "si prevedeva di leggere %d caratteri, se ne sono ottenuti %d"
-#: axis-group-interface.cc:631
+#: axis-group-interface.cc:627
msgid "an outside-staff object should have a direction, defaulting to up"
msgstr "un oggetto esterno al rigo dovrebbe avere una direzione, si imposta in su come da impostazione predefinita"
-#: coherent-ligature-engraver.cc:111
+#: coherent-ligature-engraver.cc:110
#, c-format
msgid "Coherent_ligature_engraver: setting `spacing-increment=0.01': ptr=%ul"
msgstr "Coherent_ligature_engraver: impostare `spacing-increment=0.01': ptr=%ul"
-#: percent-repeat-engraver.cc:148
+#: percent-repeat-engraver.cc:147
msgid "unterminated percent repeat"
msgstr "ripetizione percentuale non terminata"
-#: note-head.cc:76
+#: note-head.cc:75
#, c-format
msgid "none of note heads `%s' or `%s' found"
msgstr "non si è trovata alcuna delle teste delle note «%s» o «%s»"
msgid " scheme encoding: "
msgstr " codifica di Scheme: "
-#: all-font-metrics.cc:156
+#: all-font-metrics.cc:153
#, c-format
msgid "cannot find font: `%s'"
msgstr "impossibile trovare il tipo di carattere: «%s»"
-#: property-iterator.cc:85
+#: property-iterator.cc:93
#, c-format
msgid "not a grob name, `%s'"
msgstr "non è il nome di un grob, «%s»"
msgid "barcheck failed at: %s"
msgstr "controllo di battuta fallito a: %s"
-#: stem.cc:116
+#: stem.cc:114
msgid "weird stem size, check for narrow beams"
msgstr "strana dimensione del gambo, controllare di non avere travature strette"
-#: stem.cc:657
+#: stem.cc:652
#, c-format
msgid "flag `%s' not found"
msgstr "non si trova la coda uncinata «%s»"
-#: stem.cc:673
+#: stem.cc:668
#, c-format
msgid "flag stroke `%s' not found"
msgstr "non si trova il tratto «%s» della coda uncinata"
msgid "\tprevious break: %d"
msgstr "\tinterruzione precedente: %d"
-#: lily-parser.cc:106
+#: lily-parser.cc:105
msgid "Parsing..."
msgstr "Analisi..."
-#: lily-parser.cc:134
+#: lily-parser.cc:133
msgid "braces do not match"
msgstr "le graffe non corrispondono"
-#: score.cc:178
+#: score.cc:176
msgid "already have music in score"
msgstr "musica già presente nello spartito"
-#: score.cc:179
+#: score.cc:177
msgid "this is the previous music"
msgstr "questa è la musica precedente"
-#: score.cc:184
+#: score.cc:182
msgid "errors found, ignoring music expression"
msgstr "trovati degli errori, si ignora l'espressione musicale"
msgid "FreeType error: %s"
msgstr "Errore FreeType: %s"
-#: open-type-font.cc:111
+#: open-type-font.cc:110
#, c-format
msgid "unsupported font format: %s"
msgstr "formato di tipo di carattere non supportato: %s"
-#: open-type-font.cc:113
+#: open-type-font.cc:112
#, c-format
msgid "error reading font file %s: %s"
msgstr "errore nella lettura del file del tipo di carattere %s: %s"
-#: open-type-font.cc:188
+#: open-type-font.cc:187
#, c-format
msgid "FT_Get_Glyph_Name () Freetype error: %s"
msgstr "errore di Freetype in FT_Get_Glyph_Name (): %s"
msgid "cannot write to file: `%s'"
msgstr "impossibile scrivere su file: «%s»"
-#: parser.yy:820
+#: parser.yy:825
msgid "\\paper cannot be used in \\score, use \\layout instead"
msgstr "non si può usare \\paper dentro \\score, usare \\layout al suo posto"
-#: parser.yy:844
+#: parser.yy:849
msgid "need \\paper for paper block"
msgstr "è necessario \\paper per il blocco \"paper\""
-#: parser.yy:1363
+#: parser.yy:1369
msgid "only \\consists takes non-string argument."
msgstr "solo \\consists prende un argomento diverso da una stringa"
-#: parser.yy:1376
+#: parser.yy:1382
msgid "Grob name should be alphanumeric"
msgstr "Il nome del grob deve essere alfanumerico"
-#: parser.yy:1685
+#: parser.yy:1697
msgid "second argument must be pitch list"
msgstr "il secondo argomento deve essere una lista di altezze"
-#: parser.yy:1716 parser.yy:1721 parser.yy:2194
+#: parser.yy:1728 parser.yy:1733 parser.yy:2206
msgid "have to be in Lyric mode for lyrics"
msgstr "bisogna essere in modo \"Lyric\" per i testi"
-#: parser.yy:1818
+#: parser.yy:1830
msgid "expecting string as script definition"
msgstr "ci si aspetta una stringa come definizione dello script"
-#: parser.yy:1973 parser.yy:2024
+#: parser.yy:1985 parser.yy:2036
#, c-format
msgid "not a duration: %d"
msgstr "non è una durata: %d"
-#: parser.yy:2148
+#: parser.yy:2160
msgid "have to be in Note mode for notes"
msgstr "bisogna essere in modo \"Note\" per le note"
-#: parser.yy:2209
+#: parser.yy:2221
msgid "have to be in Chord mode for chords"
msgstr "bisogna essere in modo \"Chord\" per gli accordi"
-#: lexer.ll:190
+#: lexer.ll:192
msgid "stray UTF-8 BOM encountered"
msgstr "si è incontrato un segno BOM UTF-8 isolato"
-#: lexer.ll:194
+#: lexer.ll:196
msgid "Skipping UTF-8 BOM"
msgstr "Si ignora il BOM UTF-8"
-#: lexer.ll:249
+#: lexer.ll:251
#, c-format
msgid "Renaming input to: `%s'"
msgstr "Si rinomina l'input in: «%s»"
-#: lexer.ll:266
+#: lexer.ll:268
msgid "quoted string expected after \\version"
msgstr "\\version deve essere seguito da una stringa compresa tra virgolette"
-#: lexer.ll:270
+#: lexer.ll:272
msgid "quoted string expected after \\sourcefilename"
msgstr "\\sourcefilename deve essere seguito da una stringa compresa tra virgolette"
-#: lexer.ll:274
+#: lexer.ll:276
msgid "integer expected after \\sourcefileline"
msgstr "\\sourcefileline deve essere seguito da un intero"
-#: lexer.ll:287
+#: lexer.ll:289
msgid "EOF found inside a comment"
msgstr "fine del file (EOF) trovata in un commento"
-#: lexer.ll:302
+#: lexer.ll:304
msgid "\\maininput not allowed outside init files"
msgstr "\\maininput non permesso fuori dai file di inizializzazione"
-#: lexer.ll:326
+#: lexer.ll:328
#, c-format
msgid "wrong or undefined identifier: `%s'"
msgstr "indentificatore errato o non definito: «%s»"
#. backup rule
-#: lexer.ll:335
+#: lexer.ll:337
msgid "end quote missing"
msgstr "mancano le virgolette di chiusura"
-#: lexer.ll:485
+#: lexer.ll:487
msgid "Brace found at end of lyric. Did you forget a space?"
msgstr "Trovata una parentesi alla fine del testo. È stato dimenticato uno spazio?"
-#: lexer.ll:595
+#: lexer.ll:597
msgid "Brace found at end of markup. Did you forget a space?"
msgstr "Trovata una parentesi alla fine della marcatura. È stato dimenticato uno spazio?"
-#: lexer.ll:699
+#: lexer.ll:701
#, c-format
msgid "invalid character: `%c'"
msgstr "carattere non valido: «%c»"
-#: lexer.ll:814 lexer.ll:815
+#: lexer.ll:822 lexer.ll:823
#, c-format
msgid "unknown escaped string: `\\%s'"
msgstr "stringa di escape sconosciuta: «\\%s»"
-#: lexer.ll:924 lexer.ll:925
+#: lexer.ll:932 lexer.ll:933
#, c-format
msgid "file too old: %s (oldest supported: %s)"
msgstr "file troppo vecchio: %s (il più vecchio che si può gestire è: %s)"
-#: lexer.ll:925 lexer.ll:926
+#: lexer.ll:933 lexer.ll:934
msgid "consider updating the input with the convert-ly script"
msgstr "si consideri di aggiornare l'input con lo script convert-ly"
-#: lexer.ll:931 lexer.ll:932
+#: lexer.ll:939 lexer.ll:940
#, c-format
msgid "program too old: %s (file requires: %s)"
msgstr "programma troppo vecchio: %s (il file richiede: %s)"
msgid "Writing ~S..."
msgstr "Scrittura di ~S..."
-#: documentation-lib.scm:198
+#: documentation-lib.scm:184
+#, scheme-format
+msgid "cannot find description for property `~S' (~S)"
+msgstr "impossibile trovare la descrizione per la proprietà \"~S\" (~S)"
+
+#: documentation-lib.scm:205
#, scheme-format
msgid "cannot find description for property ~S (~S)"
msgstr "impossibile trovare la descrizione per la proprietà ~S (~S)"
msgid "symbol ~S redefined"
msgstr "simbolo ~S ridefinito"
-#: paper.scm:115
+#: paper.scm:117
msgid "set-global-staff-size: not in toplevel scope"
msgstr "set-global-staff-size: non è nell'ambito di livello più alto"
-#: paper.scm:296
+#: paper.scm:301
#, scheme-format
msgid "This is not a \\layout {} object, ~S"
msgstr "Questo non è un oggetto \\layout {}, ~S"
-#: paper.scm:308
+#: paper.scm:313
#, scheme-format
msgid "Unknown paper size: ~a"
msgstr "Dimensione del foglio sconosciuta: ~a"
#. TODO: should raise (generic) exception with throw, and catch
#. that in parse-scm.cc
-#: paper.scm:323
+#: paper.scm:328
msgid "Must use #(set-paper-size .. ) within \\paper { ... }"
msgstr "Si deve usare #(set-paper-size .. ) all'interno di \\paper { ... }"
msgid "wrong type for argument ~a. Expecting ~a, found ~s"
msgstr "tipo di argomento errato per ~a. Previsto ~a, trovato ~s"
-#: lily.scm:716
+#: lily.scm:710
msgid "Compilation successfully completed"
msgstr "Compilazione completata con successo"
-#: lily.scm:717
+#: lily.scm:711
msgid "Compilation completed with warnings or errors"
msgstr "Compilazione completata con avvertimenti o errori"
-#: lily.scm:779
+#: lily.scm:773
#, scheme-format
msgid "job ~a terminated with signal: ~a"
msgstr "il lavoro ~a è terminato col segnale ~a"
-#: lily.scm:782
+#: lily.scm:776
#, scheme-format
msgid ""
"logfile ~a (exit ~a):\n"
"file di registro ~a (uscita ~a):\n"
"~a"
-#: lily.scm:804 lily.scm:882
+#: lily.scm:798 lily.scm:876
#, scheme-format
msgid "failed files: ~S"
msgstr "errore nei file: ~S"
-#: lily.scm:873
+#: lily.scm:867
#, scheme-format
msgid "Redirecting output to ~a..."
msgstr "Redirezione dell'output verso ~a..."
-#: lily.scm:892
+#: lily.scm:886
#, scheme-format
msgid "Invoking `~a'...\n"
msgstr "Chiamata di «~a»...\n"
msgid "Found infinity or nan in output. Substituting 0.0"
msgstr "Trovato infinito o un valore non numerico nell'output. Sostituito con 0.0"
-#: output-ps.scm:289 output-svg.scm:550
+#: output-ps.scm:299 output-svg.scm:550
#, scheme-format
msgid "unknown line-cap-style: ~S"
msgstr "line-cap-style sconosciuto: ~S"
-#: output-ps.scm:294 output-svg.scm:556
+#: output-ps.scm:304 output-svg.scm:556
#, scheme-format
msgid "unknown line-join-style: ~S"
msgstr "line-join-style sconosciuto: ~S"
msgid "Could not find language `~a'. Ignoring."
msgstr "Impossibile trovare il linguaggio \"~a\". Si ignora."
-#: define-music-types.scm:740
+#: define-music-types.scm:747
#, scheme-format
msgid "symbol expected: ~S"
msgstr "simbolo atteso: ~S"
-#: define-music-types.scm:743
+#: define-music-types.scm:750
#, scheme-format
msgid "cannot find music object: ~S"
msgstr "impossibile trovare l'oggetto musicale: ~S"
-#: define-music-types.scm:762
+#: define-music-types.scm:769
#, scheme-format
msgid "unknown repeat type `~S'"
msgstr "tipo di ripetizione sconosciuto «~S»"
-#: define-music-types.scm:763
+#: define-music-types.scm:770
msgid "See define-music-types.scm for supported repeats"
msgstr "Si veda define-music-types.scm per le ripetizioni supportate"
-#: translation-functions.scm:341
+#: translation-functions.scm:350
#, scheme-format
msgid "Negative fret for pitch ~a on string ~a"
msgstr "Tasto negativo per l'altezza ~a sulla corda ~a"
-#: translation-functions.scm:385
+#: translation-functions.scm:401
#, scheme-format
msgid "No open string for pitch ~a"
msgstr "Nessuna corda a vuoto per l'altezza ~a"
-#: translation-functions.scm:400
+#: translation-functions.scm:416 translation-functions.scm:428
#, scheme-format
msgid "Requested string for pitch requires negative fret: string ~a pitch ~a"
msgstr "La corda richiesta per questa altezza necessita un tasto negativo: corda ~a altezza ~a"
-#: translation-functions.scm:401
-msgid "Ignoring string request."
-msgstr "Ignorata la richiesta di questa corda."
+#: translation-functions.scm:419
+msgid "Ignoring string request and recalculating."
+msgstr "Ignorata la richiesta di questa corda, viene ricalcolata."
+
+#: translation-functions.scm:431
+msgid "Ignoring note in tablature."
+msgstr "Ignorata la nota nell'intavolatura."
-#: translation-functions.scm:414
+#: translation-functions.scm:454
#, scheme-format
msgid "No string for pitch ~a (given frets ~a)"
msgstr "Nessuna corda per l'altezza ~a (se i tasti sono ~a)"
-#: translation-functions.scm:515
+#: translation-functions.scm:559
#, scheme-format
msgid ""
"No label for fret ~a (on string ~a);\n"
msgid "do not know how to embed font ~s ~s ~s"
msgstr "non so come inserire il tipo di carattere ~s ~s ~s"
-#: framework-ps.scm:669
+#: framework-ps.scm:686
msgid ""
"\n"
"The PostScript backend does not support the\n"
msgid "invalid tremolo repeat count: ~a"
msgstr "numero di ripetizioni di tremolo non valido: ~a"
-#: music-functions.scm:618
+#: music-functions.scm:619
#, scheme-format
msgid "music expected: ~S"
msgstr "musica attesa: ~S"
msgid "Bar check failed. Expect to be at ~a, instead at ~a"
msgstr "Controllo di battuta fallito. Avrebbe dovuto trovarsi a ~a invece che a ~a"
-#: music-functions.scm:846
+#: music-functions.scm:845
#, scheme-format
msgid "cannot find quoted music: `~S'"
msgstr "impossibile trovare la musica citata: «~S»"
-#: music-functions.scm:982
+#: music-functions.scm:979
msgid "Add @var{octave-shift} to the octave of @var{pitch}."
msgstr "Aggiungere @var{octave-shift} all'ottava di @var{altezza}."
-#: music-functions.scm:1037
+#: music-functions.scm:1039
#, scheme-format
msgid "Unknown octaveness type: ~S "
msgstr "Tipo di ottava sconosciuto: ~S "
-#: music-functions.scm:1038
+#: music-functions.scm:1040
msgid "Defaulting to 'any-octave."
msgstr "Applicazione del valore predefinito 'any-octave."
msgid "~a exited with status: ~S"
msgstr "~a è terminato con stato ~S"
-#: define-markup-commands.scm:803
+#: define-markup-commands.scm:883
msgid "no systems found in \\score markup, does it have a \\layout block?"
msgstr "non si è trovato alcun sistema nella marcatura \\score, contiene un blocco \\layout?"
-#: define-markup-commands.scm:2404
+#: define-markup-commands.scm:2561
#, scheme-format
msgid "Cannot find glyph ~a"
msgstr "Impossibile trovare il glifo ~a"
-#: define-markup-commands.scm:2830
+#: define-markup-commands.scm:2987
#, scheme-format
msgid "no brace found for point size ~S "
msgstr "non c'è una graffa che abbia una dimensione di ~S punti"
-#: define-markup-commands.scm:2831
+#: define-markup-commands.scm:2988
#, scheme-format
msgid "defaulting to ~S pt"
msgstr "si applica la dimensione predefinita ~S pt"
-#: define-markup-commands.scm:2984
+#: define-markup-commands.scm:3141
#, scheme-format
msgid "not a valid duration string: ~a"
msgstr "non è una durata valida per la stringa: ~a"
#~ msgid "from musical definition: %s"
#~ msgstr "della definizione musicale: %s"
-#, fuzzy
-#~ msgid "cannot find start of phrasing slur"
-#~ msgstr "non trovo le estremità di %s"
-
#, fuzzy
#~ msgid "unterminated pedal bracket"
#~ msgstr "beam non terminato"
# Translation of LilyPond.
-# Copyright (C) 1998--2011 Han-Wen Nienhuys, Jan Nieuwenhuizen
-# This file is distributed under the same license as the lilypond package.
+# Copyright (C) 998--2011 Han-Wen Nienhuys, Jan Nieuwenhuizen
+# This file is distributed under the same license as the PACKAGE package.
#
msgid ""
msgstr ""
-"Project-Id-Version: lilypond 2.13.53\n"
+"Project-Id-Version: 2.15.8\n"
"Report-Msgid-Bugs-To: http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs\n"
-"POT-Creation-Date: 2011-03-02 10:34+0100\n"
+"POT-Creation-Date: 2011-08-02 19:43+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "%s has been replaced by %s"
msgstr ""
-#: convertrules.py:24 lilylib.py:78 musicexp.py:17 convert-ly.py:64 warn.cc:66
-#: input.cc:109
+#: convertrules.py:24 lilylib.py:85 musicexp.py:17 convert-ly.py:64 warn.cc:66
+#: input.cc:108
#, c-format, python-format
msgid "warning: %s"
msgstr ""
#: convertrules.py:86 convertrules.py:1905 convertrules.py:2084
#: convertrules.py:2236 convertrules.py:2566 convertrules.py:2862
+#: convertrules.py:3206
msgid "bump version for release"
msgstr ""
"instrument.\n"
msgstr ""
+#: convertrules.py:3211
+msgid "Change in internal property for MultiMeasureRest"
+msgstr ""
+
+#: convertrules.py:3214
+msgid ""
+"use-breve-rest. This internal property has been replaced by round-to-longer-"
+"rest and usable-duration-logs.\n"
+msgstr ""
+
+#: convertrules.py:3219
+msgid "Handling of non-automatic footnotes."
+msgstr ""
+
+#: convertrules.py:3223
+msgid ""
+"If you are using non-automatic footnotes, make sure to set footnote-auto-"
+"numbering = ##f in the paper block.\n"
+msgstr ""
+
#: book_base.py:24
#, python-format
msgid "file not found: %s"
msgid "Output function not implemented"
msgstr ""
-#: lilylib.py:81 musicxml.py:13 convert-ly.py:67 warn.cc:72 input.cc:115
-#: input.cc:123
+#: lilylib.py:88 musicxml.py:13 convert-ly.py:67 warn.cc:72 input.cc:114
+#: input.cc:122
#, c-format, python-format
msgid "error: %s"
msgstr ""
-#: lilylib.py:124 lilylib.py:175
+#: lilylib.py:131
+#, python-format
+msgid "Processing %s.ly"
+msgstr ""
+
+#: lilylib.py:135 lilylib.py:198
#, python-format
msgid "Invoking `%s'"
msgstr ""
-#: lilylib.py:126 lilylib.py:177
+#: lilylib.py:137 lilylib.py:200
#, python-format
msgid "Running %s..."
msgstr ""
-#: lilylib.py:253
+#: lilylib.py:276
#, python-format
msgid "Usage: %s"
msgstr ""
msgid "cannot find \\begin{document} in LaTeX document"
msgstr ""
-#: musicxml2ly.py:223
+#: musicxml2ly.py:224
#, python-format
msgid ""
"Encountered file created by %s, containing wrong beaming information. All "
"beaming information in the MusicXML file will be ignored"
msgstr ""
-#: musicxml2ly.py:239 musicxml2ly.py:241
+#: musicxml2ly.py:240 musicxml2ly.py:242
#, python-format
msgid "Unprocessed PartGroupInfo %s encountered"
msgstr ""
-#: musicxml2ly.py:494
+#: musicxml2ly.py:495
#, python-format
msgid "Encountered note at %s without type and duration (=%s)"
msgstr ""
-#: musicxml2ly.py:514
+#: musicxml2ly.py:515
#, python-format
msgid ""
"Encountered rational duration with denominator %s, unable to convert to "
"lilypond duration"
msgstr ""
-#: musicxml2ly.py:761
+#: musicxml2ly.py:762
msgid "Unable to extract key signature!"
msgstr ""
-#: musicxml2ly.py:788
+#: musicxml2ly.py:789
#, python-format
msgid "unknown mode %s, expecting 'major' or 'minor' or a church mode!"
msgstr ""
-#: musicxml2ly.py:926
+#: musicxml2ly.py:927
#, python-format
msgid "Encountered unprocessed marker %s\n"
msgstr ""
-#: musicxml2ly.py:1020
+#: musicxml2ly.py:1021
#, python-format
msgid "unknown span event %s"
msgstr ""
-#: musicxml2ly.py:1030
+#: musicxml2ly.py:1031
#, python-format
msgid "unknown span type %s for %s"
msgstr ""
-#: musicxml2ly.py:1450
+#: musicxml2ly.py:1451
msgid "Unknown metronome mark, ignoring"
msgstr ""
#. TODO: Implement the other (more complex) way for tempo marks!
-#: musicxml2ly.py:1455
+#: musicxml2ly.py:1456
msgid ""
"Metronome marks with complex relations (<metronome-note> in MusicXML) are "
"not yet implemented."
msgstr ""
-#: musicxml2ly.py:1657
+#: musicxml2ly.py:1658
#, python-format
msgid "Unable to convert chord type %s to lilypond."
msgstr ""
-#: musicxml2ly.py:1806
+#: musicxml2ly.py:1807
#, python-format
msgid "drum %s type unknown, please add to instrument_drumtype_dict"
msgstr ""
-#: musicxml2ly.py:1810
+#: musicxml2ly.py:1811
msgid "cannot find suitable event"
msgstr ""
-#: musicxml2ly.py:1958
+#: musicxml2ly.py:1959
#, python-format
msgid "Negative skip %s (from position %s to %s)"
msgstr ""
-#: musicxml2ly.py:2099
+#: musicxml2ly.py:2100
#, python-format
msgid "Negative skip found: from %s to %s, difference is %s"
msgstr ""
-#: musicxml2ly.py:2180
+#: musicxml2ly.py:2181
#, python-format
msgid "unexpected %s; expected %s or %s or %s"
msgstr ""
-#: musicxml2ly.py:2286
+#: musicxml2ly.py:2287
msgid "Encountered closing slur, but no slur is open"
msgstr ""
-#: musicxml2ly.py:2289
+#: musicxml2ly.py:2290
msgid "Cannot have two simultaneous (closing) slurs"
msgstr ""
-#: musicxml2ly.py:2298
+#: musicxml2ly.py:2299
msgid "Cannot have a slur inside another slur"
msgstr ""
-#: musicxml2ly.py:2301
+#: musicxml2ly.py:2302
msgid "Cannot have two simultaneous slurs"
msgstr ""
-#: musicxml2ly.py:2435
+#: musicxml2ly.py:2436
#, python-format
msgid "cannot simultaneously have more than one mode: %s"
msgstr ""
-#: musicxml2ly.py:2543
+#: musicxml2ly.py:2544
msgid "Converting to LilyPond expressions..."
msgstr ""
-#: musicxml2ly.py:2554
+#: musicxml2ly.py:2555
msgid "musicxml2ly [OPTION]... FILE.xml"
msgstr ""
-#: musicxml2ly.py:2556
+#: musicxml2ly.py:2557
msgid ""
"Convert MusicXML from FILE.xml to LilyPond input.\n"
"If the given filename is -, musicxml2ly reads from the command line.\n"
msgstr ""
-#: musicxml2ly.py:2562 midi2ly.py:987 abc2ly.py:1386 lilypond-book.py:140
-#: convert-ly.py:98 etf2ly.py:1202 main.cc:157
+#: musicxml2ly.py:2563 midi2ly.py:1060 abc2ly.py:1386 lilypond-book.py:140
+#: convert-ly.py:98 etf2ly.py:1202 main.cc:159
msgid "show this help and exit"
msgstr ""
-#: musicxml2ly.py:2566
+#: musicxml2ly.py:2567
msgid ""
"Copyright (c) 2005--2011 by\n"
" Han-Wen Nienhuys <hanwen@xs4all.nl>,\n"
" Reinhold Kainhofer <reinhold@kainhofer.com>\n"
msgstr ""
-#: musicxml2ly.py:2580 midi2ly.py:1015 abc2ly.py:1382 lilypond-book.py:212
-#: convert-ly.py:94 etf2ly.py:1206 main.cc:168
+#: musicxml2ly.py:2581 midi2ly.py:1091 abc2ly.py:1382 lilypond-book.py:217
+#: convert-ly.py:94 etf2ly.py:1206 main.cc:174
msgid "show version number and exit"
msgstr ""
-#: musicxml2ly.py:2585 midi2ly.py:1009 lilypond-book.py:204 main.cc:169
+#: musicxml2ly.py:2586 midi2ly.py:1085 lilypond-book.py:209 main.cc:175
msgid "be verbose"
msgstr ""
-#: musicxml2ly.py:2591
+#: musicxml2ly.py:2592
msgid "use lxml.etree; uses less memory and cpu time"
msgstr ""
-#: musicxml2ly.py:2597
+#: musicxml2ly.py:2598
msgid "input file is a zip-compressed MusicXML file"
msgstr ""
-#: musicxml2ly.py:2603
+#: musicxml2ly.py:2604
msgid "convert pitches in relative mode (default)"
msgstr ""
-#: musicxml2ly.py:2608
+#: musicxml2ly.py:2609
msgid "convert pitches in absolute mode"
msgstr ""
-#: musicxml2ly.py:2611
+#: musicxml2ly.py:2612
msgid "LANG"
msgstr ""
-#: musicxml2ly.py:2613
+#: musicxml2ly.py:2614
msgid "use LANG for pitch names, e.g. 'deutsch' for note names in German"
msgstr ""
-#: musicxml2ly.py:2619
+#: musicxml2ly.py:2620
msgid "do not convert directions (^, _ or -) for articulations, dynamics, etc."
msgstr ""
-#: musicxml2ly.py:2625
+#: musicxml2ly.py:2626
msgid "do not convert exact vertical positions of rests"
msgstr ""
-#: musicxml2ly.py:2631
+#: musicxml2ly.py:2632
msgid "do not convert the exact page layout and breaks"
msgstr ""
-#: musicxml2ly.py:2637
+#: musicxml2ly.py:2638
msgid ""
"do not convert beaming information, use lilypond's automatic beaming instead"
msgstr ""
-#: musicxml2ly.py:2640 midi2ly.py:992 midi2ly.py:997 etf2ly.py:1208
-#: main.cc:161 main.cc:166
+#: musicxml2ly.py:2641 midi2ly.py:1065 midi2ly.py:1070 etf2ly.py:1208
+#: main.cc:165 main.cc:172
msgid "FILE"
msgstr ""
-#: musicxml2ly.py:2645
+#: musicxml2ly.py:2646
msgid "set output filename to FILE, stdout if -"
msgstr ""
#. "Report bugs in English via %s",
#. or if there is a LilyPond users list or forum in your language
#. "Report bugs in English via %s or in YOUR_LANG via URI"
-#: musicxml2ly.py:2648 midi2ly.py:1028 abc2ly.py:1395 lilypond-book.py:234
-#: convert-ly.py:144 etf2ly.py:1216 main.cc:281
+#: musicxml2ly.py:2649 midi2ly.py:1104 abc2ly.py:1395 lilypond-book.py:239
+#: convert-ly.py:144 etf2ly.py:1216 main.cc:285
#, c-format, python-format
msgid "Report bugs via %s"
msgstr ""
-#: musicxml2ly.py:2728
+#: musicxml2ly.py:2729
#, python-format
msgid "unknown part in part-list: %s"
msgstr ""
-#: musicxml2ly.py:2790
+#: musicxml2ly.py:2791
msgid "Input is compressed, extracting raw MusicXML data from stdin"
msgstr ""
-#: musicxml2ly.py:2793
+#: musicxml2ly.py:2804
#, python-format
msgid "Input file %s is compressed, extracting raw MusicXML data"
msgstr ""
-#: musicxml2ly.py:2823
+#: musicxml2ly.py:2834
msgid "Reading MusicXML from Standard input ..."
msgstr ""
-#: musicxml2ly.py:2825
+#: musicxml2ly.py:2836
#, python-format
msgid "Reading MusicXML from %s ..."
msgstr ""
-#: musicxml2ly.py:2858
+#: musicxml2ly.py:2869
#, python-format
msgid "Output to `%s'"
msgstr ""
-#: musicxml2ly.py:2925
+#: musicxml2ly.py:2936
#, python-format
msgid "Unable to find input file %s"
msgstr ""
-#: midi2ly.py:90 lilypond-book.py:116 convert-ly.py:81 etf2ly.py:1189
+#: midi2ly.py:81 lilypond-book.py:116 convert-ly.py:81 etf2ly.py:1189
#, python-format
msgid "Copyright (c) %s by"
msgstr ""
-#: midi2ly.py:92 lilypond-book.py:118 convert-ly.py:83 etf2ly.py:1191
+#: midi2ly.py:83 lilypond-book.py:118 convert-ly.py:83 etf2ly.py:1191
msgid "Distributed under terms of the GNU General Public License."
msgstr ""
-#: midi2ly.py:93 lilypond-book.py:119 convert-ly.py:84 etf2ly.py:1192
+#: midi2ly.py:84 lilypond-book.py:119 convert-ly.py:84 etf2ly.py:1192
msgid "It comes with NO WARRANTY."
msgstr ""
-#: midi2ly.py:99
+#: midi2ly.py:90
msgid "warning: "
msgstr ""
-#: midi2ly.py:102 midi2ly.py:1041
+#: midi2ly.py:93 midi2ly.py:1121
msgid "error: "
msgstr ""
-#: midi2ly.py:103
+#: midi2ly.py:94
msgid "Exiting... "
msgstr ""
-#: midi2ly.py:960
+#: midi2ly.py:834
+msgid "found more than 5 voices on a staff, expect bad output"
+msgstr ""
+
+#: midi2ly.py:1030
#, python-format
msgid "%s output to `%s'..."
msgstr ""
-#: midi2ly.py:972 abc2ly.py:1373 lilypond-book.py:122 convert-ly.py:87
+#: midi2ly.py:1042 abc2ly.py:1373 lilypond-book.py:122 convert-ly.py:87
#, python-format
msgid "%s [OPTION]... FILE"
msgstr ""
-#: midi2ly.py:973
+#: midi2ly.py:1043
#, python-format
msgid "Convert %s to LilyPond input.\n"
msgstr ""
-#: midi2ly.py:978
+#: midi2ly.py:1048
msgid "print absolute pitches"
msgstr ""
-#: midi2ly.py:980 midi2ly.py:1002
+#: midi2ly.py:1050 midi2ly.py:1075
msgid "DUR"
msgstr ""
-#: midi2ly.py:981
+#: midi2ly.py:1051
msgid "quantise note durations on DUR"
msgstr ""
-#: midi2ly.py:984
+#: midi2ly.py:1054
+msgid "debug printing"
+msgstr ""
+
+#: midi2ly.py:1057
msgid "print explicit durations"
msgstr ""
-#: midi2ly.py:989
+#: midi2ly.py:1062
msgid "prepend FILE to output"
msgstr ""
-#: midi2ly.py:993
+#: midi2ly.py:1066
msgid "set key: ALT=+sharps|-flats; MINOR=1"
msgstr ""
-#: midi2ly.py:994
+#: midi2ly.py:1067
msgid "ALT[:MINOR]"
msgstr ""
-#: midi2ly.py:996 abc2ly.py:1388 etf2ly.py:1207
+#: midi2ly.py:1069 abc2ly.py:1388 etf2ly.py:1207
msgid "write output to FILE"
msgstr ""
-#: midi2ly.py:999
+#: midi2ly.py:1072
msgid "preview of first 4 bars"
msgstr ""
-#: midi2ly.py:1001
+#: midi2ly.py:1074
msgid "quantise note starts on DUR"
msgstr ""
-#: midi2ly.py:1004
+#: midi2ly.py:1078
+msgid "use s instead of r for rests"
+msgstr ""
+
+#: midi2ly.py:1080
msgid "DUR*NUM/DEN"
msgstr ""
-#: midi2ly.py:1007
+#: midi2ly.py:1083
msgid "allow tuplet durations DUR*NUM/DEN"
msgstr ""
-#: midi2ly.py:1016 lilypond-book.py:215 convert-ly.py:139 etf2ly.py:1210
-#: main.cc:170
+#: midi2ly.py:1092 lilypond-book.py:220 convert-ly.py:139 etf2ly.py:1210
+#: main.cc:176
msgid "show warranty and copyright"
msgstr ""
-#: midi2ly.py:1019
+#: midi2ly.py:1095
msgid "treat every text as a lyric"
msgstr ""
-#: midi2ly.py:1022
+#: midi2ly.py:1098
msgid "Examples"
msgstr ""
-#: midi2ly.py:1042
+#: midi2ly.py:1122
msgid "no files specified on command line."
msgstr ""
msgstr ""
#: lilypond-book.py:143 lilypond-book.py:150 lilypond-book.py:163
-#: lilypond-book.py:173 lilypond-book.py:189 lilypond-book.py:195 main.cc:160
+#: lilypond-book.py:173 lilypond-book.py:194 lilypond-book.py:200 main.cc:164
msgid "DIR"
msgstr ""
msgid "process ly_files using COMMAND FILE..."
msgstr ""
-#: lilypond-book.py:182
+#: lilypond-book.py:183
+msgid "Redirect the lilypond output"
+msgstr ""
+
+#: lilypond-book.py:187
msgid "Compile snippets in safe mode"
msgstr ""
-#: lilypond-book.py:188
+#: lilypond-book.py:193
msgid "do not fail if no lilypond output is found"
msgstr ""
-#: lilypond-book.py:194
+#: lilypond-book.py:199
msgid "do not fail if no PNG images are found for EPS files"
msgstr ""
-#: lilypond-book.py:200
+#: lilypond-book.py:205
msgid "write snippet output files with the same base name as their source file"
msgstr ""
-#: lilypond-book.py:220
+#: lilypond-book.py:225
msgid ""
"run executable PROG instead of latex, or in\n"
"case --pdf option is set instead of pdflatex"
msgstr ""
-#: lilypond-book.py:222
+#: lilypond-book.py:227
msgid "PROG"
msgstr ""
-#: lilypond-book.py:228
+#: lilypond-book.py:233
msgid "create PDF files for use with PDFTeX"
msgstr ""
-#: lilypond-book.py:419
+#: lilypond-book.py:428
msgid "Writing snippets..."
msgstr ""
-#: lilypond-book.py:425
+#: lilypond-book.py:434
msgid "Processing..."
msgstr ""
-#: lilypond-book.py:431
+#: lilypond-book.py:440
msgid "All snippets are up to date..."
msgstr ""
-#: lilypond-book.py:452
+#: lilypond-book.py:461
#, python-format
msgid "cannot determine format for: %s"
msgstr ""
-#: lilypond-book.py:461
+#: lilypond-book.py:470
#, python-format
msgid "%s is up to date."
msgstr ""
-#: lilypond-book.py:475
+#: lilypond-book.py:484
#, python-format
msgid "Writing `%s'..."
msgstr ""
-#: lilypond-book.py:537
+#: lilypond-book.py:546
msgid "Output would overwrite input file; use --output."
msgstr ""
-#: lilypond-book.py:541
+#: lilypond-book.py:550
#, python-format
msgid "Reading %s..."
msgstr ""
-#: lilypond-book.py:549
+#: lilypond-book.py:558
msgid "Dissecting..."
msgstr ""
-#: lilypond-book.py:561
+#: lilypond-book.py:570
#, python-format
msgid "Compiling %s..."
msgstr ""
-#: lilypond-book.py:570
+#: lilypond-book.py:579
#, python-format
msgid "Processing include: %s"
msgstr ""
-#: lilypond-book.py:582
+#: lilypond-book.py:591
#, python-format
msgid "Removing `%s'"
msgstr ""
msgid "success: %s"
msgstr ""
-#: warn.cc:86 grob.cc:617 input.cc:97
+#: warn.cc:86 grob.cc:613 input.cc:97
#, c-format
msgid "programming error: %s"
msgstr ""
msgid "Vaticana_ligature: zero join (delta_pitch == 0)"
msgstr ""
-#: parse-scm.cc:101
+#: parse-scm.cc:100
msgid "GUILE signaled an error for the expression beginning here"
msgstr ""
msgstr ""
#. if we get to here, just put everything on one line
-#: constrained-breaking.cc:189 constrained-breaking.cc:207
+#: constrained-breaking.cc:187 constrained-breaking.cc:205
msgid "cannot find line breaking that satisfies constraints"
msgstr ""
-#: horizontal-bracket-engraver.cc:78
+#: horizontal-bracket-engraver.cc:62
msgid "do not have that many brackets"
msgstr ""
-#: horizontal-bracket-engraver.cc:87
+#: horizontal-bracket-engraver.cc:71
msgid "conflicting note group events"
msgstr ""
msgid "unterminated hyphen; removing"
msgstr ""
-#: pango-font.cc:187 open-type-font.cc:319
+#: pango-font.cc:189 open-type-font.cc:318
#, c-format
msgid "FT_Get_Glyph_Name () error: %s"
msgstr ""
-#: pango-font.cc:204
+#: pango-font.cc:205
#, c-format
msgid ""
"Glyph has no name, but font supports glyph naming.\n"
"Skipping glyph U+%0X, file %s"
msgstr ""
-#: pango-font.cc:241
+#: pango-font.cc:242
#, c-format
msgid "no PostScript font name for font `%s'"
msgstr ""
-#: pango-font.cc:290
+#: pango-font.cc:291
msgid "FreeType face has no PostScript font name"
msgstr ""
-#: midi-item.cc:92
+#: midi-item.cc:89
#, c-format
msgid "no such MIDI instrument: `%s'"
msgstr ""
msgid "NoteEvent without pitch"
msgstr ""
-#: rest.cc:159
+#: rest.cc:160
#, c-format
msgid "rest `%s' not found"
msgstr ""
msgid "unterminated beam"
msgstr ""
-#: beam-engraver.cc:266 chord-tremolo-engraver.cc:150
+#: beam-engraver.cc:266 chord-tremolo-engraver.cc:149
msgid "stem must have Rhythmic structure"
msgstr ""
msgid "beam was started here"
msgstr ""
-#: music-iterator.cc:182
+#: music-iterator.cc:181
msgid "Sending non-event to context"
msgstr ""
-#: context.cc:149
+#: context.cc:148
#, c-format
msgid "cannot find or create new `%s'"
msgstr ""
-#: context.cc:207
+#: context.cc:206
#, c-format
msgid "cannot find or create `%s' called `%s'"
msgstr ""
-#: context.cc:269
+#: context.cc:268
#, c-format
msgid "Invalid CreateContext event: Cannot create %s context"
msgstr ""
-#: context.cc:400
+#: context.cc:399
#, c-format
msgid "cannot find or create: `%s'"
msgstr ""
"checks?"
msgstr ""
-#: tie-engraver.cc:116
+#: tie-engraver.cc:117
msgid "unterminated tie"
msgstr ""
-#: tie-engraver.cc:312
+#: tie-engraver.cc:348
msgid "lonely tie"
msgstr ""
"or the ligatura must be LB or SSB"
msgstr ""
-#: mensural-ligature-engraver.cc:386
+#: mensural-ligature-engraver.cc:387
msgid "unexpected case fall-through"
msgstr ""
-#: piano-pedal-engraver.cc:298
+#: piano-pedal-engraver.cc:296
#, c-format
msgid "expect 3 strings for piano pedals, found: %ld"
msgstr ""
-#: piano-pedal-engraver.cc:313 piano-pedal-engraver.cc:324
+#: piano-pedal-engraver.cc:311 piano-pedal-engraver.cc:322
#: piano-pedal-performer.cc:104
#, c-format
msgid "cannot find start of piano pedal: `%s'"
msgstr ""
-#: piano-pedal-engraver.cc:359
+#: piano-pedal-engraver.cc:357
#, c-format
msgid "cannot find start of piano pedal bracket: `%s'"
msgstr ""
-#: input.cc:131 source-file.cc:179 source-file.cc:194
+#: input.cc:130 source-file.cc:178 source-file.cc:193
msgid "position unknown"
msgstr ""
msgid "Layout output to `%s'..."
msgstr ""
-#: general-scheme.cc:306
+#: general-scheme.cc:305
msgid "infinity or NaN encountered while converting Real number"
msgstr ""
-#: general-scheme.cc:307
+#: general-scheme.cc:306
msgid "setting to zero"
msgstr ""
-#: general-scheme.cc:543
+#: general-scheme.cc:540
msgid "Found infinity or nan in output. Substituting 0.0"
msgstr ""
-#: music.cc:151
+#: music.cc:150
#, c-format
msgid "octave check failed; expected \"%s\", found: \"%s\""
msgstr ""
-#: music.cc:219
+#: music.cc:218
msgid "(normalized pitch)"
msgstr ""
-#: music.cc:223
+#: music.cc:222
#, c-format
msgid "Transposing %s by %s makes alteration larger than double"
msgstr ""
msgid "trying to use \\partial after the start of a piece"
msgstr ""
-#: new-fingering-engraver.cc:106
+#: new-fingering-engraver.cc:105
msgid "cannot add text scripts to individual note heads"
msgstr ""
-#: new-fingering-engraver.cc:250
+#: new-fingering-engraver.cc:249
msgid "no placement found for fingerings"
msgstr ""
-#: new-fingering-engraver.cc:251
+#: new-fingering-engraver.cc:250
msgid "placing below"
msgstr ""
msgid "no left bound"
msgstr ""
-#: ligature-engraver.cc:185
+#: ligature-engraver.cc:184
msgid "unterminated ligature"
msgstr ""
-#: ligature-engraver.cc:214
+#: ligature-engraver.cc:211
msgid "ignoring rest: ligature may not contain rest"
msgstr ""
-#: ligature-engraver.cc:215
+#: ligature-engraver.cc:212
msgid "ligature was started here"
msgstr ""
msgid "cannot change, already in translator: %s"
msgstr ""
-#: accidental-engraver.cc:180
+#: accidental-engraver.cc:179
#, c-format
msgid "accidental typesetting list must begin with context-name: %s"
msgstr ""
-#: accidental-engraver.cc:210
+#: accidental-engraver.cc:209
#, c-format
msgid "procedure or context-name expected for accidental rule, found %s"
msgstr ""
-#: ttf.cc:481 ttf.cc:530
+#: ttf.cc:480 ttf.cc:529
#, c-format
msgid "font index %d too large for font `%s', using index 0"
msgstr ""
-#: ttf.cc:513 ttf.cc:565
+#: ttf.cc:512 ttf.cc:564
msgid "font index must be non-negative, using index 0"
msgstr ""
-#: break-alignment-interface.cc:206
+#: break-alignment-interface.cc:199
#, c-format
msgid "No spacing entry from %s to `%s'"
msgstr ""
msgid "Aborting"
msgstr ""
-#: note-collision.cc:497
+#: note-collision.cc:494
msgid "ignoring too many clashing note columns"
msgstr ""
msgid "giving up"
msgstr ""
-#: page-layout-problem.cc:322
+#: page-layout-problem.cc:603
msgid ""
"cannot fit music on page: ragged-spacing was requested, but page was "
"compressed"
msgstr ""
-#: page-layout-problem.cc:325
+#: page-layout-problem.cc:606
#, c-format
msgid "cannot fit music on page: overflow is %f"
msgstr ""
-#: page-layout-problem.cc:327
+#: page-layout-problem.cc:608
msgid "compressing music to fit"
msgstr ""
-#: page-layout-problem.cc:765
+#: page-layout-problem.cc:1047
msgid "staff-affinities should only decrease"
msgstr ""
msgid "mark label must be a markup object"
msgstr ""
-#: new-dynamic-engraver.cc:142
+#: new-dynamic-engraver.cc:168
#, c-format
msgid ""
"unknown crescendo style: %s\n"
"defaulting to hairpin."
msgstr ""
-#: new-dynamic-engraver.cc:200
+#: new-dynamic-engraver.cc:233
#, c-format
msgid "unterminated %s"
msgstr ""
-#: stem-engraver.cc:103
+#: stem-engraver.cc:102
msgid "tremolo duration is too long"
msgstr ""
-#. FIXME:
-#: stem-engraver.cc:140
+#: stem-engraver.cc:154
#, c-format
-msgid "adding note head to incompatible stem (type = %d)"
+msgid "adding note head to incompatible stem (type = %d/%d)"
msgstr ""
-#: stem-engraver.cc:142
+#: stem-engraver.cc:157
msgid "maybe input should specify polyphonic voices"
msgstr ""
-#: lily-lexer.cc:264
+#: lily-lexer.cc:265
msgid "include files are not allowed in safe mode"
msgstr ""
-#: lily-lexer.cc:291
+#: lily-lexer.cc:292
#, c-format
msgid "identifier name is a keyword: `%s'"
msgstr ""
-#: lily-lexer.cc:312
+#: lily-lexer.cc:313
#, c-format
msgid "error at EOF: %s"
msgstr ""
msgid "cannot find Voice `%s'"
msgstr ""
-#: includable-lexer.cc:71 lily-guile.cc:87 lily-parser-scheme.cc:109
+#: includable-lexer.cc:71 lily-guile.cc:86 lily-parser-scheme.cc:109
#, c-format
msgid "cannot find file: `%s'"
msgstr ""
-#: includable-lexer.cc:73 lily-parser-scheme.cc:100
+#: includable-lexer.cc:73 lily-parser-scheme.cc:101
#, c-format
msgid "(search path: `%s')"
msgstr ""
msgstr ""
#. We are completely screwed.
-#: beam.cc:1274
+#: beam.cc:1350
msgid "no viable initial configuration found: may not find good beam slope"
msgstr ""
-#: slur-engraver.cc:93
+#: staff-performer.cc:257
+msgid "MIDI channel wrapped around"
+msgstr ""
+
+#: staff-performer.cc:258
+msgid "remapping modulo 16"
+msgstr ""
+
+#: slur-engraver.cc:90 phrasing-slur-engraver.cc:89
#, c-format
msgid "direction of %s invalid: %d"
msgstr ""
-#: slur-engraver.cc:162
+#: slur-engraver.cc:158
msgid "unterminated slur"
msgstr ""
-#: slur-engraver.cc:174
+#: slur-engraver.cc:183
msgid "cannot end slur"
msgstr ""
-#: font-config.cc:40
+#. We already have a slur, so give a warning and completely ignore
+#. the new slur.
+#: slur-engraver.cc:200
+msgid "already have slur"
+msgstr ""
+
+#: font-config.cc:39
msgid "Initializing FontConfig..."
msgstr ""
-#: font-config.cc:55 font-config-scheme.cc:152
+#: font-config.cc:54 font-config-scheme.cc:151
#, c-format
msgid "failed adding font directory: %s"
msgstr ""
-#: font-config.cc:57 font-config-scheme.cc:154
+#: font-config.cc:56 font-config-scheme.cc:153
#, c-format
msgid "adding font directory: %s"
msgstr ""
-#: font-config.cc:61
+#: font-config.cc:60
msgid "Building font database..."
msgstr ""
msgid "natural alteration glyph not found"
msgstr ""
-#: system.cc:197
+#: system.cc:201
#, c-format
msgid "Element count %d"
msgstr ""
-#: system.cc:303
+#: system.cc:402
#, c-format
msgid "Grob count %d"
msgstr ""
-#: slur.cc:362
+#: slur.cc:359
#, c-format
msgid "Ignoring grob for slur: %s. avoid-slur not set?"
msgstr ""
-#: font-config-scheme.cc:168
+#: font-config-scheme.cc:167
#, c-format
msgid "failed adding font file: %s"
msgstr ""
-#: font-config-scheme.cc:170
+#: font-config-scheme.cc:169
#, c-format
msgid "adding font file: %s"
msgstr ""
msgid "decrescendo too small"
msgstr ""
-#: extender-engraver.cc:170 extender-engraver.cc:179
+#: extender-engraver.cc:169 extender-engraver.cc:178
msgid "unterminated extender"
msgstr ""
-#: lily-guile.cc:89
+#: lily-guile.cc:88
#, c-format
msgid "(load path: `%s')"
msgstr ""
-#: lily-guile.cc:437
+#: lily-guile.cc:431
#, c-format
msgid "cannot find property type-check for `%s' (%s)."
msgstr ""
-#: lily-guile.cc:440
+#: lily-guile.cc:434
msgid "perhaps a typing error?"
msgstr ""
-#: lily-guile.cc:447
+#: lily-guile.cc:441
msgid "doing assignment anyway"
msgstr ""
-#: lily-guile.cc:459
+#: lily-guile.cc:453
#, c-format
msgid "type check for `%s' failed; value `%s' must be of type `%s'"
msgstr ""
-#: main.cc:109
+#: main.cc:107
#, c-format
msgid ""
"This program is free software. It is covered by the GNU General Public\n"
"information.\n"
msgstr ""
-#: main.cc:115
+#: main.cc:113
msgid ""
" This program is free software; you can redistribute it and/or\n"
-"modify it under the terms of the GNU General Public License version 2\n"
-"as published by the Free Software Foundation.\n"
+"modify it under the terms of the GNU General Public License as \n"
+"published by the Free Software Foundation, either version 3 of\n"
+"the License, or (at your option) any later version.\n"
"\n"
" This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"Boston, MA 02111-1307, USA.\n"
msgstr ""
-#: main.cc:146
+#: main.cc:147
msgid "SYM[=VAL]"
msgstr ""
-#: main.cc:147
+#: main.cc:148
msgid ""
"set Scheme option SYM to VAL (default: #t).\n"
"Use -dhelp for help."
msgstr ""
-#: main.cc:150
+#: main.cc:152
msgid "EXPR"
msgstr ""
-#: main.cc:150
+#: main.cc:152
msgid "evaluate scheme code"
msgstr ""
#. Bug in option parser: --output =foe is taken as an abbreviation
#. for --output-format.
-#: main.cc:153
+#: main.cc:155
msgid "FORMATs"
msgstr ""
-#: main.cc:153
+#: main.cc:155
msgid "dump FORMAT,... Also as separate options:"
msgstr ""
-#: main.cc:154
+#: main.cc:156
msgid "generate PDF (default)"
msgstr ""
-#: main.cc:155
+#: main.cc:157
msgid "generate PNG"
msgstr ""
-#: main.cc:156
+#: main.cc:158
msgid "generate PostScript"
msgstr ""
-#: main.cc:158
+#: main.cc:161
msgid "FIELD"
msgstr ""
-#: main.cc:158
+#: main.cc:161
msgid ""
"dump header field FIELD to file\n"
"named BASENAME.FIELD"
msgstr ""
-#: main.cc:160
+#: main.cc:164
msgid "add DIR to search path"
msgstr ""
-#: main.cc:161
+#: main.cc:165
msgid "use FILE as init file"
msgstr ""
-#: main.cc:163
+#: main.cc:168
msgid "USER, GROUP, JAIL, DIR"
msgstr ""
-#: main.cc:163
+#: main.cc:168
msgid ""
"chroot to JAIL, become USER:GROUP\n"
"and cd into DIR"
msgstr ""
-#: main.cc:166
+#: main.cc:172
msgid "write output to FILE (suffix will be added)"
msgstr ""
-#: main.cc:167
+#: main.cc:173
msgid "relocate using directory of lilypond program"
msgstr ""
#. Do not update the copyright years here, run `make grand-replace'
-#: main.cc:238
+#: main.cc:242
#, c-format
msgid ""
"Copyright (c) %s by\n"
msgstr ""
#. No version number or newline here. It confuses help2man.
-#: main.cc:265
+#: main.cc:269
#, c-format
msgid "Usage: %s [OPTION]... FILE..."
msgstr ""
-#: main.cc:267
+#: main.cc:271
msgid "Typeset music and/or produce MIDI from FILE."
msgstr ""
-#: main.cc:269
+#: main.cc:273
msgid "LilyPond produces beautiful music notation."
msgstr ""
-#: main.cc:271
+#: main.cc:275
#, c-format
msgid "For more information, see %s"
msgstr ""
-#: main.cc:273
+#: main.cc:277
msgid "Options:"
msgstr ""
-#: main.cc:327
+#: main.cc:331
#, c-format
msgid "expected %d arguments with jail, found: %u"
msgstr ""
-#: main.cc:341
+#: main.cc:345
#, c-format
msgid "no such user: %s"
msgstr ""
-#: main.cc:343
+#: main.cc:347
#, c-format
msgid "cannot get user id from user name: %s: %s"
msgstr ""
-#: main.cc:358
+#: main.cc:362
#, c-format
msgid "no such group: %s"
msgstr ""
-#: main.cc:360
+#: main.cc:364
#, c-format
msgid "cannot get group id from group name: %s: %s"
msgstr ""
-#: main.cc:368
+#: main.cc:372
#, c-format
msgid "cannot chroot to: %s: %s"
msgstr ""
-#: main.cc:375
+#: main.cc:379
#, c-format
msgid "cannot change group id to: %d: %s"
msgstr ""
-#: main.cc:381
+#: main.cc:385
#, c-format
msgid "cannot change user id to: %d: %s"
msgstr ""
-#: main.cc:387
+#: main.cc:391
#, c-format
msgid "cannot change working directory to: %s: %s"
msgstr ""
-#: main.cc:628
+#: main.cc:631
#, c-format
msgid "exception caught: %s"
msgstr ""
-#: key-signature-interface.cc:78
+#: key-signature-interface.cc:77
#, c-format
msgid "No glyph found for alteration: %s"
msgstr ""
-#: key-signature-interface.cc:88
+#: key-signature-interface.cc:87
msgid "alteration not found"
msgstr ""
msgid "dot `%s' not found"
msgstr ""
-#: translator.cc:359
+#: translator.cc:356
#, c-format
msgid "Two simultaneous %s events, junking this one"
msgstr ""
-#: translator.cc:360
+#: translator.cc:357
#, c-format
msgid "Previous %s event here"
msgstr ""
-#: glissando-engraver.cc:105
+#: glissando-engraver.cc:156
msgid "unterminated glissando"
msgstr ""
-#: text-spanner-engraver.cc:73
+#: text-spanner-engraver.cc:72
msgid "cannot find start of text spanner"
msgstr ""
-#: text-spanner-engraver.cc:86
+#: text-spanner-engraver.cc:85
msgid "already have a text spanner"
msgstr ""
-#: text-spanner-engraver.cc:132
+#: text-spanner-engraver.cc:130
msgid "unterminated text spanner"
msgstr ""
msgid "strange time signature found: %d/%d"
msgstr ""
-#: lily-parser-scheme.cc:82
+#: lily-parser-scheme.cc:83
#, c-format
msgid "Changing working directory to: `%s'"
msgstr ""
-#: lily-parser-scheme.cc:99
+#: lily-parser-scheme.cc:100
#, c-format
msgid "cannot find init file: `%s'"
msgstr ""
msgid "Processing `%s'"
msgstr ""
-#: lily-parser-scheme.cc:204
+#: lily-parser-scheme.cc:203
msgid ""
"ly:parser-parse-string is only valid with a new parser. Use ly:parser-"
"include-string instead."
msgid "custos `%s' not found"
msgstr ""
-#: program-option-scheme.cc:237
+#: program-option-scheme.cc:232
#, c-format
msgid "no such internal option: %s"
msgstr ""
msgid "cannot resolve rest collision: rest direction not set"
msgstr ""
-#: rest-collision.cc:160 rest-collision.cc:205
+#: rest-collision.cc:160 rest-collision.cc:275
msgid "too many colliding rests"
msgstr ""
+#: pdf-scheme.cc:50
+#, c-format
+msgid "Conversion of string `%s' to UTF-16be failed: %s"
+msgstr ""
+
#: episema-engraver.cc:75
msgid "already have an episema"
msgstr ""
msgid "%d: %s"
msgstr ""
-#: grob-property.cc:173
+#: grob-property.cc:169
#, c-format
msgid "cyclic dependency: calculation-in-progress encountered for #'%s (%s)"
msgstr ""
-#: relocate.cc:54
+#: relocate.cc:53
#, c-format
msgid "Setting %s to %s"
msgstr ""
-#: relocate.cc:74
+#: relocate.cc:73
#, c-format
msgid "no such file: %s for %s"
msgstr ""
-#: relocate.cc:84 relocate.cc:102
+#: relocate.cc:83 relocate.cc:101
#, c-format
msgid "no such directory: %s for %s"
msgstr ""
-#: relocate.cc:94
+#: relocate.cc:93
#, c-format
msgid "%s=%s (prepend)\n"
msgstr ""
-#: relocate.cc:124
+#: relocate.cc:123
#, c-format
msgid "not relocating, no %s/ or current/ found under %s"
msgstr ""
-#: relocate.cc:135
+#: relocate.cc:134
#, c-format
msgid "Relocation: compile datadir=%s, new datadir=%s"
msgstr ""
-#: relocate.cc:148
+#: relocate.cc:147
#, c-format
msgid "Relocation: framework_prefix=%s"
msgstr ""
-#: relocate.cc:189
+#: relocate.cc:188
#, c-format
msgid "Relocation: is absolute: argv0=%s"
msgstr ""
-#: relocate.cc:196
+#: relocate.cc:195
#, c-format
msgid "Relocation: from cwd: argv0=%s"
msgstr ""
-#: relocate.cc:213
+#: relocate.cc:212
#, c-format
msgid ""
"Relocation: from PATH=%s\n"
"argv0=%s"
msgstr ""
-#: relocate.cc:240
+#: relocate.cc:239
msgid "LILYPONDPREFIX is obsolete, use LILYPOND_DATADIR"
msgstr ""
-#: relocate.cc:367
+#: relocate.cc:365
#, c-format
msgid "Relocation file: %s"
msgstr ""
-#: relocate.cc:373 source-file.cc:65
+#: relocate.cc:371 source-file.cc:65
#, c-format
msgid "cannot open file: `%s'"
msgstr ""
-#: relocate.cc:403
+#: relocate.cc:401
#, c-format
msgid "Unknown relocation command %s"
msgstr ""
+#: gregorian-ligature-engraver.cc:70
+#, c-format
+msgid "\\%s ignored"
+msgstr ""
+
+#: gregorian-ligature-engraver.cc:75
+#, c-format
+msgid "implied \\%s added"
+msgstr ""
+
+#. ligature may not start with 2nd head of pes or flexa
+#: gregorian-ligature-engraver.cc:224
+msgid "cannot apply `\\~' on first head of ligature"
+msgstr ""
+
+#. (pitch == prev_pitch)
+#: gregorian-ligature-engraver.cc:236
+msgid "cannot apply `\\~' on heads with identical pitch"
+msgstr ""
+
#: translator-group.cc:188
#, c-format
msgid "cannot find: `%s'"
msgid "unterminated phrasing slur"
msgstr ""
-#: lyric-engraver.cc:176
+#: phrasing-slur-engraver.cc:182
+msgid "cannot end phrasing slur"
+msgstr ""
+
+#: phrasing-slur-engraver.cc:196
+msgid "already have phrasing slur"
+msgstr ""
+
+#: lyric-engraver.cc:186
msgid "Lyric syllable does not have note. Use \\lyricsto or associatedVoice."
msgstr ""
-#: page-breaking.cc:248
+#: page-breaking.cc:274
msgid ""
"ignoring min-systems-per-page and max-systems-per-page because systems-per-"
"page was set"
msgstr ""
-#: page-breaking.cc:253
+#: page-breaking.cc:279
msgid ""
"min-systems-per-page is larger than max-systems-per-page, ignoring both "
"values"
msgstr ""
-#: performance.cc:54
+#: performance.cc:55
msgid "Track..."
msgstr ""
-#: performance.cc:83
-msgid "MIDI channel wrapped around"
-msgstr ""
-
-#: performance.cc:84
-msgid "remapping modulo 16"
-msgstr ""
-
-#: performance.cc:111
+#: performance.cc:85
#, c-format
msgid "MIDI output to `%s'..."
msgstr ""
msgid "No tuplet to end"
msgstr ""
-#: gregorian-ligature-engraver.cc:70
-#, c-format
-msgid "\\%s ignored"
-msgstr ""
-
-#: gregorian-ligature-engraver.cc:75
-#, c-format
-msgid "implied \\%s added"
-msgstr ""
-
-#. ligature may not start with 2nd head of pes or flexa
-#: gregorian-ligature-engraver.cc:224
-msgid "cannot apply `\\~' on first head of ligature"
-msgstr ""
-
-#. (pitch == prev_pitch)
-#: gregorian-ligature-engraver.cc:236
-msgid "cannot apply `\\~' on heads with identical pitch"
-msgstr ""
-
#: chord-tremolo-engraver.cc:88
msgid "No tremolo to end"
msgstr ""
msgid "expected to read %d characters, got %d"
msgstr ""
-#: axis-group-interface.cc:631
+#: axis-group-interface.cc:627
msgid "an outside-staff object should have a direction, defaulting to up"
msgstr ""
-#: coherent-ligature-engraver.cc:111
+#: coherent-ligature-engraver.cc:110
#, c-format
msgid "Coherent_ligature_engraver: setting `spacing-increment=0.01': ptr=%ul"
msgstr ""
-#: percent-repeat-engraver.cc:148
+#: percent-repeat-engraver.cc:147
msgid "unterminated percent repeat"
msgstr ""
-#: note-head.cc:76
+#: note-head.cc:75
#, c-format
msgid "none of note heads `%s' or `%s' found"
msgstr ""
msgid " scheme encoding: "
msgstr ""
-#: all-font-metrics.cc:156
+#: all-font-metrics.cc:153
#, c-format
msgid "cannot find font: `%s'"
msgstr ""
-#: property-iterator.cc:85
+#: property-iterator.cc:93
#, c-format
msgid "not a grob name, `%s'"
msgstr ""
msgid "barcheck failed at: %s"
msgstr ""
-#: stem.cc:116
+#: stem.cc:114
msgid "weird stem size, check for narrow beams"
msgstr ""
-#: stem.cc:657
+#: stem.cc:652
#, c-format
msgid "flag `%s' not found"
msgstr ""
-#: stem.cc:673
+#: stem.cc:668
#, c-format
msgid "flag stroke `%s' not found"
msgstr ""
msgid "\tprevious break: %d"
msgstr ""
-#: lily-parser.cc:106
+#: lily-parser.cc:105
msgid "Parsing..."
msgstr ""
-#: lily-parser.cc:134
+#: lily-parser.cc:133
msgid "braces do not match"
msgstr ""
-#: score.cc:178
+#: score.cc:176
msgid "already have music in score"
msgstr ""
-#: score.cc:179
+#: score.cc:177
msgid "this is the previous music"
msgstr ""
-#: score.cc:184
+#: score.cc:182
msgid "errors found, ignoring music expression"
msgstr ""
msgid "FreeType error: %s"
msgstr ""
-#: open-type-font.cc:111
+#: open-type-font.cc:110
#, c-format
msgid "unsupported font format: %s"
msgstr ""
-#: open-type-font.cc:113
+#: open-type-font.cc:112
#, c-format
msgid "error reading font file %s: %s"
msgstr ""
-#: open-type-font.cc:188
+#: open-type-font.cc:187
#, c-format
msgid "FT_Get_Glyph_Name () Freetype error: %s"
msgstr ""
msgid "cannot write to file: `%s'"
msgstr ""
-#: parser.yy:820
+#: parser.yy:825
msgid "\\paper cannot be used in \\score, use \\layout instead"
msgstr ""
-#: parser.yy:844
+#: parser.yy:849
msgid "need \\paper for paper block"
msgstr ""
-#: parser.yy:1363
+#: parser.yy:1369
msgid "only \\consists takes non-string argument."
msgstr ""
-#: parser.yy:1376
+#: parser.yy:1382
msgid "Grob name should be alphanumeric"
msgstr ""
-#: parser.yy:1685
+#: parser.yy:1697
msgid "second argument must be pitch list"
msgstr ""
-#: parser.yy:1716 parser.yy:1721 parser.yy:2194
+#: parser.yy:1728 parser.yy:1733 parser.yy:2206
msgid "have to be in Lyric mode for lyrics"
msgstr ""
-#: parser.yy:1818
+#: parser.yy:1830
msgid "expecting string as script definition"
msgstr ""
-#: parser.yy:1973 parser.yy:2024
+#: parser.yy:1985 parser.yy:2036
#, c-format
msgid "not a duration: %d"
msgstr ""
-#: parser.yy:2148
+#: parser.yy:2160
msgid "have to be in Note mode for notes"
msgstr ""
-#: parser.yy:2209
+#: parser.yy:2221
msgid "have to be in Chord mode for chords"
msgstr ""
-#: lexer.ll:190
+#: lexer.ll:192
msgid "stray UTF-8 BOM encountered"
msgstr ""
-#: lexer.ll:194
+#: lexer.ll:196
msgid "Skipping UTF-8 BOM"
msgstr ""
-#: lexer.ll:249
+#: lexer.ll:251
#, c-format
msgid "Renaming input to: `%s'"
msgstr ""
-#: lexer.ll:266
+#: lexer.ll:268
msgid "quoted string expected after \\version"
msgstr ""
-#: lexer.ll:270
+#: lexer.ll:272
msgid "quoted string expected after \\sourcefilename"
msgstr ""
-#: lexer.ll:274
+#: lexer.ll:276
msgid "integer expected after \\sourcefileline"
msgstr ""
-#: lexer.ll:287
+#: lexer.ll:289
msgid "EOF found inside a comment"
msgstr ""
-#: lexer.ll:302
+#: lexer.ll:304
msgid "\\maininput not allowed outside init files"
msgstr ""
-#: lexer.ll:326
+#: lexer.ll:328
#, c-format
msgid "wrong or undefined identifier: `%s'"
msgstr ""
#. backup rule
-#: lexer.ll:335
+#: lexer.ll:337
msgid "end quote missing"
msgstr ""
-#: lexer.ll:485
+#: lexer.ll:487
msgid "Brace found at end of lyric. Did you forget a space?"
msgstr ""
-#: lexer.ll:595
+#: lexer.ll:597
msgid "Brace found at end of markup. Did you forget a space?"
msgstr ""
-#: lexer.ll:699
+#: lexer.ll:701
#, c-format
msgid "invalid character: `%c'"
msgstr ""
-#: lexer.ll:814 lexer.ll:815
+#: lexer.ll:822 lexer.ll:823
#, c-format
msgid "unknown escaped string: `\\%s'"
msgstr ""
-#: lexer.ll:924 lexer.ll:925
+#: lexer.ll:932 lexer.ll:933
#, c-format
msgid "file too old: %s (oldest supported: %s)"
msgstr ""
-#: lexer.ll:925 lexer.ll:926
+#: lexer.ll:933 lexer.ll:934
msgid "consider updating the input with the convert-ly script"
msgstr ""
-#: lexer.ll:931 lexer.ll:932
+#: lexer.ll:939 lexer.ll:940
#, c-format
msgid "program too old: %s (file requires: %s)"
msgstr ""
msgid "Writing ~S..."
msgstr ""
-#: documentation-lib.scm:198
+#: documentation-lib.scm:184
+#, scheme-format
+msgid "cannot find description for property `~S' (~S)"
+msgstr ""
+
+#: documentation-lib.scm:205
#, scheme-format
msgid "cannot find description for property ~S (~S)"
msgstr ""
msgid "symbol ~S redefined"
msgstr ""
-#: paper.scm:115
+#: paper.scm:117
msgid "set-global-staff-size: not in toplevel scope"
msgstr ""
-#: paper.scm:296
+#: paper.scm:301
#, scheme-format
msgid "This is not a \\layout {} object, ~S"
msgstr ""
-#: paper.scm:308
+#: paper.scm:313
#, scheme-format
msgid "Unknown paper size: ~a"
msgstr ""
#. TODO: should raise (generic) exception with throw, and catch
#. that in parse-scm.cc
-#: paper.scm:323
+#: paper.scm:328
msgid "Must use #(set-paper-size .. ) within \\paper { ... }"
msgstr ""
msgid "wrong type for argument ~a. Expecting ~a, found ~s"
msgstr ""
-#: lily.scm:716
+#: lily.scm:710
msgid "Compilation successfully completed"
msgstr ""
-#: lily.scm:717
+#: lily.scm:711
msgid "Compilation completed with warnings or errors"
msgstr ""
-#: lily.scm:779
+#: lily.scm:773
#, scheme-format
msgid "job ~a terminated with signal: ~a"
msgstr ""
-#: lily.scm:782
+#: lily.scm:776
#, scheme-format
msgid ""
"logfile ~a (exit ~a):\n"
"~a"
msgstr ""
-#: lily.scm:804 lily.scm:882
+#: lily.scm:798 lily.scm:876
#, scheme-format
msgid "failed files: ~S"
msgstr ""
-#: lily.scm:873
+#: lily.scm:867
#, scheme-format
msgid "Redirecting output to ~a..."
msgstr ""
-#: lily.scm:892
+#: lily.scm:886
#, scheme-format
msgid "Invoking `~a'...\n"
msgstr ""
msgid "Found infinity or nan in output. Substituting 0.0"
msgstr ""
-#: output-ps.scm:289 output-svg.scm:550
+#: output-ps.scm:299 output-svg.scm:550
#, scheme-format
msgid "unknown line-cap-style: ~S"
msgstr ""
-#: output-ps.scm:294 output-svg.scm:556
+#: output-ps.scm:304 output-svg.scm:556
#, scheme-format
msgid "unknown line-join-style: ~S"
msgstr ""
msgid "Could not find language `~a'. Ignoring."
msgstr ""
-#: define-music-types.scm:740
+#: define-music-types.scm:747
#, scheme-format
msgid "symbol expected: ~S"
msgstr ""
-#: define-music-types.scm:743
+#: define-music-types.scm:750
#, scheme-format
msgid "cannot find music object: ~S"
msgstr ""
-#: define-music-types.scm:762
+#: define-music-types.scm:769
#, scheme-format
msgid "unknown repeat type `~S'"
msgstr ""
-#: define-music-types.scm:763
+#: define-music-types.scm:770
msgid "See define-music-types.scm for supported repeats"
msgstr ""
-#: translation-functions.scm:341
+#: translation-functions.scm:350
#, scheme-format
msgid "Negative fret for pitch ~a on string ~a"
msgstr ""
-#: translation-functions.scm:385
+#: translation-functions.scm:401
#, scheme-format
msgid "No open string for pitch ~a"
msgstr ""
-#: translation-functions.scm:400
+#: translation-functions.scm:416 translation-functions.scm:428
#, scheme-format
msgid "Requested string for pitch requires negative fret: string ~a pitch ~a"
msgstr ""
-#: translation-functions.scm:401
-msgid "Ignoring string request."
+#: translation-functions.scm:419
+msgid "Ignoring string request and recalculating."
+msgstr ""
+
+#: translation-functions.scm:431
+msgid "Ignoring note in tablature."
msgstr ""
-#: translation-functions.scm:414
+#: translation-functions.scm:454
#, scheme-format
msgid "No string for pitch ~a (given frets ~a)"
msgstr ""
-#: translation-functions.scm:515
+#: translation-functions.scm:559
#, scheme-format
msgid ""
"No label for fret ~a (on string ~a);\n"
msgid "do not know how to embed font ~s ~s ~s"
msgstr ""
-#: framework-ps.scm:669
+#: framework-ps.scm:686
msgid ""
"\n"
"The PostScript backend does not support the\n"
msgid "invalid tremolo repeat count: ~a"
msgstr ""
-#: music-functions.scm:618
+#: music-functions.scm:619
#, scheme-format
msgid "music expected: ~S"
msgstr ""
msgid "Bar check failed. Expect to be at ~a, instead at ~a"
msgstr ""
-#: music-functions.scm:846
+#: music-functions.scm:845
#, scheme-format
msgid "cannot find quoted music: `~S'"
msgstr ""
-#: music-functions.scm:982
+#: music-functions.scm:979
msgid "Add @var{octave-shift} to the octave of @var{pitch}."
msgstr ""
-#: music-functions.scm:1037
+#: music-functions.scm:1039
#, scheme-format
msgid "Unknown octaveness type: ~S "
msgstr ""
-#: music-functions.scm:1038
+#: music-functions.scm:1040
msgid "Defaulting to 'any-octave."
msgstr ""
msgid "~a exited with status: ~S"
msgstr ""
-#: define-markup-commands.scm:803
+#: define-markup-commands.scm:883
msgid "no systems found in \\score markup, does it have a \\layout block?"
msgstr ""
-#: define-markup-commands.scm:2404
+#: define-markup-commands.scm:2561
#, scheme-format
msgid "Cannot find glyph ~a"
msgstr ""
-#: define-markup-commands.scm:2830
+#: define-markup-commands.scm:2987
#, scheme-format
msgid "no brace found for point size ~S "
msgstr ""
-#: define-markup-commands.scm:2831
+#: define-markup-commands.scm:2988
#, scheme-format
msgid "defaulting to ~S pt"
msgstr ""
-#: define-markup-commands.scm:2984
+#: define-markup-commands.scm:3141
#, scheme-format
msgid "not a valid duration string: ~a"
msgstr ""
return 'href="' + os.path.join (source_val, m.group (1)) + '"'
# More hardcoding, yay!
-splitted_docs_re = re.compile('(Documentation/out-www/(automated-engraving|essay|notation|changes|extending|music-glossary|usage|web|learning|snippets))/')
+split_docs_re = re.compile('(Documentation/out-www/(automated-engraving|essay|notation|changes|extending|music-glossary|usage|web|learning|snippets|contributor))/')
lily_snippets_re = re.compile ('(href|src)="([0-9a-f]{2}/lily-.*?)"')
pictures_re = re.compile ('src="(pictures/.*?)"')
manuals_page_link_re = re.compile (r'href="((?:\.\./)+)Documentation/web/manuals')
## Windows does not support symlinks.
-# This function avoids creating symlinks for splitted HTML manuals
+# This function avoids creating symlinks for split HTML manuals
# Get rid of symlinks in GNUmakefile.in (local-WWW-post)
# this also fixes missing PNGs only present in translated docs
def hack_urls (s, prefix, target, is_development_branch):
- if splitted_docs_re.match (prefix):
+ if split_docs_re.match (prefix):
s = lily_snippets_re.sub ('\\1="../\\2"', s)
s = pictures_re.sub ('src="../\\1"', s)
stderr_write (UPDATE_MANUALLY)
return str
-@rule ((2, 15, 8),
+@rule ((2, 15, 7),
_ ("Handling of non-automatic footnotes."))
def conv(str):
if re.search (r'\\footnote', str):
--- /dev/null
+;;;; This file is part of LilyPond, the GNU music typesetter.
+;;;;
+;;;; Copyright (C) 2011 Neil Puttock <n.puttock@gmail.com>
+;;;;
+;;;; LilyPond is free software: you can redistribute it and/or modify
+;;;; it under the terms of the GNU General Public License as published by
+;;;; the Free Software Foundation, either version 3 of the License, or
+;;;; (at your option) any later version.
+;;;;
+;;;; LilyPond is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU General Public License
+;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+
+(use-modules (ice-9 format))
+
+(define (grob-property-path path)
+ (string-join (map symbol->string path) " "))
+
+(define (document-mod-list op)
+ (let ((tag (car op))
+ (name-sym (cadr op))
+ (args (cddr op)))
+ (case tag
+ ((push)
+ (let ((value (car args))
+ (path (cdr args)))
+ (string-append
+ "@item Sets "
+ (format "grob property @code{~a} "
+ (grob-property-path path))
+ (format "in @code{@rinternals{~a}} to ~a."
+ name-sym
+ (scm->texi value))
+ "\n")))
+ ((pop)
+ (string-append
+ "@item Reverts "
+ (format "grob property @code{~a} "
+ (grob-property-path (car args)))
+ (format "in @code{@rinternals{~a}}."
+ name-sym)
+ "\n"))
+ ((assign)
+ (format "@item Sets translator property @code{~a} to ~a.\n"
+ name-sym
+ (scm->texi (car args))))
+ ((unset)
+ (format "@item Unsets translator property @code{~a}.\n"
+ name-sym))
+ ((consists)
+ (format "@item Adds @code{@rinternals{~a}}.\n" name-sym))
+ ((remove)
+ (format "@item Removes @code{@rinternals{~a}}.\n" name-sym))
+ (else ""))))
+
+(define (document-context-mod context-mod-pair)
+ (let* ((name-sym (car context-mod-pair))
+ (mod-list (ly:get-context-mods (cdr context-mod-pair)))
+ (docstring (filter (lambda (mod)
+ (eq? (car mod) 'description))
+ mod-list)))
+ (format
+ "@item @code{~a}
+@findex ~a
+~a
+@itemize
+~{~a ~}
+@end itemize
+"
+ name-sym
+ name-sym
+ (if (pair? docstring) (cadar docstring) "(undocumented; fixme)")
+ (map document-mod-list mod-list))))
+
+(define (document-mod obj-pair)
+ (cond
+ ((ly:context-mod? (cdr obj-pair))
+ (document-context-mod obj-pair))
+ (else
+ #f)))
+
+(define context-mods-doc-string
+ (format
+ "@table @asis
+~a
+@end table
+"
+ (string-join
+ (filter
+ identity
+ (map
+ document-mod
+ (sort
+ (ly:module->alist (current-module))
+ identifier<?)))
+ "")))
(else
#f)))
-
-(define (identifier<? a b)
- (ly:string-ci<?
- (symbol->string (car a))
- (symbol->string (car b))))
-
-
(define-public (identifiers-doc-string)
(format #f
"@table @asis
"document-music.scm"
"document-type-predicates.scm"
"document-identifiers.scm"
+ "document-context-mods.scm"
"document-backend.scm"
"document-markup.scm"))
(identifiers-doc-string)
(open-output-file "identifiers.tely"))
+(display
+ context-mods-doc-string
+ (open-output-file "context-mod-identifiers.tely"))
(display
(backend-properties-doc-string all-user-grob-properties)
(define (writing-wip x)
(ly:message (_ "Writing ~S...") x))
+(define (identifier<? a b)
+ (ly:string-ci<?
+ (symbol->string (car a))
+ (symbol->string (car b))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; property stuff.
(reverse matches))
-(define-public (random-string pool n)
- "Produces a random lowercase string of length n"
- (define (helper alphabet out num)
- (let ((rand (random (string-length pool))))
- (if (< num 1)
- out
- (helper alphabet
- (string-concatenate `(,out
- ,(substring alphabet
- rand
- (+ 1 rand))))
- (- num 1)))))
- (helper pool "" n))
-
-(define-public (random-lowercase-string n)
- (random-string "abcdefghijklmnopqrstuvwxyz" n))
-
;;;;;;;;;;;;;;;;
;; other
(let* ((set (and (integer? label)
(context-spec-music (make-property-set 'rehearsalMark label)
'Score)))
- (ev (make-music 'MarkEvent))
- (ch (make-event-chord (list ev))))
+ (ev (make-music 'MarkEvent
+ 'origin location)))
- (set! (ly:music-property ev 'origin) location)
(if set
- (make-sequential-music (list set ch))
+ (make-sequential-music (list set ev))
(begin
(set! (ly:music-property ev 'label) label)
- ch))))
+ ev))))
(define-ly-syntax (partial parser location dur)
"Make a partial measure."
('([\w\(\)\]]) +(&&|\|\||<=|>=|!=|\|=|==|\+=|-=|\*=|/=|\?|<|>|\+|-|=|/|:|&|\||\*) +([\w\(\)])', '\\1 \\2 \\3'),
# trailing operator, but don't un-trail close angle-braces > nor pointer *, and not before a preprocessor line
- (' (::|&&|\|\||<=|>=|!=|\|=|==|\+=|-=|\*=|/=|\?|<|\+|-|=|/|:|&XXX|\||\*XXX) *\n( *)([^\s#])', '\n\\2\\1 \\3'),
+ ('(?<!\s) (::|&&|\|\||<=|>=|!=|\|=|==|\+=|-=|\*=|/=|\?|<|\+|-|=|/|:|&XXX|\||\*XXX) *\n( *)([^\s#])', '\n\\2\\1 \\3'),
# space after `operator'
('(\Woperator) *([^\w\s])', '\\1 \\2'),
# trailing parenthesis open
'string':
r'''(?x)
+ " # leave the leading " character visible to CXX rules
(?P<match>
(?P<code>
- "([^"\n]|\\")*"))''',
+ ([^"\n]|\\")*"))''',
'char':
r'''(?x)
Files to be excluded (not available in git):
@exclude colorado.itexi
@exclude computer-notation.itexi
+@exclude context-mod-identifiers.tely
@exclude context-properties.tely
@exclude engravingbib.itexi
@exclude identifiers.tely
-#!@PERL@
+#! /usr/bin/perl
##################################################
# Convert stylized Metafont to PostScript Type 1 #
########################################################################
# mf2pt1 #
-# Copyright (C) 2008 Scott Pakin #
+# Copyright (C) 2011 Scott Pakin #
# #
# This program may be distributed and/or modified under the conditions #
# of the LaTeX Project Public License, either version 1.3c of this #
# version 2006/05/20 or later. #
########################################################################
-our $VERSION = "2.4.4"; # mf2pt1 version number
+our $VERSION = "2.4.5"; # mf2pt1 version number
require 5.6.1; # I haven't tested mf2pt1 with older Perl versions
use File::Basename;
my $filenoext;
my $versionmsg = "mf2pt1 version $VERSION
-Copyright (C) 2008 Scott Pakin
+Copyright (C) 2011 Scott Pakin
This program may be distributed and/or modified under the conditions
of the LaTeX Project Public License, either version 1.3c of this
{
print OUTFILE <<"ENDTRAILER";
/.notdef {
- 0 @{[$fontbbox[2]-$fontbbox[0]]} hsbw
+ 0 @{[frac_string (frac_approx ($fontbbox[2] - $fontbbox[0]))]} hsbw
endchar
} ND
end
chords.itely
colorado.itexi
computer-notation.itexi
+context-mod-identifiers.tely
context-properties.tely
contexts-and-engravers.itely
editorial-annotations.itely
&& mv $$TMP/*pfb $(outdir); \
rm -rf $$TMP
+# since recent mpost versions no longer create a mem file, we create a dummy
+# file to satisfy the dependency (which gets overwritten in case an older
+# mpost creates a real mem file)
$(outdir)/mf2pt1.mem: mf2pt1.mp
- cd $(outdir) && mpost -progname=mpost -ini $(top-src-dir)/mf/mf2pt1.mp \\dump
+ cd $(outdir) \
+ && touch mf2pt1.mem \
+ && mpost -progname=mpost -ini $(top-src-dir)/mf/mf2pt1.mp \\dump