diff options
91 files changed, 962 insertions, 545 deletions
@@ -1,6 +1,6 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 0 -TOPLEVEL_PATCH_LEVEL = 49 +TOPLEVEL_PATCH_LEVEL = 50 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf @@ -1,22 +1,22 @@ Announcing - - LILYPOND + + GNU LilyPond The Music Typesetter Do you pine for the nice days of Linux 0.95, when men were men and wrote their own applications? Are you without a nice project and just dying to cut your teeth into a bleeding edge application you can -modify for your needs. Do you find it frustrating that everything +modify for your needs? Do you find it frustrating that everything works in LaTeX? No more all-nighters to get a nifty program working? Then this post might be just for you! I have been working very hard on a music typesetting system (called -LilyPond) the past half year, and I finally think it is ready to be +GNU LilyPond) the past half year, and I finally think it is ready to be used and hacked at by a larger public than me and my co-developer. -Sources for this project are on +Sources for this project are on: ftp://pcnov095.win.tue.nl/pub/lilypond/ @@ -29,7 +29,7 @@ detailed info and examples can be found on the webpage at: [DETAILED DESCRIPTION] -WHAT IS LILYPOND +WHAT IS GNU LilyPond Technically it is a preprocessor which generates TeX (or LaTeX) output which contains information to typeset a musical diff --git a/Documentation/Makefile b/Documentation/Makefile index dc87ae02d9..dd61be8065 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -48,6 +48,7 @@ include ./$(depth)/make/Rules.make # localclean: + rm -f out/* rm -f $(TEXTFILES) $(HTMLFILES) $(GROFFFILES) $(HTMLFILES) localinstall: $(outdir)/lilypond.1 $(outdir)/mudela.5 diff --git a/Documentation/lilypond.pod b/Documentation/lilypond.pod index da1d68bf3f..3482fa961c 100644 --- a/Documentation/lilypond.pod +++ b/Documentation/lilypond.pod @@ -1,6 +1,6 @@ =head1 NAME -LilyPond - a music typesetter +lilypond - the GNU music typesetter =head1 SYNOPSIS @@ -8,7 +8,7 @@ LilyPond - a music typesetter =head1 DESCRIPTION -Technically LilyPond is a preprocessor which generates TeX +Technically GNU LilyPond is a preprocessor which generates TeX (or LaTeX) output which contains information to typeset a musical score. Practically it is a typesetter, which only uses TeX as an output medium. (this is handy because there exist music fonts for TeX) @@ -17,7 +17,7 @@ As a bonus, you can also output a MIDI file of what you typed. It translates script files (mudela files or F<*.ly>'s) into TeX input. Typesetting music is a complex task, whereas the message that printed -music conveys is usually a simple one. LilyPond is a try at providing +music conveys is usually a simple one. GNU LilyPond is a try at providing a simple interface for setting music. @@ -36,13 +36,13 @@ do midi output only =item B<-d,--debug>, -Turn debugging info. LilyPond will read the file F<.dstreamrc>, which +Turn debugging info. GNU LilyPond will read the file F<.dstreamrc>, which tells for what functions and classes may produce copious debugging output. =item B<-w,--warranty>, -Show the warranty with which LilyPond comes. (It comes with B<NO WARRANTY>!) +Show the warranty with which GNU LilyPond comes. (It comes with B<NO WARRANTY>!) =item B<-o,--output=>F<FILE>, @@ -110,7 +110,7 @@ clef changes, meter changes, cadenza-mode, key changes, repeat bars =head1 DESIGN CONSIDERATIONS -LilyPond was written with some considerations in mind: +GNU LilyPond was written with some considerations in mind: =over 5 @@ -118,7 +118,7 @@ LilyPond was written with some considerations in mind: Describing a well-defined language for defining music. We call this language (rather arrogantly) The Musical Definition Language -(mudela for short). LilyPond reads a mudela sourcefile and outputs a +(mudela for short). GNU LilyPond reads a mudela sourcefile and outputs a TeX file. =item * @@ -131,8 +131,8 @@ pitch. =item * -LilyPond uses MusiXTeX fonts and TeX for its output. This is not a key -issue: in a future version, LilyPond might bypass TeX, but at the moment +GNU LilyPond uses MusiXTeX fonts and TeX for its output. This is not a key +issue: in a future version, GNU LilyPond might bypass TeX, but at the moment TeX is very convenient for producing output. =item * @@ -143,23 +143,23 @@ setting is not possible without a knowledgeable printer," untrue. =item * -LilyPond does not display notes directly, nor will it be rehacked to be -used interactively. LilyPond writes output to a file. It will not be +GNU LilyPond does not display notes directly, nor will it be rehacked to be +used interactively. GNU LilyPond writes output to a file. It will not be extended to play music, or to recognize music. =item * -LilyPond is intended to run on Unix platforms, but it should +GNU LilyPond is intended to run on Unix platforms, but it should be portable to any platform which can run TeX and the GNU tools =item * -LilyPond is free. Commercial windows packages for setting music are +GNU LilyPond is free. Commercial windows packages for setting music are abundant. Free musicprinting software is scarce. =item * -LilyPond is written in GNU C++. It will not be downgraded/ported to fit +GNU LilyPond is written in GNU C++. It will not be downgraded/ported to fit broken systems. =back @@ -167,10 +167,10 @@ broken systems. =head1 DISCLAIMER & COPYING POLICY -LilyPond is copyright 1996,97 by its authors. LilyPond is +GNU LilyPond is copyright 1996,97 by its authors. GNU LilyPond is distributed under the terms of the GNU General Public -License. LilyPond is provided without any warranty what so ever. -LilyPond may be freely distributed. For further information consult +License. GNU LilyPond is provided without any warranty what so ever. +GNU LilyPond may be freely distributed. For further information consult the GNU General Public License, which is in the file F<COPYING> =head1 AUTHORS @@ -179,13 +179,16 @@ the GNU General Public License, which is in the file F<COPYING> =item * -Han-Wen Nienhuys <hanwen@stack.nl>, Main author +Han-Wen Nienhuys <hanwen@stack.nl>, http://www.stack.nl/~hanwen + +Main author =item * -Jan Nieuwenhuizen <jan@digicash.com>, Context errors, Lyrics, -mi2mu, MIDI stuff, make structure, bits of FlowerLib, general -comments, Mudela design. +Jan Nieuwenhuizen <jan@digicash.com>, http://www.digicash.com/~jan. + +Context errors, Lyrics, mi2mu, MIDI stuff, make structure, bits of +FlowerLib, general comments, Mudela design. =item * @@ -199,7 +202,7 @@ coding C++ =head1 EXAMPLES -At this time, LilyPond output looks nice, but is not of production +At this time, GNU LilyPond output looks nice, but is not of production quality. If you're not discouraged; this is what I type in my xterm: lilypond someinput.ly @@ -208,7 +211,7 @@ quality. If you're not discouraged; this is what I type in my xterm: This is what the output looks like over here: - LilyPond 0.0.40 #0/FlowerLib 1.1.7 #2. Compile: Mar 11 1997, 22:58:47 (g++ 2.7.2) + GNU LilyPond 0.0.40 #0/FlowerLib 1.1.7 #2. Compile: Mar 11 1997, 22:58:47 (g++ 2.7.2) Parsing ... [./init//symbol.ini[./init//dynamic.ini][./init//dutch.ini] [./init//script.ini][./init//table_sixteen.ini]][./input/wohltemperirt.ly] Setting up music ...Processing music ............ @@ -234,7 +237,7 @@ Check out the input files, some of them have comments =head1 PROBLEMS -If LilyPond bombs out, then please recompile using with debugging info +If GNU LilyPond bombs out, then please recompile using with debugging info turned on, and send a copy of the input which causes the error and a gdb stacktrace of the crash. It also helps if you can print the values of the objects. So if your trace is @@ -248,12 +251,12 @@ of the objects. So if your trace is : Than it would help if you send a dump of the Interval and the Item -(use: C<print *this> or use LilyPond C<print()> methods). +(use: C<print *this> or use GNU LilyPond C<print()> methods). -This is a beta version of LilyPond. Please send your helpful comments +This is a beta version of GNU LilyPond. Please send your helpful comments and patches to me (see AUTHORS section) -LilyPond is updated very frequently, the latest version is always available at: +GNU LilyPond is updated very frequently, the latest version is always available at: ftp://pcnov095.win.tue.nl/pub/lilypond. @@ -282,14 +285,14 @@ http://www.stack.nl/~hanwen/lilypond/index.html =head1 REMARKS -LilyPond has no connection with the music package RoseGarden, other +GNU LilyPond has no connection with the music package Rosegarden, other than the names being similar :-) =head1 HISTORY (for a detailed changelog, see F<NEWS>) -LilyPond's roots lie in MPP, a preprocessor to the rather arcane +GNU LilyPond's roots lie in MPP, a preprocessor to the rather arcane MusiXTeX macro package for TeX. A friend of mine, Jan Nieuwenhuizen wrote the first 44 versions (0.01 to 0.44), then his program caught my attention, and I was slowly sucked in to the interesting problem of diff --git a/Documentation/mudela.pod b/Documentation/mudela.pod index 159a4050dc..4ee456d040 100644 --- a/Documentation/mudela.pod +++ b/Documentation/mudela.pod @@ -187,18 +187,18 @@ At the start of parsing, Mudela assumes normal mode. In Normal mode, a word is looked up in the following order: word identifier, string - \word keyword, string + \word keyword, identifier, string In normalmode, a word is assumed to start with an alphabetic character, followed by alpha-numeric characters. =item Note mode -Note mode (and thus Simple mudela) is introduced by the keyword C<\music>. +Note mode (and thus Simple mudela) is introduced by the keyword C<\melodic>. In Note mode, a word is looked up in the following order: - word identifier, string - \word keyword, string + word notename, string + \word keyword, identifier, string In Note mode a word is considered to have alphabetic characters only. @@ -209,7 +209,7 @@ Lyrics mode (and thus Simple mudela) is introduced by the keyword C<\lyrics>. In Lyrics mode, a word is looked up in the following order: word string - \word keyword, string + \word keyword, identifier, string In Lyric mode every sequence of non-digit and non-white characters starting with an alphabetic character is considered a word. @@ -222,8 +222,8 @@ starting with an alphabetic character is considered a word. =back These modes are of a lexical nature. Normal and Note mode largely -resemble each other, save the possibility of entering Reals, and -meaning of C<_> +resemble each other, save the possibility of entering Reals, +meaning of C<_> and the resolution of words =head2 Notes @@ -232,9 +232,8 @@ enter. a'4 % dutch names -is a A-1 pitched quaver. The ' as well as the ' signify an octave change. -A-1 is 440 Hz concert-pitch. C<c'> is also known as the central -c. More examples: +is a A-1 pitched quaver. The ' signifies an octave change. A-1 is 440 +Hz concert-pitch. C<c'> is also known as the central c. More examples: 'a % 110 a % 220 @@ -249,7 +248,10 @@ This is an A flat, (just below 110 Hz concert-pitch). The C<*2/3> signifies that this note is part of a triplet (3 in stead of 2). The duration is one and a half quaver (C<4.>) times 2/3. -The default language for notenames is defined to be dutch, + +Notenames are just a special kind of identifiers, and can be declared +for any language appropriate (see F<dutch.ini>). The default language +for notenames is defined to be dutch, % double sharp cisis disis eisis fisis gisis aisis bisis @@ -305,6 +307,7 @@ Symbols which can be put at either side of a staff are entered as follows: a^- % portato, direction: above note a_. % staccato, direction: below note a^\script { "symbolindex" . . . } % see script.ini for details. + a^\fermata % predefined identifier Dynamics can be put after the notename: @@ -320,14 +323,17 @@ and the following abbreviations: \> % start decrescendo \! % end crescendo/decrescendo -=head2 General +=head2 Text + +To accompany a note with a text (eg, "marcato"), you should say: + + c_"marcato" + c^"marcato" + c-"marcato" -The general form of a note is: +the c- construct chooses the default up/down direction. - post-requests de-octavate notename octavate duration pre-requests -Notenames are just identifiers, and can be declared for any -language appropriate (see F<dutch.ini>). @@ -401,7 +407,7 @@ notes with < and >. Example: You can also put vertical music inside horizontal music: - { c < c e > <c e g> <c e g c'> } % 4 increasing chords + { c <c e> <c e g> <c e g c'> } % 4 increasing chords And vice versa diff --git a/INSTALL.text b/INSTALL.text index 7c2df20b4e..7d6f7d5427 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -3/Apr/97 LilyPond 0.0.48 1 +3/Apr/97 LilyPond 0.0.50 1 @@ -127,7 +127,7 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG -3/Apr/97 LilyPond 0.0.48 2 +3/Apr/97 LilyPond 0.0.50 2 @@ -193,6 +193,6 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS -3/Apr/97 LilyPond 0.0.48 3 +3/Apr/97 LilyPond 0.0.50 3 @@ -1,14 +1,35 @@ -pl 48.hwn1 +pl 50 + - merge rest / notehead. + - Staff_side as a base class for most "staff-side" symbols. + - version check + - Note_column_register, Note_column + - multiple scripts +******** +april 8 +pl 49.jcn1 +Bugfix + - configure[.in], make/Configure_variables.make.in c++ (=doze fix) + - "configure; make" ok for doze, win32 target may be removed now + - win32/gcc 2.7.2 compile fixes -- why does this all compile + (without warnings, why can-t i even trigger warnings) under + linux/gcc-2.7.2.1? it's quite a tedious job fixing this + shit _on doze_ all the time. + * fixed #includes global-regs.cc, staff-info.cc, staff.cc + * key.hh:Key() -> Octave_key() + * added missing lily/include/input.hh: Input( Input const& ) + +pl 49 - lsm template - clef in cadenza mode. - notename clear - \command bla; for \meter, \clef, \octave etc. - +******* pl 48 - notenames init - Duration order -> grouping - broken key s - default octave + ****** april 3 pl 47 @@ -24,11 +24,13 @@ BUGS * help-lines + * help-lines for rests + * [c8. c32 c32] * cis ( | ) cis - * lilypond - -> + * lilypond - -> crash SEVERELY LACKING: @@ -44,6 +46,8 @@ FURTHER FOR ORCHESTRAL SCORE: INPUTLANGUAGE + * relative mode for pitch entering + * configure pitch_byte * special key. @@ -69,7 +73,9 @@ SMALLISH PROJECTS * rpm package buildroot - * indentable stream for TeX stream, lily stream, Dstream. + * indentable stream as baseclass for TeX stream, lily stream, Dstream. + + * caching Item/spanner dimensions. * key transposition @@ -105,7 +111,9 @@ SMALLISH PROJECTS * Decent TeX titledefs (\tempo, \metron, etc. ) * command priority into enum - + + * don't broadcast Staff_sym + * C meter iso 4/4 * textspanner: center position @@ -139,6 +147,10 @@ DOC FUTURE + * Reg_configure_request + + * slurs per voicegroup. + * slur parts as a script * multiple scripst. @@ -179,9 +191,9 @@ IDEAS * move MIDI io to a ANSI C libmidi library. - * itemcolumns: Use dummy items. - * use an embedded language: scheme, lisp, S-lang, Perl, GUILE, ? + - Items/Spanners + - Registers * y -dims in internote? @@ -200,7 +212,7 @@ IDEAS we get different keychanges in different staffs. * Integrating (objectiveC) MusicKit with LilyPond - + * MusixTeX output possible? * PostScript output (esp. Beams, Slurs, etc) @@ -208,3 +220,7 @@ IDEAS * caching breakpoints * use exceptions iso assert? + + * #c <-> cis + + * breath marks diff --git a/bin/Makefile b/bin/Makefile index 7284a0b5ff..bf5b107ce9 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -3,16 +3,11 @@ # subdir level: # depth = .. -# - -include ./$(depth)/make/Include.make -# generic stuff/Makefile -# -# - +include $(depth)/make/Include.make # list of distribution files: -# -SCRIPTS = clearlily cpgento genheader make_patch make_version make_website release + +SCRIPTS = clearlily cpgento genheader make_patch \ + make_version make_website release convert-mudela EXTRA_DISTFILES = $(SCRIPTS) # diff --git a/bin/convert-mudela b/bin/convert-mudela new file mode 100644 index 0000000000..d64a7d75ac --- /dev/null +++ b/bin/convert-mudela @@ -0,0 +1,3 @@ +#!/usr/bin/perl -w + +print "todo\n!"; diff --git a/flower/TODO b/flower/TODO index 3e10b2b3af..b810fabd7a 100644 --- a/flower/TODO +++ b/flower/TODO @@ -1,6 +1,8 @@ * fix/junk ambiguous String constructor overloads, e.g.: String( int ) and String( char ) + * version numbering for shared lib. + * LGPL? * disable this auto conv: const pointer -> bool -> string @@ -13,7 +15,7 @@ * extend Interval - * use template handle in handle.hh for strings. + * use template handle in handle.hh for strings? * move towards gnu or STL? diff --git a/init/register.ini b/init/register.ini index b8447d2dc4..e5822087ba 100644 --- a/init/register.ini +++ b/init/register.ini @@ -14,6 +14,7 @@ melodicregs = \inputregister { \inputregister { Stem_beam_register } \inputregister { Text_register } \inputregister { Script_register } + \inputregister { Note_column_register } \inputregister { Voice_registers \inputregister { Notehead_register } \inputregister { Slur_register } diff --git a/init/script.ini b/init/script.ini index f800923fdc..665d8aa4e6 100644 --- a/init/script.ini +++ b/init/script.ini @@ -3,13 +3,13 @@ % indexstring same_dir_as_stem above_below_staff symbol_can_beinverted } % -accent = \script { "sforzato" -1 0 0 } -marcato = \script { "marcato" -1 0 1 } -staccatissimo = \script { "staccatissimo" -1 0 1 } -portato= \script { "portato" -1 0 1 } -fermata = \script { "fermata" 1 0 1 } -stopped = \script { "stopped" 0 1 0 } -staccato = \script { "staccato" -1 0 0 } -tenuto = \script {"tenuto" -1 0 0 } -upbow = \script { "upbow" 0 1 0 } -downbow = \script { "downbow" 0 1 0 } +accent = \script { "sforzato" 0 -1 0 0 } +marcato = \script { "marcato" 0 -1 0 1 } +staccatissimo = \script { "staccatissimo" 0 -1 0 1 } +portato= \script { "portato" 0 -1 0 1 } +fermata = \script { "fermata" 0 1 0 1 } +stopped = \script { "stopped" 0 0 1 0 } +staccato = \script { "staccato" 1 -1 0 0 } +tenuto = \script {"tenuto" 0 -1 0 0 } +upbow = \script { "upbow" 0 0 1 0 } +downbow = \script { "downbow" 0 0 1 0 } diff --git a/input/error.ly b/input/error.ly index d63164147e..3c7967eef5 100644 --- a/input/error.ly +++ b/input/error.ly @@ -2,7 +2,7 @@ include "this-is-hopefully-a-nonexisting-file" mwa = \melodic{ - \meter{3/4} + \meter 3/4; [ a8 a8 a8 a8 a8 ] % [ a8 ] % % segfault diff --git a/input/kortjakje.ly b/input/kortjakje.ly index 47624c4936..f0aaaf9aa3 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -9,11 +9,11 @@ % % declare melody (which will be in *one* staff ) for the lead voice -melodie = \melodic +melodie = \melodic { % switch Lilypond in note-mode - \clef\violin - \meter{ 2/4 ; - \octave c ; % set the default octave + \clef\violin; + \meter 2/4 ; + \octave c'; % set the default octave % the default note duratino is 4 %%% theme c c | % the '|' checks if there is a new measure here. @@ -33,10 +33,10 @@ melodie = \melodic } % more of this. -begeleiding = \melodic - \clef "bass" - \meter{ 2/4 ; - \octave c ; % default octave: 1 below the first octave. +begeleiding = \melodic{ + \clef "bass"; + \meter 2/4 ; + \octave c'; % default octave: 1 below the first octave. %%% theme 'c % ' before note means one octave lower. diff --git a/input/midi.ly b/input/midi.ly deleted file mode 100644 index 8207361f55..0000000000 --- a/input/midi.ly +++ /dev/null @@ -1,28 +0,0 @@ -% midi.ly -% test source for lilypond-s midi output - -melodie = \melodic{ - \clef\violin - \meter{ 2/4 } - c c | g g | a a | g2 - f f | e e | d d8.( e16 | )c2 | % :| - -} - -begeleiding = \melodic{ - \clef\bass - \meter{ 2/4 } - \octave{'c} - c c' | e' c' | f' c' | e' c' - d' b | c' a | f g | c2 | - -} - -\score{ - \staff{ melodie } - \staff{ begeleiding } - \midi{ - \tempo 4:120 - } -} - diff --git a/input/plet.ly b/input/plet.ly index 255ee658a1..8cdf05f297 100644 --- a/input/plet.ly +++ b/input/plet.ly @@ -1,9 +1,10 @@ +% urgh -melanie = \melodic{ - \meter{2/4} - \duration{8} - [ c d ] { [ d d' } { c c' ] } | - [ c d ] [ e { d g } c ]2/3 | +melanie = \melodic{ + \meter 2/4; + \duration 8; + [ c d ] < [ d d'>< c c' ] > | + [ c d ] [ e <d g > c ]2/3 | [ c d ] [ c16 d16 e'16 e'16 d16 c16 ]4/6 | [ c d e e d c ]4/6 | [c d ] < { [ c d e ]2/3 } { [ f g a ]2/3 } > | @@ -11,9 +12,9 @@ melanie = \melodic{ } -michelle = \melodic{ - \meter{2/4} - \duration{8} +michelle = \melodic{ + \meter 2/4; + \duration 8; [ c c c c ] | [ c c c c ] | [ c c c c ] | @@ -22,9 +23,9 @@ michelle = \melodic{ [ c c c c ] | } -mireille = \lyric{ - \meter{2/4} - \duration{8} +mireille = \lyric{ + \meter 2/4; + \duration 8; o o o o | o o [ o o o ]2/3 | [ o o o ]2/3 [ o16 o16 o16 o16 o16 o16 ]4/6 | @@ -34,8 +35,8 @@ mireille = \lyric{ } \score{ - \staff{ mireille } - \staff{ melanie } - \staff{ michelle } + \staff{ melodicregs mireille } + \staff{ melodicregs melanie } + \staff{ melodicregs michelle } \paper{} } diff --git a/input/rhythm.ly b/input/rhythm.ly index 5739294fbf..c76a1ee0cd 100644 --- a/input/rhythm.ly +++ b/input/rhythm.ly @@ -5,23 +5,23 @@ ritme = \staff { melodicregs - \melodic{ %\octave {c} - \partial {8} - \meter{ 4/4} + \melodic{ %\octave ; + \partial 8; + \meter 4/4; c8 | [a8() a8. a8 a16 a16 a16] c4. | % watch the beams! r32 r32 r16 r8 r4 r2 | - \meter{ 5/16} + \meter 5/16; % divide measure in 5 equal parts. Usually it 2+3 or 3+2 - \grouping { 5*16 } + \grouping 16*5 ; [c8 c16 c8 ] | % watch THIS! [c16 c16 c16 c16]5/4 | - \meter{ 2/8} + \meter 2/8; c4 | c4 c4 c4 c4 - \meter {4/4} + \meter 4/4; c1 c1 c1 % [c16 c16 c16 c16 ] | @@ -31,14 +31,16 @@ ritme = \staff { } } -another = \staff{ melodicregs - \melodic{ \meter{ 4/4} - c1 c1 c1 c4 c4 c4 c4 \meter{ 4/4} c1 c1 c1 +another = \staff { + melodicregs + \melodic{ \meter 4/4; + c1 c1 c1 c4 c4 c4 c4 \meter 4/4; c1 c1 c1 } } -yanother = \staff{ melodicregs - \melodic{ \meter{ 4/4} +yanother = \staff { + melodicregs + \melodic{ \meter 4/4; c1 c1 c1 c4 c4 c4 c4 c1 c1 c1 } } diff --git a/input/scales.ly b/input/scales.ly index 2b6aa54c29..727b458d5a 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -47,10 +47,10 @@ c1 \octave c; [c'-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^] [c-. d-. e-. f-.][g-. a-. b-. c'-.] [c'-- b-- a-- g][f-- e-- d c--] % 5 - [c-portato d-portato e-portato f-portato] - [g-portato a-portato b-portato c'-portato] - [c'-upbow b-upbow a-downbow g-downbow] - [f-downbow e-downbow d-upbow c-upbow] + [c-\portato d-\portato e-\portato f-\portato] + [g-\portato a-\portato b-\portato c'-\portato] + [c'-\upbow b-\upbow a-\downbow g-\downbow] + [f-\downbow e-\downbow d-\upbow c-\upbow] [c-| d-| e-| f-|][g-| a-| b-| c'-|] [c' b a g][f e d c] [c d e f][g a b c'] % 10 diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly index a2cd758618..12183e79e7 100644 --- a/input/scsii-menuetto.ly +++ b/input/scsii-menuetto.ly @@ -11,7 +11,7 @@ % The purpose of this file is to demonstrate features of LilyPond. % (there is an accompanying LaTeX file, scsii-menuetto.tex) % - +\version "0.0.50"; %% Stuff from MPP version % \lefttitle{Menuetto} % \tempo{Moderato} @@ -45,10 +45,10 @@ ii_menuetto = \melodic{ c'!4-. | %%7 < a4-. f4> - < d'4-.-upbow f4 'bes4 > - < e'4-.-downbow g4 'g4 > | + < d'4-.-\upbow f4 'bes4 > + < e'4-.-\downbow g4 'g4 > | %%8 - < cis'2.-upbow e2. 'a2. > + < cis'2.-\upbow e2. 'a2. > \bar ":|:"; %%9 \clef "violin"; @@ -69,9 +69,9 @@ ii_menuetto = \melodic{ { \stem -1; g4(\stem -1;) f4 e4 }% ugh > | %%14 - < [ a f > g a f ] < d'4-$upbow e4 'bes4 > | + < [ a f > g a f ] < d'4-\upbow e4 'bes4 > | %%15 - < c'4-$downbow f4 'a4 > [ bes( )a g a ] | + < c'4-\downbow f4 'a4 > [ bes( )a g a ] | %%16 [ f( e )f a-. g-. bes-. ] | %%17 @@ -79,7 +79,7 @@ ii_menuetto = \melodic{ %%18 < { [ c'( )bes c' a ] } { [ es ] } > fis4 | %%19 - < d'4-downbow g4 'bes4 > < c'4-upbow g4 c4 > < [ bes d > a ] | + < d'4-\downbow g4 'bes4 > < c'4-\upbow g4 c4 > < [ bes d > a ] | %%20 < { [ c'( bes a )bes g( )bes ] } { [ d ] } { [ g ] } > | %%21 @@ -96,7 +96,7 @@ ii_menuetto = \melodic{ } \score{ - \staff{ melodicregs $ii_menuetto } + \staff{ melodicregs ii_menuetto } \paper{ \width 195\mm \unitspace 9\mm % to get lily to use only three lines diff --git a/input/standchen.ly b/input/standchen.ly index 847a3c323c..4514ff8788 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -108,7 +108,6 @@ melodie = \melodic{ %%36 < a2. fis2. > | %#%\volta2 -%#%:| %%37 [ a8. a16 ] [ cis'8. cis'16 ] [ e'8. e'16 ] | %%38 @@ -181,7 +180,6 @@ begeleiding = \melodic{ %%4 ''a r4 | -%#%:| %%5 \duration 8 ; < \multivoice { \stem 1 ; [ 'f 'a d 'a d 'a ] } @@ -265,7 +263,6 @@ begeleiding = \melodic{ %%36 [ 'd 'fis 'a 'fis 'a 'fis ] | %#%\volta2 -%#%:| %%37 [ ''a 'e 'g 'e ''bes^> 'e ] | %%38 diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly index b023a4000c..5bff42ebc0 100644 --- a/input/wohltemperirt.ly +++ b/input/wohltemperirt.ly @@ -4,6 +4,8 @@ % % Public Domain -- typed by by HWN % +\version "0.0.50"; + global = \melodic{ \meter 4/4 ; \grouping 2*2; diff --git a/lib/include/input.hh b/lib/include/input.hh index 180baf170b..f87385c428 100644 --- a/lib/include/input.hh +++ b/lib/include/input.hh @@ -26,6 +26,7 @@ public: String location_str()const; Input(Source_file*, char const*); Input(); + Input( Input const& ); }; #endif // INPUT_HH diff --git a/lily/.version b/lily/.version index a3bb0ea650..93a395e794 100644 --- a/lily/.version +++ b/lily/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 48 +PATCH_LEVEL = 49 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf diff --git a/lily/beam.cc b/lily/beam.cc index a20e859e23..389226fa71 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -30,7 +30,7 @@ struct Stem_info { Stem_info::Stem_info(Stem const *s) { x = s->hindex(); - int dir = s->dir; + int dir = s->dir_i_; idealy = max(dir*s->top, dir*s->bot); miny = max(dir*s->minnote, dir*s-> maxnote); assert(miny <= idealy); @@ -74,7 +74,7 @@ Beam::set_default_dir() } dir_i_ = (dirs[0] > dirs[1]) ? -1 : 1; for (iter_top(stems,i); i.ok(); i++) { - i->dir = dir_i_; + i->dir_i_ = dir_i_; } } @@ -190,7 +190,7 @@ Beam::do_pre_processing() Interval -Beam::width() const +Beam::do_width() const { Beam * me = (Beam*) this; // ugh return Interval( (*me->stems.top()) ->hindex(), diff --git a/lily/clef-reg.cc b/lily/clef-reg.cc index fc1aef825b..f5687a1665 100644 --- a/lily/clef-reg.cc +++ b/lily/clef-reg.cc @@ -50,7 +50,7 @@ Clef_register::read_req(Clef_change_req*c_l) void Clef_register::acknowledge_element(Staff_elem_info info) { - if (info.elem_p_->name() == Bar::static_name()) { + if (info.elem_l_->name() == Bar::static_name()) { if (!clef_p_){ create_clef(); clef_p_->change = false; diff --git a/lily/crescendo.cc b/lily/crescendo.cc index e8a36e29a8..4583bdae2f 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -10,9 +10,10 @@ #include "lookup.hh" #include "paper-def.hh" #include "debug.hh" -Crescendo::Crescendo(int s) + +Crescendo::Crescendo() + : Staff_side(this) { - staff_size_i_ = s; grow_dir_i_ =0; dir_i_ = -1 ; left_dyn_b_ = right_dyn_b_ =false; @@ -47,9 +48,7 @@ Crescendo::brew_molecule_p() const return m_p ; } Symbol s( paper()->lookup_l()->hairpin(w_dim, grow_dir_i_ < 0) ); m_p->add(Atom(s)); - int pos = (dir_i_ >0) ? staff_size_i_ + 4 : - 4 ; - if(dir_i_<0 ) // should do something better anyway. - m_p->translate(Offset(0, -m_p->extent().y.left )); + int pos = get_position_i(); m_p->translate(Offset(x_off_dim,pos * paper()->internote())); } diff --git a/lily/dynamic-reg.cc b/lily/dynamic-reg.cc index e0e38a7a59..4088a3be70 100644 --- a/lily/dynamic-reg.cc +++ b/lily/dynamic-reg.cc @@ -13,6 +13,7 @@ #include "lookup.hh" #include "paper-def.hh" #include "score-column.hh" +#include "staff-sym.hh" Dynamic_register::Dynamic_register() { @@ -55,7 +56,7 @@ Dynamic_register::process_requests() assert (!dynamic_p_) ; // TODO - dynamic_p_ = new Text_item(td_p, 10 ); // TODO! + dynamic_p_ = new Text_item(td_p); announce_element(Staff_elem_info(dynamic_p_, dreq_l)); } else if (dreq_l->span_dynamic()) { @@ -71,7 +72,7 @@ Dynamic_register::process_requests() } else if (span_l->spantype == Span_req::START) { cresc_req_l_ = span_l; assert(!new_cresc_p); - new_cresc_p = new Crescendo(10); + new_cresc_p = new Crescendo; new_cresc_p->grow_dir_i_ = span_l->dynamic_dir_i_; announce_element(Staff_elem_info(new_cresc_p, span_l)); } @@ -90,7 +91,9 @@ Dynamic_register::process_requests() void Dynamic_register::pre_move_processing() { + Staff_symbol* s_l = get_staff_info().staff_sym_l_; if (dynamic_p_) { + dynamic_p_->set_staffsym(s_l); typeset_element(dynamic_p_); dynamic_p_ = 0; } @@ -99,7 +102,7 @@ Dynamic_register::pre_move_processing() to_end_cresc_p_->right_dyn_b_=true; to_end_cresc_p_->right_col_l_ = get_staff_info().musical_l()->pcol_l_; - + to_end_cresc_p_->set_staffsym(s_l); typeset_element(to_end_cresc_p_); to_end_cresc_p_ = 0; } diff --git a/lily/global-regs.cc b/lily/global-regs.cc index 207cc16c55..3451ca5270 100644 --- a/lily/global-regs.cc +++ b/lily/global-regs.cc @@ -6,6 +6,8 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ +#include "proto.hh" +#include "plist.hh" #include "input-register.hh" #include "debug.hh" #include "register.hh" diff --git a/lily/headreg.cc b/lily/headreg.cc index 318ed3a607..2d551cdd2c 100644 --- a/lily/headreg.cc +++ b/lily/headreg.cc @@ -3,9 +3,9 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "rest.hh" + #include "notehead.hh" -#include "headreg.hh" +#include "head-reg.hh" #include "paper-def.hh" #include "complex-walker.hh" #include "musical-request.hh" @@ -40,20 +40,21 @@ Notehead_register::process_requests() if (!note_req_l_) return; + Notehead*n_p = new Notehead(8); // ugh + note_p_ = n_p; + n_p->set_rhythmic(note_req_l_->rhythmic()); if (note_req_l_->note()) { - Notehead*n_p = new Notehead(8); // ugh - note_p_ = n_p; - n_p->set_rhythmic(note_req_l_->rhythmic()); n_p->position = note_req_l_->note()->height() + *get_staff_info().c0_position_i_l_; - } else { - note_p_ = new Rest ( note_req_l_->rhythmic()->duration_); + } else if (note_req_l_->rest()) { + n_p->rest_b_ = true; if (note_req_l_->rhythmic()->duration_.type_i_ <= 2) note_p_->translate( Offset(0, 6 * paper()->internote())); } + Staff_elem_info itinf(note_p_,note_req_l_); announce_element(itinf); } @@ -62,8 +63,9 @@ void Notehead_register::pre_move_processing() { if (note_p_) { - if (dir_i_ && note_p_->name() == Rest::static_name()) - note_p_->translate(Offset(0, 4*dir_i_ * paper()->internote())); + if (dir_i_ && note_p_->rest_b_ && note_p_->balltype <= 2) { + note_p_->position +=4*dir_i_ ; + } typeset_element(note_p_); note_p_ = 0; } diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 8eb2f148b5..a85858bad8 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -25,7 +25,7 @@ struct Beam: public Directional_spanner { /* *************** */ NAME_MEMBERS(Beam); - virtual Interval width()const; + virtual Interval do_width()const; Offset center() const; Spanner *do_break_at(PCol *, PCol *) const; Beam(); diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh index cb6b159ad7..915094e1dc 100644 --- a/lily/include/crescendo.hh +++ b/lily/include/crescendo.hh @@ -10,21 +10,22 @@ #ifndef CRESCENDO_HH #define CRESCENDO_HH +#include "staff-side.hh" #include "spanner.hh" /** The hairpin symbol. (cresc) */ -class Crescendo : public Spanner { - int staff_size_i_; +class Crescendo : public Spanner , public Staff_side { + public: int grow_dir_i_; - int dir_i_; - /// if there is a dynamic at the end, make the sign smaller. + +/// if there is a dynamic at the end, make the sign smaller. bool right_dyn_b_; /// if there is a dynamic at the end, make the sign smaller. bool left_dyn_b_; - Crescendo(int staff_size_i); + Crescendo(); private: Spanner* do_break_at( PCol*, PCol*) const; Molecule*brew_molecule_p()const; diff --git a/lily/include/dynamic-reg.hh b/lily/include/dynamic-reg.hh index 164ac6af3d..8b39f4fe11 100644 --- a/lily/include/dynamic-reg.hh +++ b/lily/include/dynamic-reg.hh @@ -12,7 +12,7 @@ #include "register.hh" -struct Dynamic_register : Request_register { +class Dynamic_register : public Request_register { int dir_i_; Text_item * dynamic_p_; Crescendo * to_end_cresc_p_; @@ -20,15 +20,17 @@ struct Dynamic_register : Request_register { Span_dynamic_req * cresc_req_l_; Array<Dynamic_req*> dynamic_req_l_arr_; /* ************** */ +public: Dynamic_register(); ~Dynamic_register(); + NAME_MEMBERS(Dynamic_register); +protected: virtual bool try_request(Request *req_l); virtual void process_requests(); virtual void pre_move_processing(); virtual void post_move_processing(); virtual bool acceptable_request_b(Request*) const; virtual void set_feature(Features); - NAME_MEMBERS(Dynamic_register); }; #endif // DYNAMIC_REG_HH diff --git a/lily/include/head-reg.hh b/lily/include/head-reg.hh index d5eb6fa5cd..188db10a26 100644 --- a/lily/include/head-reg.hh +++ b/lily/include/head-reg.hh @@ -10,14 +10,18 @@ #include "register.hh" struct Notehead_register : Request_register { - Item* note_p_; + Notehead* note_p_; + Rhythmic_req * note_req_l_; int dir_i_; + /* *************** */ - Notehead_register(Complex_walker*); + Notehead_register(); virtual bool try_request(Request *req_l) ; - virtual void process_request(); - virtual void do_pre_move_process(); - void set_dir(int); + virtual void process_requests(); + virtual void pre_move_processing(); + virtual void post_move_processing(); + void set_feature(Features); + NAME_MEMBERS(Notehead_register); }; diff --git a/lily/include/headreg.hh b/lily/include/headreg.hh deleted file mode 100644 index eaa2d6f9d7..0000000000 --- a/lily/include/headreg.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - headreg.hh -- part of LilyPond - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef HEADREG_HH -#define HEADREG_HH -#include "register.hh" - -struct Notehead_register : Request_register { - Item* note_p_; - Rhythmic_req * note_req_l_; - int dir_i_; - - /* *************** */ - Notehead_register(); - virtual bool try_request(Request *req_l) ; - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); - void set_feature(Features); - NAME_MEMBERS(Notehead_register); -}; - - -#endif // HEADREG_HH diff --git a/lily/include/item.hh b/lily/include/item.hh index d1fc8c8bfa..3a1efa36c7 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -16,7 +16,8 @@ spacing calculation. */ -struct Item : Staff_elem { +class Item : public Staff_elem { +public: /// indirection to the column it is in PCol * pcol_l_; diff --git a/lily/include/key.hh b/lily/include/key.hh index cbffa1e8f7..38885f4a18 100644 --- a/lily/include/key.hh +++ b/lily/include/key.hh @@ -16,7 +16,7 @@ class Octave_key { public: Array<int> accidental_i_arr_; - Key(); + Octave_key(); void set(int i, int acc); int acc(int i)const { return accidental_i_arr_[i]; } }; diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index ff9e0fea4f..abe556db86 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -52,5 +52,9 @@ struct Stem_req; struct Terminate_voice_req; struct Text_req; struct Timing_req; +struct Note_column_register; +struct Note_column; +struct Staff_side; +struct Staff_symbol; #endif // LILY_PROTO_HH diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index 1da7940b69..cd27e9b574 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -62,10 +62,12 @@ public: void set_debug(); void set_yydebug(bool); void print_declarations(); + bool ignore_version_b_; public: void parse_file ( String init_str, String file_str); My_lily_parser(Sources * sources_l); ~My_lily_parser(); + void set_version_check(bool ignore); }; #endif // MY_LILY_PARSER_HH diff --git a/lily/include/note-column-reg.hh b/lily/include/note-column-reg.hh new file mode 100644 index 0000000000..01a860911d --- /dev/null +++ b/lily/include/note-column-reg.hh @@ -0,0 +1,27 @@ +/* + note-column-reg.hh -- declare Note_column_register + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef NOTE_COLUMN_REG_HH +#define NOTE_COLUMN_REG_HH + +#include "register.hh" + +class Note_column_register :public Request_register { + Note_column *ncol_p_; + /* *************** */ + bool acceptable_elem_b(Staff_elem const*)const; +protected: + virtual void acknowledge_element(Staff_elem_info); + virtual void pre_move_processing(); + +public: + Note_column_register(); + NAME_MEMBERS(Note_column_register); +}; +#endif // NOTE_COLUMN_REG_HH diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh new file mode 100644 index 0000000000..b5d71798b3 --- /dev/null +++ b/lily/include/note-column.hh @@ -0,0 +1,37 @@ +/* + note-column.hh -- declare Note_column + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef NOTE_COLUMN_HH +#define NOTE_COLUMN_HH +#include "item.hh" + +/** + a struct for treating a group of noteheads (noteheads, stem, scripts ) + as a single entity. + */ +class Note_column : public Item { + Stem * stem_l_; + Array<Notehead*> head_l_arr_; + Array<Script *> script_l_arr_; + +protected: + virtual void translate(Offset); + virtual Interval do_height()const; + virtual void do_print() const ; + virtual void do_pre_processing(); + virtual Interval do_width()const; +public: + + NAME_MEMBERS(Note_column); + Note_column(); + void add(Notehead *); + void add(Stem *); + void add(Script *); +}; +#endif // NOTE_COLUMN_HH diff --git a/lily/include/notehead.hh b/lily/include/notehead.hh index d7a68e7798..5d9c1d012d 100644 --- a/lily/include/notehead.hh +++ b/lily/include/notehead.hh @@ -6,20 +6,23 @@ #ifndef NOTEHEAD_HH #define NOTEHEAD_HH + #include "item.hh" -/** - ball at the end of the stem -takes care of: +/** ball at the end of the stem takes care of: * help lines * proper placing of dots + It also is the item for a Rest + */ -struct Notehead : Item { +class Notehead : public Item { +public: NAME_MEMBERS(Notehead); + bool rest_b_; int position; /// -1 = lowest, 0 = inside, 1 = top int extremal; @@ -37,9 +40,10 @@ struct Notehead : Item { position of top line (5 linestaff: 8) */ Notehead(int staff_size); - void do_print()const; static int compare(Notehead * const &a, Notehead *const &b) ; - Molecule* brew_molecule_p()const; +protected: + virtual void do_print()const; + virtual Molecule* brew_molecule_p()const; }; #endif // NOTEHEAD_HH diff --git a/lily/include/register.hh b/lily/include/register.hh index 4ac81c61e4..3978c79727 100644 --- a/lily/include/register.hh +++ b/lily/include/register.hh @@ -7,7 +7,7 @@ #ifndef REGISTER_HH #define REGISTER_HH -#include "proto.hh" +#include "lily-proto.hh" #include "varray.hh" #include "request.hh" #include "staff-elem-info.hh" @@ -24,6 +24,7 @@ class Request_register { */ Request_register(const Request_register&){} protected: + /// utility virtual Paper_def * paper() const; diff --git a/lily/include/rest.hh b/lily/include/rest.hh deleted file mode 100644 index 90e5f518a3..0000000000 --- a/lily/include/rest.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* - rest.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef REST_HH -#define REST_HH -#include "item.hh" - -/** typeset a Rest. A "vanilla" item. - */ -struct Rest : Item { - - int dots; - int balltype; - - /// rests can be translated up and down. - int pos_i_; - /* *************** */ - - - Rest(Duration); - void do_print()const; -NAME_MEMBERS(Rest); - Molecule* brew_molecule_p()const; -}; -#endif - diff --git a/lily/include/script-def.hh b/lily/include/script-def.hh index 8d9528b45a..9af312bfa4 100644 --- a/lily/include/script-def.hh +++ b/lily/include/script-def.hh @@ -8,17 +8,30 @@ #define SCRIPTDEF_HH #include "string.hh" -struct Script_def{ - int stemdir; - int staffdir; +/** The characteristics of a certain kind of accent. It is not the + accent itself. */ +struct Script_def { - bool invertsym; + /// on the other side of the stem? + int rel_stem_dir_i_; + + /// below or above staff? + int staff_dir_i_; + + /// how close to the note do we want to be? + int priority_i_; + + /// follow the ball inside staff? + bool inside_staff_b_; + + /// invert if below staff? + bool invertsym_b_; String symidx; /* *************** */ int compare(Script_def const &); void print() const; - Script_def(String, int, int ,bool); + Script_def(String, bool, int, int ,bool); }; diff --git a/lily/include/script-reg.hh b/lily/include/script-reg.hh index 33592cae03..034140baeb 100644 --- a/lily/include/script-reg.hh +++ b/lily/include/script-reg.hh @@ -11,19 +11,23 @@ #include "register.hh" -struct Script_register : Request_register { - Script * script_p_; - Script_req * script_req_l_; - int dir_i_; +class Script_register : public Request_register { + Array<Script *> script_p_arr_; + Array<Script_req *> script_req_l_arr_; + /* *************** */ - void set_feature(Features dir_i_); + bool acceptable_elem_b(Staff_elem*); +public: + NAME_MEMBERS(Script_register); Script_register(); +protected: + virtual void set_feature(Features dir_i_); virtual bool try_request(Request*); virtual void process_requests(); virtual void acknowledge_element(Staff_elem_info); virtual void pre_move_processing(); virtual void post_move_processing(); - NAME_MEMBERS(Script_register); + }; #endif // SCRIPTREG_HH diff --git a/lily/include/script.hh b/lily/include/script.hh index df408f0435..5ad74821cc 100644 --- a/lily/include/script.hh +++ b/lily/include/script.hh @@ -7,33 +7,41 @@ #ifndef SCRIPT_HH #define SCRIPT_HH +#include "staff-side.hh" #include "script-def.hh" #include "item.hh" -struct Script : Item { - int dir; - int symdir; - int pos; - int staffsize; +/** + Accents that are put over a note-group. + */ +class Script : public Item, public Staff_side { + /** + Vertical dir of symbol. -1 means invert the symbol. + */ + int symdir_i_; + + int pos_i_; + Script_def *specs_l_; Stem *stem_l_; - Array<Item *> support; /* *************** */ - NAME_MEMBERS(Script); +protected: Molecule *brew_molecule_p()const; virtual void do_post_processing(); virtual void do_pre_processing(); - Script(Script_req*, int staffsize); - void set_support(Item*); - void set_stem(Stem*); - Interval support_height()const; - virtual Interval width() const; + virtual Interval do_width() const; private: void set_symdir(); void set_default_dir(); void set_default_index(); Symbol symbol()const; +public: + static int compare(Script *const&, Script *const&) ; + Script(Script_req*); + void set_stem(Stem*); + NAME_MEMBERS(Script); + }; diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 3bb547b528..d3ca04af5e 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -11,44 +11,47 @@ #include "staff-elem.hh" -/** a symbol which is attached between two columns. A spanner is a symbol which spans across several columns, so its - final appearance can only be calculated after the breaking problem - is solved. +/** a symbol which is attached between two columns. A spanner is a + symbol which spans across several columns, so its final appearance + can only be calculated after the breaking problem is solved. Examples - - (de)crescendo - - slur - - beam - - bracket + \begin{itemize} + \item (de)crescendo + \item slur + \item beam + \item bracket + \end{itemize} Spanner should know about the items which it should consider: - e.g. slurs should be steep enough to "enclose" all those items. This - is absolutely necessary for beams, since they have to adjust the - length of stems of notes they encompass. + e.g. slurs should be steep enough to "enclose" all those items. This + is absolutely necessary for beams, since they have to adjust the + length of stems of notes they encompass. */ -struct Spanner:Staff_elem { +class Spanner:public Staff_elem { +public: PCol *left_col_l_, *right_col_l_; /* *************** */ - + NAME_MEMBERS(Spanner); + virtual Spanner* spanner() { return this; } Spanner(); - virtual Interval width()const; - void do_print()const; - Spanner *broken_at(PCol *c1, PCol *c2) const; - virtual Spanner* spanner() { return this; } protected: + virtual Interval do_width()const; + void do_print()const; + + /** - clone a piece of this spanner. - PRE - c1 >= start, c2 <= stop + clone a piece of this spanner. + PRE + c1 >= start, c2 <= stop */ virtual Spanner *do_break_at( PCol *c1, PCol *c2) const=0; - NAME_MEMBERS(Spanner); }; #endif diff --git a/lily/include/staff-elem-info.hh b/lily/include/staff-elem-info.hh index 24e09501e3..25b8281ebd 100644 --- a/lily/include/staff-elem-info.hh +++ b/lily/include/staff-elem-info.hh @@ -15,7 +15,7 @@ /// data container. struct Staff_elem_info { - Staff_elem * elem_p_; + Staff_elem * elem_l_; Request*req_l_; Voice const * voice_l_; Array<Request_register*> origin_reg_l_arr_; diff --git a/lily/include/staff-elem.hh b/lily/include/staff-elem.hh index a604385cff..c47cd024dc 100644 --- a/lily/include/staff-elem.hh +++ b/lily/include/staff-elem.hh @@ -56,7 +56,12 @@ public: virtual ~Staff_elem(); Staff_elem(); NAME_MEMBERS(Staff_elem); - void translate(Offset); + + /** + translate the symbol. The symbol does not have to be created yet. + Overridable, since this staff-elem might act as a pseudo-list. + */ + virtual void translate(Offset); void add_processing(); void pre_processing(); void post_processing(); @@ -64,15 +69,19 @@ public: virtual Spanner* spanner() { return 0; } virtual Item * item() { return 0; } + /** + add a dependency. It may be the 0 pointer, in which case, it is ignored. + */ void add_dependency(Staff_elem* ); void substitute_dependency(Staff_elem* old, Staff_elem * newdep); protected: - + virtual Interval do_height()const; + virtual Interval do_width()const; /// do printing of derived info. - virtual void do_print() const=0; + virtual void do_print() const {} /// generate the molecule - virtual Molecule* brew_molecule_p()const=0; + virtual Molecule* brew_molecule_p()const; ///executed directly after the item is added to the PScore virtual void do_add_processing(); /// do calculations before determining horizontal spacing diff --git a/lily/include/staff-info.hh b/lily/include/staff-info.hh index 2229c99ab0..2fc4fd7926 100644 --- a/lily/include/staff-info.hh +++ b/lily/include/staff-info.hh @@ -14,7 +14,7 @@ struct Staff_info { int *c0_position_i_l_; Staff_walker *walk_l_; - + Staff_symbol*staff_sym_l_; /// when is now? Time_description const *time_C_; diff --git a/lily/include/staff-regs.hh b/lily/include/staff-regs.hh index 344659dff3..88c41f8999 100644 --- a/lily/include/staff-regs.hh +++ b/lily/include/staff-regs.hh @@ -20,7 +20,12 @@ class Staff_registers : public Register_group_register { Input_register const *ireg_C_; int base_position_i_; Array<Voice_group_registers*> group_l_arr_; - + Staff_symbol * staff_sym_l_; +protected: + virtual bool try_request(Request * r); + virtual Staff_info get_staff_info(); + virtual bool acceptable_request_b(Request*) const ; + virtual void acknowledge_element(Staff_elem_info); public: /* *************** */ @@ -30,10 +35,7 @@ public: Voice_group_registers * old_group); Voice_group_registers * get_group(String id); void terminate_register(Request_register * reg); - virtual bool try_request(Request * r); - virtual Staff_info get_staff_info(); Staff_registers(Input_register const*); - virtual bool acceptable_request_b(Request*) const ; }; #endif // STAFF_REGS_HH diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh new file mode 100644 index 0000000000..bd29c53b5c --- /dev/null +++ b/lily/include/staff-side.hh @@ -0,0 +1,39 @@ +/* + staff-side.hh -- declare Staff_side + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef STAFF_SIDE_HH +#define STAFF_SIDE_HH + +#include "staff-elem.hh" + +/// A symbol which sits along the staff +class Staff_side { + Array<Staff_elem*> support_l_arr_; + + Staff_symbol * staff_sym_l_; + Staff_elem * elem_l_; + Interval support_height()const; +public: + /** + Vertical dir of symbol relative to staff. -1 = below staff? + */ + int dir_i_; + + /// follow the support inside the staff? + bool inside_staff_b_; + + void set_staffsym(Staff_symbol*); + + Staff_side(Staff_elem*); + void add_support(Staff_elem*); + +protected: + int get_position_i()const; +}; +#endif // STAFF_SIDE_HH diff --git a/lily/include/staff-sym-reg.hh b/lily/include/staff-sym-reg.hh index 24bd2c7abb..7ca370dd61 100644 --- a/lily/include/staff-sym-reg.hh +++ b/lily/include/staff-sym-reg.hh @@ -19,9 +19,11 @@ class Staff_sym_register : public Request_register { Staff_symbol *span_p_; Moment last_mom_; public: - ~Staff_sym_register(); Staff_sym_register(); NAME_MEMBERS(Staff_sym_register); +protected: + virtual void process_requests(); + ~Staff_sym_register(); virtual void pre_move_processing(); virtual void post_move_processing(); }; diff --git a/lily/include/staff-sym.hh b/lily/include/staff-sym.hh index bcec2bfaff..852771b79e 100644 --- a/lily/include/staff-sym.hh +++ b/lily/include/staff-sym.hh @@ -10,20 +10,24 @@ #ifndef STAFFSYM_HH #define STAFFSYM_HH #include "spanner.hh" + /** This spanner draws the lines of a pstaff. The bottom line is position 0. */ class Staff_symbol : public Spanner { -public: /// this many lines. int no_lines_i_; +public: + void set_extent(PCol* p1, PCol* p2); NAME_MEMBERS(Staff_symbol); Staff_symbol(int lines); + Real inter_note_f()const; + int steps_i()const; +protected: virtual Molecule* brew_molecule_p() const; - void set_extent(PCol* p1, PCol* p2); virtual void do_print()const; virtual Spanner *do_break_at( PCol *c1, PCol *c2) const; }; diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 34776ea49c..e64aafdd69 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -51,7 +51,7 @@ struct Stem : Item { -1 stem points down, +1: stem points up */ - int dir; + int dir_i_; Real stem_xoffset; Array<Notehead*> heads; @@ -74,7 +74,7 @@ struct Stem : Item { void set_noteheads(); void do_pre_processing(); - Interval width() const; + virtual Interval do_width() const; Molecule* brew_molecule_p() const; }; diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh index ba81fce474..85ff171d6d 100644 --- a/lily/include/text-item.hh +++ b/lily/include/text-item.hh @@ -9,18 +9,18 @@ #include "text-def.hh" #include "item.hh" +#include "staff-side.hh" /** print a fixed width text above or below the staff. */ -class Text_item : public Item { - void init(Text_def* tdef_l,int staffsize_i); +class Text_item : public Item ,public Staff_side{ + void init(Text_def* tdef_l); Text_def* tdef_p_; + public: Text_def * tdef_l(); int pos_i_; - int staffsize_i_; - int dir_i_; /* ***************/ @@ -28,8 +28,8 @@ public: virtual void set_default_index(); Molecule* brew_molecule_p() const; void do_pre_processing(); - Text_item(Text_def*,int); - Text_item(Text_req*,int); + Text_item(Text_def*); + Text_item(Text_req*); ~Text_item(); }; diff --git a/lily/key-reg.cc b/lily/key-reg.cc index 0694a3b83f..dbff99f0a1 100644 --- a/lily/key-reg.cc +++ b/lily/key-reg.cc @@ -44,7 +44,7 @@ Key_register::acknowledge_element(Staff_elem_info info) change_key_b_ = true; } - if (info.elem_p_->name() == Bar::static_name()) + if (info.elem_l_->name() == Bar::static_name()) default_key_b_ = true; } diff --git a/lily/lexer.l b/lily/lexer.l index 00180d66a0..cdb62a8717 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -226,7 +226,7 @@ include { <*>{WHITE}+ { } -<notes>. { +<INITIAL,notes>. { return yylval.c = YYText()[0]; } <INITIAL,lyrics,notes>\\. { diff --git a/lily/lily-version.cc b/lily/lily-version.cc index 389178bbc3..03f605394d 100644 --- a/lily/lily-version.cc +++ b/lily/lily-version.cc @@ -1,7 +1,7 @@ #include "version.hh" #include <stdio.h> -static char *s = "LilyPond " MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL MY_PATCH_LEVEL " #%d"; +static char *s = "GNU LilyPond " MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL MY_PATCH_LEVEL " #%d"; static const int build= #include ".build" diff --git a/lily/local-key-reg.cc b/lily/local-key-reg.cc index caf3e524a6..6af18c1c8b 100644 --- a/lily/local-key-reg.cc +++ b/lily/local-key-reg.cc @@ -36,7 +36,7 @@ Local_key_register::acknowledge_element(Staff_elem_info info) if( note_l_->forceacc_b_ || local_key_.oct(note_l_->octave_i_).acc(note_l_->notename_i_) != note_l_->accidental_i_) { - Item * support_l_ = info.elem_p_->item(); + Item * support_l_ = info.elem_l_->item(); if (!key_item_p_) { @@ -48,7 +48,7 @@ Local_key_register::acknowledge_element(Staff_elem_info info) local_key_.oct(note_l_->octave_i_) .set(note_l_->notename_i_, note_l_->accidental_i_); } - } else if (info.elem_p_->name()==Key_item::static_name()) { + } else if (info.elem_l_->name()==Key_item::static_name()) { Key_register * key_reg_l = (Key_register*)info.origin_reg_l_arr_[0]; key_C_ = &key_reg_l->key_; diff --git a/lily/lyric-item.cc b/lily/lyric-item.cc index 8bca62e9c9..3186523937 100644 --- a/lily/lyric-item.cc +++ b/lily/lyric-item.cc @@ -10,7 +10,7 @@ #include "debug.hh" Lyric_item::Lyric_item(Lyric_req* lreq_l, int voice_count_i) - : Text_item(lreq_l,0) + : Text_item(lreq_l) { pos_i_ = -voice_count_i * 4 ; // 4 fontsize dependant. TODO dir_i_ = -1; diff --git a/lily/main.cc b/lily/main.cc index ab0aced860..d14272f41b 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -21,10 +21,10 @@ Sources* source_l_g = 0; bool only_midi = false; +bool version_ignore_b_ = false; +void destill_inname( String &name_str_r); -void -destill_inname( String &name_str_r); Long_option_init theopts[] = { {1, "output", 'o'}, {0, "warranty", 'w'}, @@ -33,6 +33,7 @@ Long_option_init theopts[] = { {1, "init", 'i'}, {1, "include", 'I'}, {0, "midi", 'M'}, + {0, "ignore-version", 'V'}, {0,0,0} }; @@ -44,13 +45,14 @@ usage() "Typeset and or produce midi output from mudela-file or stdin\n" "\n" "Options:\n" - " -d, --debug enable debugging output\n" - " -I, --include=DIR add DIR to search path\n" - " -i, --init=FILE use FILE as init file\n" - " -h, --help this help\n" - " -w, --warranty show warranty and copyright\n" - " -o, --output=FILE set FILE as default output\n" - " -M, --midi produce midi output only\n" + " -d, --debug enable debugging output\n" + " -I, --include=DIR add DIR to search path\n" + " -i, --init=FILE use FILE as init file\n" + " -h, --help this help\n" + " -w, --warranty show warranty and copyright\n" + " -o, --output=FILE set FILE as default output\n" + " -M, --midi produce midi output only\n" + " -V, --ignore-version ignore mudela version\n" "\n" "LilyPond was compiled with the following settings:\n" #ifdef NDEBUG @@ -105,6 +107,7 @@ do_one_file(String init_str, String file_str) source_l_g->set_path(path_l); { My_lily_parser parser(source_l_g); + parser.set_version_check(version_ignore_b_); parser.parse_file(init_str, file_str); } do_scores(); @@ -147,6 +150,9 @@ main (int argc, char **argv) usage(); exit(0); break; + case 'V': + version_ignore_b_ = false; + break; case 'd': set_debug(true); break; diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 28505097c0..1a274f92d9 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -63,6 +63,7 @@ static Keyword_ent the_key_tab[]={ {"transpose", TRANSPOSE}, {"unitspace", UNITSPACE}, {"width", WIDTH}, + {"version", VERSION}, {"grouping", GROUPING}, {0,0} }; diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index b46d6dd1a0..ce375484ed 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -20,7 +20,11 @@ My_lily_parser::clear_notenames() { lexer_p_->clear_notenames(); } - +void +My_lily_parser::set_version_check(bool ig) +{ + ignore_version_b_ = ig; +} void My_lily_parser::set_debug() { diff --git a/lily/note-column-reg.cc b/lily/note-column-reg.cc new file mode 100644 index 0000000000..1263ca1c6a --- /dev/null +++ b/lily/note-column-reg.cc @@ -0,0 +1,55 @@ +/* + note-column-reg.cc -- implement Note_column_register + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "note-column-reg.hh" +#include "notehead.hh" +#include "stem.hh" +#include "note-column.hh" +#include "script.hh" + +bool +Note_column_register::acceptable_elem_b(Staff_elem const*elem_C)const +{ + char const*nC = elem_C->name(); + return (nC == Script::static_name() || nC == Notehead::static_name() + || nC == Stem::static_name()); +} + +void +Note_column_register::acknowledge_element(Staff_elem_info i) +{ + if (!acceptable_elem_b(i.elem_l_)) + return; + + if (!ncol_p_) + ncol_p_ = new Note_column; + + char const*nC = i.elem_l_->name(); + + if (nC == Script::static_name()) + ncol_p_->add((Script*)i.elem_l_); + else if (nC == Notehead::static_name()) + ncol_p_->add((Notehead*)i.elem_l_); + else if (nC == Stem::static_name()) + ncol_p_->add((Stem*)i.elem_l_); +} + +void +Note_column_register::pre_move_processing() +{ + if (ncol_p_) { + typeset_element(ncol_p_); + ncol_p_ =0; + } +} +Note_column_register::Note_column_register() +{ + ncol_p_=0; +} +IMPLEMENT_STATIC_NAME(Note_column_register); +ADD_THIS_REGISTER(Note_column_register); diff --git a/lily/note-column.cc b/lily/note-column.cc new file mode 100644 index 0000000000..f71d61ba14 --- /dev/null +++ b/lily/note-column.cc @@ -0,0 +1,135 @@ +/* + note-column.cc -- implement Note_column + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "note-column.hh" +#include "debug.hh" +#include "script.hh" +#include "notehead.hh" +#include "stem.hh" + +IMPLEMENT_STATIC_NAME(Note_column); + + +void +Note_column::add(Stem*stem_l) +{ + assert(!stem_l_); + stem_l_ = stem_l; + add_dependency(stem_l); +} + +void +Note_column::add(Notehead* n_l) +{ + head_l_arr_.push(n_l); + add_dependency(n_l); +} + +void +Note_column::add(Script*s_l) +{ + script_l_arr_.push(s_l); + add_dependency(s_l); +} + +void +Note_column::translate(Offset o) +{ + for (int i=0; i < head_l_arr_.size(); i++) + head_l_arr_[i]->translate(o); + for (int i=0; i < script_l_arr_.size(); i++) + script_l_arr_[i]->translate(o); + if (stem_l_) + stem_l_->translate(o); +} + + +void +Note_column::do_print()const +{ + mtor << "heads: " << head_l_arr_.size() << '\n'; + mtor << "scripts: " << script_l_arr_.size() << '\n'; +} + +Interval +Note_column::do_height()const return r +{ + if (stem_l_) + r.unite(stem_l_->height()); + for (int i=0; i < head_l_arr_.size(); i++) + r.unite(head_l_arr_[i]->height()); + for (int i=0; i < script_l_arr_.size(); i++) + r.unite(script_l_arr_[i]->height()); +} + +Interval +Note_column::do_width()const return r; +{ + if (stem_l_) + r.unite(stem_l_->width()); + for (int i=0; i < head_l_arr_.size(); i++) + r.unite(head_l_arr_[i]->width()); + for (int i=0; i < script_l_arr_.size(); i++) + r.unite(script_l_arr_[i]->width()); +} + +void +Note_column::do_pre_processing() +{ + if (!script_l_arr_.size()) + return; + + Array<Script*> placed_l_arr_a[4]; + for (int i=0; i < script_l_arr_.size(); i++) { + Script*s_l = script_l_arr_[i]; + int j = (s_l->dir_i_ >0) ? 0 : 2; + if (!s_l->inside_staff_b_) + j ++; + + placed_l_arr_a[j].push(s_l); + } + for (int j =0; j <4; j++) { + placed_l_arr_a[j].sort( Script::compare); + } + + Notehead *top_head_l=0; + Notehead *bot_head_l=0; + for (int i=0; i< head_l_arr_.size(); i++) { + if (head_l_arr_[i]->extremal == -1) + bot_head_l = head_l_arr_[i]; + else if (head_l_arr_[i]->extremal == 1) + top_head_l = head_l_arr_[i]; + } + /* argh. This sux. */ + if (!top_head_l) + top_head_l = bot_head_l; + if (!bot_head_l) + bot_head_l = top_head_l; + assert(bot_head_l && top_head_l); + Item *support_l=top_head_l; + int j; + for (j = 0; j < 2; j++ ) { + for (int i=0; i < placed_l_arr_a[j].size(); j++) { + placed_l_arr_a[j][i]->add_support(support_l); + support_l = placed_l_arr_a[j][i]; + } + } + + support_l=bot_head_l; + for (; j < 4; j++ ) { + for (int i=0; i < placed_l_arr_a[j].size(); i++) { + placed_l_arr_a[j][i]->add_support(support_l); + support_l = placed_l_arr_a[j][i]; + } + } +} +Note_column::Note_column() +{ + stem_l_ =0; +} + diff --git a/lily/notehead.cc b/lily/notehead.cc index 528460f6f1..85132fe55e 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -17,6 +17,7 @@ Notehead::Notehead(int ss) balltype = 0; dots = 0; extremal = 0; + rest_b_ = false; } void @@ -32,6 +33,8 @@ void Notehead::do_print()const { #ifndef NPRINT + if (rest_b_) + mtor << "REST! "; mtor << "balltype "<< balltype << ", position = "<< position << "dots " << dots; #endif @@ -50,7 +53,11 @@ Notehead::brew_molecule_p() const return out; Paper_def *p = paper(); Real dy = p->internote(); - Symbol s = p->lookup_l()->ball(balltype); + Symbol s; + if (!rest_b_) + s = p->lookup_l()->ball(balltype); + else + s = p->lookup_l()->rest(balltype); out = new Molecule(Atom(s)); if (dots) { diff --git a/lily/parser.y b/lily/parser.y index fd81c4f08f..7af1f3325d 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -1,6 +1,7 @@ %{ // -*-Fundamental-*- #include <iostream.h> +#define MUDELA_VERSION "0.0.50" #include "script-def.hh" #include "symtable.hh" @@ -138,6 +139,7 @@ yylex(YYSTYPE *s, void * v_l) %token TITLE %token UNITSPACE %token WIDTH +%token VERSION /* escaped */ %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR @@ -211,9 +213,23 @@ mudela: /* empty */ } | mudela add_declaration { } | mudela error + | mudela check_version { } | mudela add_notenames { } ; +check_version: + VERSION STRING ';' { + if (*$2 != MUDELA_VERSION) { + if (THIS->ignore_version_b_) { + THIS->here_input().error("Incorrect mudela version"); + } else { + THIS->fatal_error_i_ = 1; + THIS->parser_error("Incorrect mudela version"); + } + } + } + ; + add_notenames: NOTENAMES '{' notenames_body '}' ; @@ -788,8 +804,8 @@ script_definition: ; script_body: - STRING int int int { - $$ = new Script_def(*$1,$2, $3,$4); + STRING int int int int { + $$ = new Script_def(*$1,$2, $3,$4,$5); delete $1; } ; diff --git a/lily/register-group.cc b/lily/register-group.cc index 18be472825..a757333200 100644 --- a/lily/register-group.cc +++ b/lily/register-group.cc @@ -57,7 +57,8 @@ Register_group_register::post_move_processing() void Register_group_register::acknowledge_element(Staff_elem_info info) { - if (!contains_b(info.origin_reg_l_arr_[0])) + Request_register* origin = info.origin_reg_l_arr_[0]; + if (!contains_b(origin) && !origin->contains_b(this)) return; for (iter_top(reg_list_, i); i.ok(); i++) diff --git a/lily/register.cc b/lily/register.cc index 2c3f2ec1af..ed84c42c9b 100644 --- a/lily/register.cc +++ b/lily/register.cc @@ -16,7 +16,6 @@ #include "register-group.hh" #include "debug.hh" - bool Request_register::try_request(Request*) { diff --git a/lily/rest.cc b/lily/rest.cc deleted file mode 100644 index 3e582511e9..0000000000 --- a/lily/rest.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - rest.cc -- implement Rest - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ -#include "duration.hh" -#include "rest.hh" -#include "dimen.hh" -#include "debug.hh" -#include "paper-def.hh" -#include "lookup.hh" -#include "molecule.hh" -#include "rest.hh" - -Rest::Rest(Duration d) -{ - balltype = d.type_i_; - dots = d.dots_i_; - pos_i_ = 0; -} - - -IMPLEMENT_STATIC_NAME(Rest); - -void -Rest::do_print()const -{ -#ifndef NPRINT - mtor << "Rest "<<balltype<< "dots " << dots; - Item::print(); -#endif -} - -Molecule* -Rest::brew_molecule_p()const -{ - Paper_def *p =paper(); - - Symbol s; - s = p->lookup_l()->rest(balltype); - - Molecule *m = new Molecule(Atom(s)); - if (dots) { - Symbol d =p->lookup_l()->dots(dots); - Molecule dm; - dm.add(Atom(d)); - m->add_right(dm); - } - m->translate(Offset(0,pos_i_ * paper()->internote())); - return m; -} - diff --git a/lily/script-def.cc b/lily/script-def.cc index 53bdd121ef..2ec888ef65 100644 --- a/lily/script-def.cc +++ b/lily/script-def.cc @@ -1,24 +1,27 @@ #include "debug.hh" #include "script-def.hh" -Script_def::Script_def(String idx, int stem, int staff ,bool invert) +Script_def::Script_def(String idx, bool follow, int stem, int staff ,bool invert) { + inside_staff_b_ = follow; symidx = idx ; - stemdir =stem; - staffdir = staff; - invertsym = invert; + rel_stem_dir_i_ =stem; + staff_dir_i_ = staff; + invertsym_b_ = invert; + priority_i_ =0; } + void Script_def::print() const { mtor << "Script_def{ idx: " << symidx - << " direction, stem: " << stemdir << " staff : " << staffdir << "}\n"; + << " direction, stem: " << rel_stem_dir_i_ << " staff : " << staff_dir_i_ << "}\n"; } int Script_def::compare(Script_def const & c) { return !(symidx == c.symidx && - stemdir == c.stemdir&& - staffdir == c.staffdir&& - invertsym == c.invertsym); + rel_stem_dir_i_ == c.rel_stem_dir_i_&& + staff_dir_i_ == c.staff_dir_i_&& + invertsym_b_ == c.invertsym_b_); } diff --git a/lily/script-reg.cc b/lily/script-reg.cc index cd7b081429..5fd12bc9f6 100644 --- a/lily/script-reg.cc +++ b/lily/script-reg.cc @@ -9,10 +9,10 @@ #include "musical-request.hh" #include "complex-walker.hh" #include "stem.hh" +#include "staff-sym.hh" Script_register::Script_register() { - script_p_ = 0; post_move_processing(); } @@ -21,13 +21,12 @@ Script_register::try_request(Request *r_l) { if (!r_l->script()) return false ; - - if (script_req_l_ - && Script_req::compare(*script_req_l_, *r_l->script())) + for (int i=0; i < script_req_l_arr_.size(); i++) + if ( !Script_req::compare(*script_req_l_arr_[i], *r_l->script())) { + return true; + } - return false; - - script_req_l_ = r_l->script(); + script_req_l_arr_.push( r_l->script()); return true; } @@ -35,44 +34,58 @@ Script_register::try_request(Request *r_l) void Script_register::process_requests() { - if (script_req_l_) { - script_p_ = new Script(script_req_l_, 10); - announce_element( - Staff_elem_info(script_p_, script_req_l_)); + for (int i=0; i < script_req_l_arr_.size(); i++){ + Script_req* l=script_req_l_arr_[i]; + Script *p =new Script( l); + script_p_arr_.push(p); + announce_element(Staff_elem_info(p, l)); } } +bool +Script_register::acceptable_elem_b(Staff_elem*s_l) +{ + char const *nC = s_l->name(); + return (nC == Stem::static_name()); +} + void Script_register::acknowledge_element(Staff_elem_info info) { - if (!script_p_) + Staff_elem *elem_l = info.elem_l_; + if (!acceptable_elem_b(elem_l)) return; - if (info.elem_p_->name() == Stem::static_name()) - script_p_->set_stem((Stem*)info.elem_p_); - else if (info.req_l_->rhythmic()) - script_p_->set_support(info.elem_p_->item()); + + for (int i=0; i < script_p_arr_.size(); i++) { + Script*script_l = script_p_arr_[i]; + if (elem_l->name() == Stem::static_name()) + script_l->set_stem((Stem*)elem_l); + } } void Script_register::pre_move_processing() { - if (script_p_){ - script_p_->dir = dir_i_; - typeset_element(script_p_); - script_p_ = 0; + Staff_symbol* s_l = get_staff_info().staff_sym_l_; + for (int i=0; i < script_p_arr_.size(); i++) { + + Script*script_p = script_p_arr_[i]; + script_p->set_staffsym( s_l); + typeset_element(script_p); } + script_p_arr_.set_size(0); } void Script_register::post_move_processing() { - script_req_l_ = 0; + script_req_l_arr_.set_size(0); } void -Script_register::set_feature(Features i) +Script_register::set_feature(Features ) { - if (i.direction_i_|| i.initialiser_b_) - dir_i_ = i.direction_i_; +// if (i.direction_i_|| i.initialiser_b_) + //dir_i_ = i.direction_i_; } IMPLEMENT_STATIC_NAME(Script_register); ADD_THIS_REGISTER(Script_register); diff --git a/lily/script.cc b/lily/script.cc index b92892de6f..2f471e6ef2 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -1,3 +1,11 @@ +/* + script.cc -- implement Script + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include "musical-request.hh" #include "paper-def.hh" #include "script.hh" @@ -11,89 +19,47 @@ void Script::set_stem(Stem*st_l) { stem_l_ = st_l; - add_dependency(st_l); + add_support(st_l); } -void -Script::set_support(Item*i) -{ - support.push(i); - add_dependency(i); -} -Script::Script(Script_req* rq, int staflen) +Script::Script(Script_req* rq) + :Staff_side(this) { - staffsize =staflen; specs_l_ = rq->scriptdef_p_; + inside_staff_b_ = specs_l_->inside_staff_b_; stem_l_ = 0; - pos = 0; - symdir=1; - dir =rq->dir_i_; + pos_i_ = 0; + symdir_i_=1; + dir_i_ =rq->dir_i_; } void Script::set_symdir() { - if (specs_l_->invertsym) - symdir = (dir < 0) ? -1:1; + if (specs_l_->invertsym_b_) + symdir_i_ = (dir_i_ < 0) ? -1:1; } void Script::set_default_dir() { - if (specs_l_->stemdir) { - if (!stem_l_) - dir = 1; - else - dir = stem_l_->dir * specs_l_->stemdir; + int s_i=specs_l_->rel_stem_dir_i_; + if (s_i && stem_l_) + dir_i_ = stem_l_->dir_i_ * s_i; + else { + dir_i_ =specs_l_->staff_dir_i_; } } -Interval -Script::support_height() const return r; -{ - for (int i=0; i < support.size(); i++) - r.unite(support[i]->height()); -} - void Script::set_default_index() { - Real inter_f= paper()->internote(); - Interval dy = symbol().dim.y; - - int d = specs_l_->staffdir; - Real y ; - if (!d) { - Interval v= support_height(); - y = v[dir] -dy[-dir] + 2*dir*inter_f; - } else { - y = (d > 0) ? staffsize + 2: -2; // ug - y *=inter_f; - Interval v= support_height(); - - if (d > 0) { - y = y >? v.max(); - } else if (d < 0) { - y = y <? v.min(); - } - } - - if (stem_l_) { - Interval v= stem_l_->height(); - - if (d > 0 || (!d && dir > 0)) { - y = y >? v.max(); - }else if (d < 0 || (!d && dir < 0)) { - y = y <? v.min(); - } - } - - pos = int(rint(Real(y)/inter_f)); + pos_i_ = get_position_i(); } Interval -Script::width() const +Script::do_width() const { return symbol().dim.x; } @@ -101,7 +67,7 @@ Script::width() const Symbol Script::symbol()const { - String preidx_str = (symdir < 0) ?"-" :""; + String preidx_str = (symdir_i_ < 0) ?"-" :""; return paper()->lookup_l()->script(preidx_str + specs_l_->symidx); } @@ -124,7 +90,14 @@ Script::brew_molecule_p() const Real dy = paper()->internote(); Molecule*out = new Molecule(Atom(symbol())); - out->translate(Offset(0,dy * pos)); + out->translate(Offset(0,dy * pos_i_)); return out; } IMPLEMENT_STATIC_NAME(Script); + +int +Script::compare(Script *const&l1, Script *const&l2) +{ + return l1->specs_l_->priority_i_ - l2->specs_l_->priority_i_; +} + diff --git a/lily/slur-reg.cc b/lily/slur-reg.cc index 8acf6a1fec..0921ef27f0 100644 --- a/lily/slur-reg.cc +++ b/lily/slur-reg.cc @@ -37,8 +37,8 @@ Slur_register::try_request(Request *req_l) void Slur_register::acknowledge_element(Staff_elem_info info) { - if (info.elem_p_->name() == Notehead::static_name()) { - Notehead *head_p =(Notehead*) info.elem_p_ ;// ugh + if (info.elem_l_->name() == Notehead::static_name()) { + Notehead *head_p =(Notehead*) info.elem_l_ ;// ugh for (int i = 0; i < slur_l_stack_.size(); i++) slur_l_stack_[i]->add(head_p ); for (int i = 0; i < end_slur_l_arr_.size(); i++) diff --git a/lily/spanner.cc b/lily/spanner.cc index d2a8c2bc75..c640b2927e 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -35,7 +35,7 @@ Spanner::Spanner() Interval -Spanner::width()const +Spanner::do_width()const { Real r = right_col_l_->hpos; Real l = left_col_l_->hpos; diff --git a/lily/staff-elem-info.cc b/lily/staff-elem-info.cc index 1bb9db32d4..c046558492 100644 --- a/lily/staff-elem-info.cc +++ b/lily/staff-elem-info.cc @@ -11,14 +11,14 @@ Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l) { - elem_p_ = s_l; + elem_l_ = s_l; voice_l_ = (r_l)?r_l->voice_l():0; req_l_ = r_l; } Staff_elem_info::Staff_elem_info() { - elem_p_ = 0; + elem_l_ = 0; voice_l_ = 0; req_l_ = 0; diff --git a/lily/staff-elem.cc b/lily/staff-elem.cc index 4db170e085..14a4f63ef4 100644 --- a/lily/staff-elem.cc +++ b/lily/staff-elem.cc @@ -1,3 +1,13 @@ +/* + staff-elem.cc -- implement Staff_elem + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "paper-def.hh" +#include "lookup.hh" #include "p-score.hh" #include "symbol.hh" #include "p-staff.hh" @@ -23,6 +33,7 @@ Staff_elem::Staff_elem(Staff_elem const&s) pstaff_l_ = s.pstaff_l_; offset_ = Offset(0,0); } + /** TODO: If deleted, then remove dependant_l_arr_ depency! @@ -37,35 +48,44 @@ Staff_elem::translate(Offset O) { offset_ += O; } + Interval -Staff_elem::width() const +Staff_elem::do_width() const return r; { - Interval r; - + if (!output){ - Molecule*m = brew_molecule_p(); + Molecule*m = brew_molecule_p(); r = m->extent().x; delete m; } else r = output->extent().x; - +} +Interval +Staff_elem::width() const +{ + Interval r=do_width(); + if (!r.empty_b()) // float exception on DEC Alpha r+=offset_.x; return r; } Interval -Staff_elem::height() const +Staff_elem::do_height() const return r { - Interval r; - if (!output){ Molecule*m = brew_molecule_p(); r = m->extent().y; delete m; } else r = output->extent().y; - +} + +Interval +Staff_elem::height() const +{ + Interval r=do_height(); + if (!r.empty_b()) r+=offset_.y; @@ -199,3 +219,10 @@ Staff_elem::add_dependency(Staff_elem * p) p->dependant_l_arr_.push(p); } IMPLEMENT_STATIC_NAME(Staff_elem); + +Molecule* +Staff_elem::brew_molecule_p()const +{ + Atom a(paper()->lookup_l()->fill(Box(Interval(0,0), Interval(0,0)))); + return new Molecule (a); +} diff --git a/lily/staff-info.cc b/lily/staff-info.cc index b6fb13d347..b2b1e72504 100644 --- a/lily/staff-info.cc +++ b/lily/staff-info.cc @@ -4,8 +4,9 @@ source file of the LilyPond music typesetter (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "staff.hh" #include "proto.hh" +#include "plist.hh" +#include "staff.hh" #include "staff-info.hh" #include "score-column.hh" #include "complex-walker.hh" diff --git a/lily/staff-regs.cc b/lily/staff-regs.cc index e22d32873c..983c6a6d2e 100644 --- a/lily/staff-regs.cc +++ b/lily/staff-regs.cc @@ -18,11 +18,13 @@ Staff_info Staff_registers::get_staff_info() return inf; { inf = Request_register::get_staff_info(); + inf.staff_sym_l_=staff_sym_l_; inf.c0_position_i_l_ = &c0_position_i_; } Staff_registers::Staff_registers(Input_register const*ireg_C) { + staff_sym_l_ =0; c0_position_i_ = 0; base_position_i_ =0; add( ireg_C->get_nongroup_p_arr()); @@ -116,3 +118,10 @@ Staff_registers::acceptable_request_b(Request*r)const (r->command() && r->command()->groupchange()); } +void +Staff_registers::acknowledge_element(Staff_elem_info i) +{ + Register_group_register::acknowledge_element(i); + if ( i.elem_l_->name() == Staff_symbol::static_name()) + staff_sym_l_ = (Staff_symbol*)i.elem_l_; +} diff --git a/lily/staff-side.cc b/lily/staff-side.cc new file mode 100644 index 0000000000..92b7917acb --- /dev/null +++ b/lily/staff-side.cc @@ -0,0 +1,65 @@ +/* + staff-side.cc -- implement Staff_side + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "staff-side.hh" +#include "staff-sym.hh" + +void +Staff_side::set_staffsym(Staff_symbol* s_l) +{ + staff_sym_l_ = s_l; +} + +Staff_side::Staff_side(Staff_elem * elem_l) +{ + elem_l_ = elem_l; + dir_i_ =0; + staff_sym_l_ =0; + inside_staff_b_ =false; +} + + +Interval +Staff_side::support_height() const return r; +{ + for (int i=0; i < support_l_arr_.size(); i++) + r.unite(support_l_arr_[i]->height()); +} + +void +Staff_side::add_support(Staff_elem*i) +{ + support_l_arr_.push(i); + elem_l_->add_dependency(i); +} + +int +Staff_side::get_position_i()const +{ + if (!staff_sym_l_) + return 0; + + Real inter_f = staff_sym_l_->inter_note_f(); + int staff_size_i = staff_sym_l_->steps_i(); + Real y=0; + if (!inside_staff_b_) { + y = (dir_i_ > 0) ? staff_size_i + 2: -2; + y *=inter_f; + Interval v= support_height(); + + if (dir_i_ > 0) { + y = y >? (v.max() + 2*inter_f); + } else if (dir_i_ < 0) { + y = y <? (v.min() - 2*inter_f); + } + } else { + Interval v= support_height(); + y = v[dir_i_] + 2*dir_i_*inter_f; // ugh + } + return int(rint(Real(y)/inter_f)); +} diff --git a/lily/staff-sym-reg.cc b/lily/staff-sym-reg.cc index 34a53a552b..e201edb6e3 100644 --- a/lily/staff-sym-reg.cc +++ b/lily/staff-sym-reg.cc @@ -32,6 +32,11 @@ Staff_sym_register::post_move_processing() } } +void +Staff_sym_register::process_requests() +{ + announce_element(Staff_elem_info(span_p_, 0)); +} void Staff_sym_register::pre_move_processing() diff --git a/lily/staff-sym.cc b/lily/staff-sym.cc index 9eb0e76899..9eb4d6d2ac 100644 --- a/lily/staff-sym.cc +++ b/lily/staff-sym.cc @@ -46,3 +46,15 @@ Staff_symbol::set_extent(PCol*p1, PCol*p2) left_col_l_ = p1; right_col_l_ = p2; } + +Real +Staff_symbol::inter_note_f()const +{ + return paper()->internote(); +} + +int +Staff_symbol::steps_i() const +{ + return no_lines_i_*2; +} diff --git a/lily/stem-beam-reg.cc b/lily/stem-beam-reg.cc index 773f0ac1e0..50131835da 100644 --- a/lily/stem-beam-reg.cc +++ b/lily/stem-beam-reg.cc @@ -107,18 +107,19 @@ Stem_beam_register::acknowledge_element(Staff_elem_info info) if (!stem_p_) return; - if (info.elem_p_->name() == Notehead::static_name() && - stem_req_l_->duration() == info.req_l_->rhythmic()->duration()) - - stem_p_->add((Notehead*)info.elem_p_); + if (info.elem_l_->name() == Notehead::static_name() && + stem_req_l_->duration() == info.req_l_->rhythmic()->duration()){ + Notehead * n_l= (Notehead*)info.elem_l_; + if (!n_l->rest_b_) + stem_p_->add((Notehead*)info.elem_l_); + } } - void Stem_beam_register::pre_move_processing() { if (stem_p_) { if (default_dir_i_) - stem_p_->dir = default_dir_i_; + stem_p_->dir_i_ = default_dir_i_; typeset_element(stem_p_); stem_p_ = 0; diff --git a/lily/stem.cc b/lily/stem.cc index 047aec7b9f..01d33597d6 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -19,7 +19,7 @@ Stem::Stem(int c) //, Moment len) maxnote = -1000; bot = top = 0; flag = 4; - dir =0; + dir_i_ =0; staff_center=c; stemlen=0; print_flag=true; @@ -41,12 +41,12 @@ Stem::set_stemend(Real se) { // todo: margins - if (! ((dir > 0 && se >= maxnote) || (se <= minnote && dir <0)) ) + if (! ((dir_i_ > 0 && se >= maxnote) || (se <= minnote && dir_i_ <0)) ) warning("Weird stem size; check for narrow beams"); - top = (dir < 0) ? maxnote : se; - bot = (dir < 0) ? se : minnote; - flag = dir*abs(flag); + top = (dir_i_ < 0) ? maxnote : se; + bot = (dir_i_ < 0) ? se : minnote; + flag = dir_i_*abs(flag); } void @@ -69,8 +69,8 @@ Stem::add(Notehead *n) int Stem::get_default_dir() { - if (dir) - return dir; + if (dir_i_) + return dir_i_; Real mean = (minnote+maxnote)/2; return (mean > staff_center) ? -1: 1; } @@ -78,23 +78,23 @@ Stem::get_default_dir() void Stem::set_default_dir() { - dir = get_default_dir(); + dir_i_ = get_default_dir(); } void Stem::set_default_stemlen() { - if (!dir) + if (!dir_i_) set_default_dir(); int stafftop = 2*staff_center; stemlen = STEMLEN + (maxnote - minnote); // uhh... how about non 5-line staffs? - if (maxnote < -2 && dir == 1){ + if (maxnote < -2 && dir_i_ == 1){ int t = staff_center - staff_center/2; stemlen = t - minnote +2; - } else if (minnote > stafftop + 2 && dir == -1) { + } else if (minnote > stafftop + 2 && dir_i_ == -1) { int t = staff_center + staff_center/2; stemlen = maxnote -t +2; } @@ -115,8 +115,8 @@ Stem::set_default_extents() if (!stemlen) set_default_stemlen(); - set_stemend((dir< 0) ? maxnote-stemlen: minnote +stemlen); - if (dir > 0){ + set_stemend((dir_i_< 0) ? maxnote-stemlen: minnote +stemlen); + if (dir_i_ > 0){ stem_xoffset = paper()->note_width()-paper()->rule_thickness(); } else stem_xoffset = 0; @@ -155,7 +155,7 @@ Stem::do_pre_processing() Interval -Stem::width()const +Stem::do_width()const { if (!print_flag || abs(flag) <= 4) return Interval(0,0); // TODO! diff --git a/lily/text-item.cc b/lily/text-item.cc index 817dc6a3b7..ee10d5e873 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -14,10 +14,11 @@ #include "molecule.hh" #include "lookup.hh" -Text_item::Text_item(Text_def *tdef_l, int staffsize_i) +Text_item::Text_item(Text_def *tdef_l) + : Staff_side(this) { dir_i_ =-1; - init(tdef_l, staffsize_i); + init(tdef_l); } Text_def* @@ -32,15 +33,15 @@ Text_item::~Text_item() } void -Text_item::init(Text_def *tdef_l, int staffsize_i) +Text_item::init(Text_def *tdef_l) { - staffsize_i_ = staffsize_i; tdef_p_ = new Text_def (*tdef_l); } -Text_item::Text_item(Text_req* treq_l, int staffsize_i) +Text_item::Text_item(Text_req* treq_l) + : Staff_side(this) { - init(treq_l->tdef_p_, staffsize_i); + init(treq_l->tdef_p_); dir_i_ = treq_l->dir_i_; if (!dir_i_) dir_i_ = -1; @@ -49,7 +50,7 @@ Text_item::Text_item(Text_req* treq_l, int staffsize_i) void Text_item::set_default_index() { - pos_i_ = (dir_i_ > 0) ? staffsize_i_ + 4: -4; + pos_i_ = get_position_i(); } void diff --git a/lily/text-reg.cc b/lily/text-reg.cc index 5c61f6179d..6c86fad828 100644 --- a/lily/text-reg.cc +++ b/lily/text-reg.cc @@ -32,9 +32,8 @@ Text_register::try_request(Request*req_l) void Text_register::process_requests() { - if (text_req_l_) { - text_p_ = new Text_item(text_req_l_, 10); // UGH + text_p_ = new Text_item(text_req_l_); // UGH announce_element(Staff_elem_info(text_p_, text_req_l_)); } } @@ -43,7 +42,10 @@ Text_register::pre_move_processing() { if (text_p_) { text_p_->dir_i_ = dir_i_; + Staff_symbol* s_l = get_staff_info().staff_sym_l_; + text_p_->set_staffsym(s_l); typeset_element(text_p_); + text_p_ = 0; } } diff --git a/lily/walk-regs.cc b/lily/walk-regs.cc index e0221462e7..17e63918fe 100644 --- a/lily/walk-regs.cc +++ b/lily/walk-regs.cc @@ -30,7 +30,7 @@ Walker_registers::Walker_registers(Complex_walker *w) void Walker_registers::announce_element(Staff_elem_info info) { - if (info.elem_p_->name() == Bar::static_name()) { + if (info.elem_l_->name() == Bar::static_name()) { walk_l_->allow_break(); } announce_info_arr_.push(info); @@ -48,6 +48,7 @@ Walker_registers::do_announces() Request dummy_req; for (int i = 0; i < announce_info_arr_.size(); i++){ Staff_elem_info info = announce_info_arr_[i]; + mtor << "Announcing " << info.elem_l_->name()<<"\n"; if (!info.req_l_) info.req_l_ = &dummy_req; diff --git a/make/Configure_variables.make.in b/make/Configure_variables.make.in index 21f29567fe..fe1d98c47c 100644 --- a/make/Configure_variables.make.in +++ b/make/Configure_variables.make.in @@ -5,7 +5,7 @@ INSTALL = @INSTALL@ USER_CXXFLAGS = @CXXFLAGS@ @CPPFLAGS@ -#CXX = @CXX@ +CXX = @CXX@ libdir = @libdir@ prefix = @prefix@ TEXPREFIX = @TEXPREFIX@ diff --git a/make/Variables.make b/make/Variables.make index 5ed24ca44e..e5fae4e8f0 100644 --- a/make/Variables.make +++ b/make/Variables.make @@ -18,15 +18,10 @@ include ./$(depth)/.version # include ./$(depth)/make/out/Configure_variables.make -# ugh, for win32 make -# leave me up here, or i won-t work -export CXX - ifeq (0,${MAKELEVEL}) MAKE:=$(MAKE) --no-builtin-rules endif - # directory names: # outdir = out# "objects" won-t do, used for libs and deps as well |