diff options
author | Han-Wen Nienhuys <hanwen@xs4all.nl> | 1997-06-26 18:22:36 +0200 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@xs4all.nl> | 1997-06-26 18:22:36 +0200 |
commit | 036af34aa44a151b9e67c18e0acccaafdfae9de8 (patch) | |
tree | c2ee4c404761abf58e7c64f495f8826df4d42672 | |
parent | 0d2593e4ef1f3d1eb6994223f1de8f6c8fbcd066 (diff) |
release: 0.0.68pre
256 files changed, 4322 insertions, 4405 deletions
diff --git a/.dstreamrc b/.dstreamrc index 7fd7b97e0a..8087569c36 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -4,13 +4,13 @@ Dstream 1 File_path 1 My_lily_lexer 1 PCol 0 -Score_column 1 -Ineq_constrained_qp 1 -Spacing_problem 1 -Colinfo 1 -Mixed_qp 1 +Score_column 0 +Ineq_constrained_qp 0 +Spacing_problem 0 +Colinfo 0 +Mixed_qp 0 PScore 0 -Idealspacing 1 +Idealspacing 0 # yydebug InitParser 1 @@ -21,35 +21,35 @@ Declarations 1 InitLexer 1 Lexer 1 -parse_duration 1 -parse_pitchmod 1 -Col_configuration 1 +parse_duration 0 +parse_pitchmod 0 +Col_configuration 0 Request 0 Note_req 0 Rhythmic_req 0 -Rest_req 1 -delete_identifiers 1 -Command 1 -Staff_commands 1 -Stem 1 -Staff 1 -Score 1 +Rest_req 0 +delete_identifiers 0 +Command 0 +Staff_commands 0 +Stem 0 +Staff 0 +Score 0 Voice 0 Voice_element 0 -Input_cursor 1 -Commands_at 1 -Input_command 1 -Time_description 1 +Input_cursor 0 +Commands_at 0 +Input_command 0 +Time_description 0 Melodic_req 0 -Midi_walker 1 -Stem_req 1 +Midi_walker 0 +Stem_req 0 Group_change_req 0 -Script_req 1 -Colinfo 1 -Word_wrap 1 +Script_req 0 +Colinfo 0 +Word_wrap 0 Text_req 0 -Script_def 1 +Script_def 0 Text_def 0 -Paperdef 1 +Paperdef 0 Symtable 1 Symtables 1 @@ -1,7 +1,7 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 0 -TOPLEVEL_PATCH_LEVEL = 67 +TOPLEVEL_PATCH_LEVEL = 68 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf -TOPLEVEL_MY_PATCH_LEVEL = +TOPLEVEL_MY_PATCH_LEVEL = pre @@ -1,5 +1,33 @@ [DRAFT] + Born .. 1997, + + Lily + + GNU LilyPond 0.1, daughter to + + Jan 'Janneke' Nieuwenhuizen and Han-Wen 'Wendy' Nienhuys + +Lily is a health baby weighing 330 kilobyte + +Visiting hours: 24hrs a day at ftp://, pictures & droppings at http:// + +Congratulations to janneke & wendy, hanwen@stack.nl, jan@digicash.com + +************************** + + I would like to dedicate this program to all friends that +music got me. Those deserving special mention (In no particular order) +Esther, Marijke, Heike, Inge, Judith, Hannah, Auke, Ilse, Evelyn, +Maartje, Suzanne, Ilse (gee, again?), and last (but certainly not +least) Janneke! + + HW + +[misschien wat monieks invoegen?] + +************************** + Announcing GNU LilyPond diff --git a/AUTHORS.text b/AUTHORS.text index 8a086d315e..7187b9e439 100644 --- a/AUTHORS.text +++ b/AUTHORS.text @@ -61,6 +61,6 @@ CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSS -19/May/97 LilyPond 0.0.67 1 +19/May/97 LilyPond 0.0.68 1 diff --git a/Documentation/CodingStyle.pod b/Documentation/CodingStyle.pod index 418575cd39..334cbbde63 100644 --- a/Documentation/CodingStyle.pod +++ b/Documentation/CodingStyle.pod @@ -421,4 +421,14 @@ files, doing a release. Use them. +The following generic identifications are used: + + up == 1 + left == -1 + right == 1 + down == -1 + +Intervals are pictured lying on a horizontal numberline (Interval[-1] +is the minimum) + diff --git a/Documentation/MANIFESTO.pod b/Documentation/MANIFESTO.pod index 04d220e96e..e15a09d517 100644 --- a/Documentation/MANIFESTO.pod +++ b/Documentation/MANIFESTO.pod @@ -51,7 +51,6 @@ 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 * GNU LilyPond does not display notes directly, nor will it be rehacked to be @@ -84,16 +83,22 @@ ongoing process, the most important criteria being: =item * -define the (musical) message of the composer as unambiguously as possible, +define the (musical) message of the composer as unambiguously as possible. + +This means that, given a piece Mudela, it should be possible for a +program to play a reasonable interpretation of the piece. + +It also means that, given a piece of Mudela, it should be possible for a +program to print a score of the piece. =item * -be intuitive, and easily readable -(compared to, say, Musi*TeX input, or MIDI :-), +be intuitive, and easily readable (compared to, say, Musi*TeX input, +or MIDI :-), =item * -be writable in ASCII with a simple texteditor, yfte(TM). +be easily writable in ASCII with a simple texteditor, yfte(TM). =back @@ -159,6 +164,6 @@ Bach multivoice organ pieces, =item * -short excerpts to be used in musicological publications. +Short excerpts to be used in musicological publications. =back diff --git a/Documentation/Makefile b/Documentation/Makefile index 542425ec77..d703adfd1a 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -67,3 +67,5 @@ localinstall: $(outdir)/lilypond.1 $(outdir)/mudela.5 localuninstall: rm -f $(mandir)/man1/lilypond.1 rm -f $(mandir)/man1/convert-mudela.1 + +xpms: diff --git a/Documentation/faq.pod b/Documentation/faq.pod index 873b66b850..6be7d7d618 100644 --- a/Documentation/faq.pod +++ b/Documentation/faq.pod @@ -20,14 +20,22 @@ Q: Some of your neat scripts fail, what directories do you use: A: - ~/something - lilypond # the directory as unpacked from the tarball - releases # directory for .tar.gz releases - patches # directory for patches between different releases + ~/something/ +which contains: + + lilypond/ # the directory as unpacked from the tarball + releases/ # directory for .tar.gz releases + patches/ # directory for patches between different releases + test/ + ~/something/lilypond/bin is in the PATH, and contains symlinks to the compiled executables. +If you don't use patches, you'd probably want to symlink + + lilypond -> lilypond-x.y.z + =head2 Language: mudela Q: Why can't you type C<#c> in stead of C<cis> ? @@ -49,6 +57,20 @@ in stead of: cis cis #c #c +Why, you might ask? Because independently of how it was written, you +would say that you are playing and reading "two C-sharp" notes. + + +Q: What is C<cis> anyway + +A: C<cis> is the dutch naming for C-sharp. The notes are named +a, b,.., g. The suffix -is means sharp, and -es flat. This system is +common in a number of languages (such as swedish, dutch, german.) +Certain other languages (such as English, French and Italian) just add +the word for "sharp" to the notename. + +We chose the Dutch system, because we're dutch. You are free to chose +whatever names you like; they are user definable. Q: I can type diff --git a/Documentation/gnu-music.pod b/Documentation/gnu-music.pod index f0fe5fc7e5..977933a1a6 100644 --- a/Documentation/gnu-music.pod +++ b/Documentation/gnu-music.pod @@ -75,10 +75,8 @@ of use and power. =item A set of music fonts -Preferably in Metafont, suited to both screen display and use on paper - -The copyright heritage of Musixtex is unclear. - +Preferably in Metafont, suited to both screen display and use on +paper; This is because the copyright heritage of {Opus,Musix}tex is unclear. =item A typesetting engine. diff --git a/Documentation/index.pod b/Documentation/index.pod index 93ba7ed857..c308cf9447 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -64,6 +64,13 @@ resources on music typesetting > =item * +<a href=other-packages.html +> +Other packages for printing music. +</a +> + +=item * <a href=mi2mu.html > manual page for mi2mu, the MIDI convertor. diff --git a/Documentation/lilyliterature.pod b/Documentation/lilyliterature.pod index 1d88a76875..5293ff3945 100644 --- a/Documentation/lilyliterature.pod +++ b/Documentation/lilyliterature.pod @@ -1,35 +1,40 @@ =head1 NAME -Lily literature -- reading on music engraving +Lily literature -- reading on music engraving/typesetting/etc. =head1 DESCRIPTION A list of resources on music printing/writing and engraving. Please -note that don't have access to most material (except Wanske and a -library copy of Chlapik) +note that don't have access to most material. +[What I do know, I've commented inside brackets. They are just +my personal comments, not to be taken too seriously] More on GNU Music: http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp +Tablature: http://wabakimi.carleton.ca/~phacket2/guitar/tabfaq.html =head2 References -[partly by Mark Basinski <basinski@arizona.edu>] - -Chlapik, Herbert. ``Die Praxis des Notengraphikers''. Doblinger, 1987. -ISBN 3-9000 035-96-2. - Wanske, Helene. ``Musiknotation --- Von der Syntax des Notenstichs -zum EDV-gesteuerten-1 Notensatz'', Schott-Verlag, Mainz 1988. ISBN -3-7957-2886-x. 1) e(lektronischen) D(aten)v(erarbeitung). +zum EDV-gesteuerten Notensatz'', Schott-Verlag, Mainz 1988. ISBN +3-7957-2886-x. + +[I. A very thorough overview of engraving practices of various +craftsmen. It includes detailed specs of characters, dimensions etc. +II. a thorough overview of a (by now antiquated) automated system +called Ikarus; EDV Means e(lektronischen) D(aten)v(erarbeitung), +electronic data processing] Maxwell Weaner and Walter Boelke, Standard Music Notation Practice, revised edition by Arnold Broido and Daniel Dorff. Music Publisher's Association of the United States Inc., 1993. - + W.A. Hegazy and J. S. Gourlay. Optimal line breaking in music. In ``Document Manipulation and Typography'', J.C. van Vliet (ed) 1988. +[This generalizes TeX's breaking algorithm to music] + Ross, Ted. ``Teach yourself the art of music engraving and processing'' (3rd edition). Hansen House, Miami Beach, FL. @@ -45,15 +50,88 @@ Read, Gardner. ``Modern Rhythmic Notation.'' Indiana University Press, 1978. Read, Gardner. ``Music Notation'' (2nd edition). Taplinger Publishing, New York. - + [This is as close to the ``standard'' reference work for music notation issues as one is likely to get.] -The University of Colorado Music Engraving page. -http://www.cc.colorado.edu/cgi-bin/mfs/01/Dept/MU/Musicpress/Welcome.html +=head2 Related papers + +David A. Gomberg; A Computer-oriented System for Music Printing. +Computers and the Humanities, Vol.11, pp 63-80. + +J. Gourlay, ``Spacing a Line of Music,'' Technical Report +OSU-CISRC-10/87-TR35, Department of Computer and Information Science, +The Ohio State University, 1987. + +J. Gourlay, A. Parrish, D. Roush, F. Sola, Y. Tien, ``Computer +Formatting of Music,'' Technical Report OSU-CISRC-2/87-TR3, +Department of Computer and Information Science, The Ohio State +University, 1987. + +W. Hegazy, ``On the Implementation of the MusiCopy Language +Processor,'' Technical Report OSU-CISRC-10/87-TR34, Department of +Computer and Information Science, The Ohio State University, 1987. + +A. Parrish and J. Gourlay, ``Computer Formatting of Musical +Simultaneities,'' Technical Report OSU-CISRC-10/87-TR28, Department +of Computer and Information Science, The Ohio State University, 1987. + +D. Roush, ``Music Formatting Guidelines,'' Technical Report +OSU-CISRC-3/88-TR10, Department of Computer and Information Science, +The Ohio State University, 1988. + +F. Sola, ``Computer Design of Musical Slurs, Ties and Phrase +Marks,'' Technical Report OSU-CISRC-10/87-TR32, Department of +Computer and Information Science, The Ohio State University, 1987. + +F. Sola and D. Roush, ``Design of Musical Beams,'' Technical +Report OSU-CISRC-10/87-TR30, Department of Computer and Information +Science, The Ohio State University, 1987. + +J. S. Gourlay. A language for music printing. In ``Communications of +the ACM''. Vol. 29(5), 388--401, 1986. + +[This paper describes a vapourware music setting system and an input +language to go with it. ] + +D. Blostein and L. Haken, The Lime Music Editor: A Diagram Editor +Involving Complex Translations, Software Practice and Experience, +Vol. 24, No. 3, March 1994, pp. 289-306. + +[A description of various conversions, decisions and issues relating +to this interactive editor] + +L. Haken and D. Blostein, The Tilia Music Representation: +Extensibility, Abstraction, and Notation Contexts for the Lime Music +Editor, Computer Music Journal, Vol. 17, No. 3, 1993, pp. 43-58 + +[A description of Lime internals (which resemble LilyPond pre 0.0.68 +data structures somewhat)] + +L. Haken and D. Blostein, A New Algorithm for Horizontal Spacing of +Printed Music, International Computer Music Conference, Banff, +Sept. 1995, pp. 118-119. + +[This describes an algorithm which uses springs between adjacent +columns. This algorithm is a "subclass" of the LilyPond algorithm.] + +D. Blostein and L. Haken, Justification of Printed Music, +Communications of the ACM, VolJ34, No. 3, March 1991, pp. 88-99. + +[This paper provides a shallow overview of the algorithm used in LIME +for spacing individual lines.] =head2 Further reading +Chlapik, Herbert. ``Die Praxis des Notengraphikers''. Doblinger, 1987. +ISBN 3-9000 035-96-2. + +[An clearly written book for the casually interested reader. It shows +some of the conventions and difficulties in printing music] + +The University of Colorado Music Engraving page. +http://obenamots.cc.colorado.edu/cgi-bin/Musicpress/engraving.html + (of varying usefulness): Donato, Anthony. Preparing Music Manuscript. Englewood Cliffs: @@ -70,7 +148,10 @@ Praeger Publishers, 1972. Out of print. Roelofs, Ren\'e. ``Een Geautomatiseerd Systeem voor het Afdrukken van Muziek'' afstudeerscriptie Bestuurlijke informatica, no 45327, Erasmus universiteit Rotterdam, 1991. (``An automated system for printing -music'' Master's Thesis Management and Computer Science.) +music'' Master's Thesis Managerial Computer Science.) + +[This thesis describes a simplistic (monophonic) typesetting system, +and focuses on the breaking algorithm, which is taken from Hegazy & Gourlay] C. Roemer, The Art of Music Copying. Roerick music co., Sherman Oaks (CA), 1973. @@ -79,76 +160,41 @@ Rosecrans, Glen. Music Notation Primer. New York: Passantino, 1979. Stone, Kurt. Music Notation in the Twentieth Century. New York: Norton, 1980. - -=head2 On typesettig programs - -From: Miguel Filgueiras <mig@ncc.up.pt> - -... as well as other systems. I contribute with some references: - - -D. Blostein, L. Haken, The Lime Music Editor: a Diagram Editor -Involving Complex Translations. {\em -Software --- Practice and Experience}, Vol. 24(3), 289--306, 1994. - -Alexander Brinkman, {\em PASCAL Programming for Music Research}. -The University of Chicago Press, 1990. - -Miguel Filgueiras, Implementing a Symbolic Music Processing -System. LIACC, Universidade do Porto, 1996; submitted. - -Miguel Filgueiras, Some Music Typesetting Algorithms. LIACC, -Universidade do Porto, {\em forthcoming}. - - Miguel Filgueiras and Jos\'e Paulo Leal, A First Formulation of -\SceX, a Music Typesetting System. Centro de Inform\'atica da -Universidade do Porto, 1993. - -Miguel Filgueiras and Jos\'e Paulo Leal. Representation and -manipulation of music documents in \SceX. {\em Electronic Publishing}, -vol. 6 (4), 507--518, 1993. - -Eric Foxley, Music --- A language for typesetting music scores. {\em -Software --- Practice and Experience}, Vol. 17(8), 485--502, 1987. - -John S. Gourlay, A language for music printing. {\em Communications of -the ACM}, Vol. 29(5), 388--401, 1986. - -Cindy Grande, NIFF6a Notation Interchange File Format. -Grande Software Inc., 1995. {\tt ftp:blackbox.cartah.washington.edu} - -Fran\c{c}ois Jalbert, Mu\TeX\ User's Guide (Version $1.1$). Computer -Science Department, University of British Columbia, 1989. - -Peter S. Langston, Unix music tools at Bellcore. {\em -Software --- Practice and Experience}, Vol. 20(S1), S1/47--S1/61, 1990. +=head2 other stuff Andreas Mahling, J. Herczeg, M. Herczeg and S<H.-D.> B\"ocker, Beyond visualization: knowing and understanding. In P.~Gorny, M.~J. Tauber -(eds.), {\em Visualization in Human-Computer Interaction}, Lecture +(eds.), Visualization in Human-Computer Interaction, Lecture Notes in Computer Science, 439, 16--26, Springer-Verlag, 1990. -Jan Nieuwenhuizen, Using \TeX\ and the MusiX\TeX\ macro package to -write parts and scores of music. Department of Physics, Eindhoven -University of Technology, 1995. +Peter S. Langston, Unix music tools at Bellcore. +Software --- Practice and Experience, Vol. 20(S1), S1/47--S1/61, 1990. -Don Simons, PMX, A Preprocessor for MusiX\TeX\ (Version 1.04). -dsimons@logicon.com. +[This paper deals with some command-line tools for music editing and +playback. It doesn't mention notation issues, but does come with the +grand idea (not) of using music to monitor complex systems. Imagine your +nuclear plant supervisor to use AC/DC for checking the reactor] -Daniel Taupin. Music\TeX: Using \TeX\ to Write Polyphonic or -Instrumental Music (Version 5.17). Laboratoire de Physique des -Solides, Centre Universitaire, Orsay, 1996. +Cindy Grande, NIFF6a Notation Interchange File Format. +Grande Software Inc., 1995. ftp://blackbox.cartah.washington.edu/pub/ + +[Specs for NIFF, a comprehensive but binary (yuk) format for notation] -Daniel Taupin, Ross Mitchell and Andreas Egler, Musix\TeX: Using \TeX\ -to Write Polyphonic or Instrumental Music (Version T.64). Laboratoire -de Physique des Solides, Centre Universitaire, Orsay, 1993. +Miguel Filgueiras and Jos\'e Paulo Leal. Representation and +manipulation of music documents in SceX. Electronic Publishing, +vol. 6 (4), 507--518, 1993. -Barry Vercoe, Csound --- A Manual for the Audio Processing System and -Supporting Programs with Tutorials. Media Lab, M.I.T., Cambridge, -Massachusetts, 1986 (rev. 1992). +Eric Foxley, Music --- A language for typesetting music scores. +Software --- Practice and Experience, Vol. 17(8), 485--502, 1987. -Chris Walshaw, {\tt ABC2M\TeX} --- An easy way of transcribing folk -and traditional music. School of Maths, University of Greenwich, 1993. +[A paper on a TROFF preprocessor to typeset music. The output shown is +not very sophisticated, and contains some typographical atrocities] +Alexander Brinkman, PASCAL Programming for Music Research. +The University of Chicago Press, 1990. +Miguel Filgueiras, Implementing a Symbolic Music Processing +System. LIACC, Universidade do Porto, 1996; submitted. +Miguel Filgueiras, Some Music Typesetting Algorithms. LIACC, +Universidade do Porto, forthcoming. diff --git a/Documentation/mudela.pod b/Documentation/mudela.pod index cc82896924..633c9b588d 100644 --- a/Documentation/mudela.pod +++ b/Documentation/mudela.pod @@ -8,6 +8,10 @@ This document describes the the GNU LilyPond input format, which is an effective language for defining music. We call this language (rather arrogantly) The Musical Definition Language (S<Mudela 0.1>). +[If anybody comes up with a better name, we'd gladly take this Gourlay +already uses Musical Description Language, GSharp Score Definition +Language. We're not being original here] + The first aim of Mudela is to define a piece of music, being complete from both from a musical typesetting, as from a musical performing point of view. @@ -24,7 +28,7 @@ The below included for explanatory purposes only (i.e., for a complete and up-to-date definition, see F<lily/parser.y> and F<lily/lexer.l>): As a related note, you should take a look at the examples and the init -file, as this document does not cover every aspect of mudela yet, and +files, as this document does not cover every aspect of mudela yet, and may be out of date. =head2 Files diff --git a/Documentation/other-packages.pod b/Documentation/other-packages.pod new file mode 100644 index 0000000000..72d3a2bb3e --- /dev/null +++ b/Documentation/other-packages.pod @@ -0,0 +1,90 @@ +=head1 NAME + +Other-packages -- related packages + +=head1 DESCRIPTION + +A (not-at-all complete) overview of other music-typesetting/notation +packages. Feel free to add info (and mail it to me). Partly based on +a reflist by Miguel Filgueiras <mig@ncc.up.pt>. + +=head2 Free packages (with source) + +G Sharp, http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp + +Rosegarden, http://www.math.bath.ac.uk/~masjpf/rose.html + +Common Music/Common Notation, ftp://ccrma-ftp.stanford.edu/pub/Lisp + +Vivace + +MPP, http://www.stack.nl/~hanwen/mpp-english.html + +Jan Nieuwenhuizen, Using TeX and the MusiXTeX macro package to +write parts and scores of music. Department of Physics, Eindhoven +University of Technology, 1995. + + +MusE + +A-R Editions, Inc. + +Mup, http://www.arkkra.com/ + +A program which creates PS from a script input. Although it comes with +C source code, it is Shareware ($29). + +PMX + +Don Simons, PMX, A Preprocessor for MusiXTeX (Version 1.04). +dsimons@logicon.com. + +Musi*TeX, http://www.gmd.de/misc/music + +Daniel Taupin, Ross Mitchell and Andreas Egler, MusixTeX: Using TeX +to Write Polyphonic or Instrumental Music (Version T.64). Laboratoire +de Physique des Solides, Centre Universitaire, Orsay, 1993. + +ABC2MTeX + +Chris Walshaw, ABC2MTeX --- An easy way of transcribing folk +and traditional music. School of Maths, University of Greenwich, 1993. + +SceX + +Miguel Filgueiras and Jos\'e Paulo Leal, A First Formulation of +SceX, a Music Typesetting System. Centro de Inform\'atica da +Universidade do Porto, 1993. + +MUTEX + +Fran\ccois Jalbert, MuTeX User's Guide (Version 1.1). Computer +Science Department, University of British Columbia, 1989. + + +=head2 Free (zero cents) + +Calliope, http://www.cl.cam.ac.uk/users/wfc/ + +A NeXT package + +Mozart + +A windows package + +=head2 Proprietary + +LIME, http://datura.cerl.uiuc.edu/ + +Sibelius, http://www.acorn.co.uk/developers/sibelius + +Finale + +Score + +Musicator + +=head2 Unknown + +Berlioz, http://www.bsi.fr/~montel/ + diff --git a/INSTALL.text b/INSTALL.text index 5f6c2a4ece..128c028fac 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -28/May/97 LilyPond 0.0.67 1 +28/May/97 LilyPond 0.0.68 1 @@ -127,7 +127,7 @@ INSTALL(1) LilyPond documentation INSTALL(1) -28/May/97 LilyPond 0.0.67 2 +28/May/97 LilyPond 0.0.68 2 @@ -193,7 +193,7 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG -28/May/97 LilyPond 0.0.67 3 +28/May/97 LilyPond 0.0.68 3 @@ -259,7 +259,7 @@ WWWWIIIINNNNDDDDOOOOZZZZEEEE -28/May/97 LilyPond 0.0.67 4 +28/May/97 LilyPond 0.0.68 4 @@ -325,6 +325,6 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS -28/May/97 LilyPond 0.0.67 5 +28/May/97 LilyPond 0.0.68 5 @@ -1,3 +1,33 @@ +pl 68 + - doco: other-packages.pod, lots of lilyliterature.pod + - last duration mode now is default. + - some OpusTeX stuff. + - bf Y2K in convert-mudela + - Grand rewrite of Music/Register stuff: + * separation of Y and X-elt-groups + * Registers: info up: broadcasts, info down: get_xxx_info() + * Registers: try_request works from bottom to top of tree. + * Score_elem invisible_b_ flag + * Junk Staff_column, and find the requests while walking the + Voices. + * Score_register + * Staff_group, Score_request_register. + * align key/Meters/bar across staffs + * junked Staff, Staff_column, Staff_walker, Complex_walker, + Request_column Pulk_voice, Pulk_voices, Walker_registers, + Voice_element, + Input_score, Input_staff, Input_music and a lot of + parserjunk. + * mudela: lots of structure changes : now much simpler + * generation of pre/postbreak items now in Score_elem with deps. + + - bf: make_patch explanation + - bf: make install TeX stuff + - new Beam/Stem code (WL) + - mudela: . mandatory for REALs + +****** +june 3 pl 67 - sketch of Music classes - General_script_def as baseclass for Text_def and Script_def @@ -6,6 +6,13 @@ done, or is an idea that I want to think about Most of the items are marked in the code as well, with full explanation. grep for TODO and ugh/ugr +bugs introduced in pl68: + + * lyrics broken, + + * midi broken + + * scripts broken IMPORTANT @@ -26,6 +33,9 @@ IMPORTANT * a Hands on tutorial [HKN] PROJECTS + + * Convert all ref/bib stuff into BibTeX. + * Output class, handles : (smallish) - help text /(c) notice? - version line @@ -44,12 +54,14 @@ PROJECTS - poor man's ascii output possible? - MusixTeX output possible? (would have to be done before break calc.) - NIFF ? + - Common Music Notation - PostScript output (esp. Beams, Slurs, etc) - Move PScore, Items, Spanners etc. into libmutype.a * separate Score_elem settings in user-settable (properties - .. ) and non-user-settable part. + .. ) and non-user-settable part. Maybe use something like X-resources: + "Staff=oboe*dir: 0", "Staff=*.Voice_group=solo*dir: 1" * TeX spanners , use texbeam.cc as an example (smallish) - Glissando @@ -124,6 +136,8 @@ BUGS * stacked scripts. + * should adjust stemlength for flag number. + * lilypond - -> crash * standchen triool beam up/down @@ -147,8 +161,25 @@ FURTHER FOR ORCHESTRAL SCORE: INPUTLANGUAGE + * c4 4 4 4 for c4 c4 c4 c4? + + * neatly (and readably) expressing concurrent + voices + + * <c f a>4 ? + * should have \require{package.ly} to read req'd packages. + * Viola mode? + + @c c g e g + for + c g es g, + + @A c g e g + for + cis gis e gis + * relative mode for pitch entering * bracket (bracketplets) @@ -169,14 +200,14 @@ PROJECTS * Do RTTI i.s.o. static_name(), name() and request-junk. - * add remove() methods to all items/spanners. - SMALLISH PROJECTS * A range for context errors (eg. mark both { and }. ) * text in staff (sharpsharp in staff, text below) + * fix Egler definitions ( see tex/eglerdefs.tex ) + * replace Score_elem member access by get()/set() methods, to enable future embedded code. @@ -193,14 +224,14 @@ SMALLISH PROJECTS * bugreport to doc++ devel: struct not in class hier; public virtual baseclasses + * get rid of init_end; + * cleanup lily-proto.hh and proto.hh * half-sharps, half-flats * adaptive accidental spacing. - * Score_elem invisible_b_ flag - * unix style paths for LILYINCLUDE env * indentable stream as baseclass for TeX stream, lily stream, Dstream. @@ -243,8 +274,7 @@ SMALLISH PROJECTS * Brackets - * caching of Register_group_register hierarchies. - + * use (char *) iso. String for communication between lexer and parser. @@ -279,9 +309,6 @@ FUTURE * guitar chord - * Junk Staff_column, and find the requests while walking the - Voices.? - * better beamslope calculation: QLP for beams? * Text_crescendo @@ -319,13 +346,7 @@ IDEAS * Spacing_request for manually adjusting spacing - * Staff_group, Score_request_register. - - * Meters/bars should be aligned, which is difficult if - we get different keychanges in different staffs. - - * Horizontal_align item for meter,bar etc. - + * caching breakpoints * #c <-> cis @@ -337,10 +358,6 @@ IDEAS * default convert mudela-file.ly -> mudela-file.tex - rename {standchen,scsii-menuetto,...}.tex - * (related with above) --simple-mudela option for lily, - to lily input files with one-voice simple mudela - (no red tape) - * stack scripts in chords: % fingering: footing: < a-4 c-2 g-1 > < c-\ltoe e-\lheel > @@ -356,3 +373,4 @@ IDEAS (where "to" is a tiny bow) * move towards incremental algorithms. + diff --git a/bin/convert-mudela b/bin/convert-mudela index 00ad900cd5..4ae7f6f57c 100755 --- a/bin/convert-mudela +++ b/bin/convert-mudela @@ -3,6 +3,7 @@ =head1 TODO detect \lyrics and \melodic, and do substitution accordingly. + count <> and {} ? =cut @@ -15,16 +16,28 @@ -$convert_mudela_version = "0.1"; +$convert_mudela_version = "0.1.1"; use Getopt::Long; +sub cmpver +{ + + my(@a)= split /\./,$a; + my(@b)= split /\./,$b; + + for $i (0,1,2) { + return $a[$i] <=> $b[$i] if ($a[$i] != $b[$i]); + } + return $a cmp $b; +} + sub version_string_conv { my ($from_version, $to_version) = @_; - s/\version \"0.0.$from_version\"/\version \"0.0.$to_version\"/g; + s/\version \"$from_version\"/\version \"$to_version\"/g; } ################################################################ @@ -67,6 +80,10 @@ sub convert_0_0_57_to_0_0_58 s/\[ *([^\[\]]*)\] *([1-9]*) *\/ *([1-9]*)/[$2\/$3 $1]1\/1/g; } +sub convert_0_0_58_to_0_0_58 +{ + die "Not smart enough to convert 0.0.58 to 0.0.59\n"; +} ############################################################### sub last_conversion @@ -78,7 +95,7 @@ sub identify { print STDERR "This is convert-mudela " . $convert_mudela_version . - " (up to mudela version 0.0.", last_conversion, ")\n"; + " (up to mudela version ", last_conversion, ")\n"; } @@ -92,24 +109,25 @@ sub identify . " -h, --help print this help\n" . " -o, --output=FILE name output file\n" . " -s, --show-rules print all known conversion rules\n" - . " -t, --to=PATCHLEVEL convert to version 0.0.PATCHLEVEL\n" + . " -t, --to=VERSION convert to version VERSION\n" } -# beware of the year 2000 -my %minor_conversions = (50 => \&no_conv, - 52 => \&convert_0_0_50_to_0_0_52, - 53 => \&convert_0_0_52_to_0_0_53, - 54 => \&convert_0_0_53_to_0_0_54, - 55 => \&convert_0_0_54_to_0_0_55, - 56 => \&convert_0_0_55_to_0_0_56, - 57 => \&convert_0_0_56_to_0_0_57, - 58 => \&convert_0_0_57_to_0_0_58 + +my %minor_conversions = ("0.0.50" => \&no_conv, + "0.0.52" => \&convert_0_0_50_to_0_0_52, + "0.0.53" => \&convert_0_0_52_to_0_0_53, + "0.0.54" => \&convert_0_0_53_to_0_0_54, + "0.0.55" => \&convert_0_0_54_to_0_0_55, + "0.0.56" => \&convert_0_0_55_to_0_0_56, + "0.0.57" => \&convert_0_0_56_to_0_0_57, + "0.0.58" => \&convert_0_0_57_to_0_0_58, + "0.0.59" => \&convert_0_0_58_to_0_0_59 ); sub versions { - return (sort keys %minor_conversions); + return (sort keys %minor_conversions); } @@ -167,7 +185,6 @@ sub get_auto_from my $u; return $u; } - $ver =~ s/0\.0\.// ; close INLY; return $ver; } diff --git a/bin/make_patch b/bin/make_patch index a70faaeea5..4c98e9f35a 100755 --- a/bin/make_patch +++ b/bin/make_patch @@ -40,7 +40,18 @@ for a in lilypond.lsm INSTALL.text AUTHORS.text lilypond.spec configure; do rm `find $nm$old $nm$new -name $a` done -echo 'use cd source-dir; patch -E -p0 < this_patch'> patch-$new +cat <<EOF > patch-$new +Generated with + + make_patch $1 $2 $3 + +usage + + cd lilypond-source-dir; patch -E -p0 < patch-$new + +Patches do not contain automatically generated files, +i.e. you should rerun configure +EOF (cd $nm$new; diff -urN ../$nm$old . >> ../patch-$new) rm -rf $nm$old $nm$new diff --git a/bin/release b/bin/release index a52951ec32..be52176b4e 100755 --- a/bin/release +++ b/bin/release @@ -16,7 +16,7 @@ MI=$TOPLEVEL_MINOR_VERSION PA=$TOPLEVEL_PATCH_LEVEL MP=$TOPLEVEL_MY_PATCH_LEVEL NEWVER=$MJ.$MI.$PA$MP -if [ -z $MP ] +if [ -z $MP -o x$MP = xpre ] then LASTVER=$MJ.$MI.`expr $PA - 1` else @@ -642,7 +642,7 @@ if test $checking_b = no; then fi # however, C++ support in mingw32 v 0.1.4 is still flaky -if test $MINGWPREFIX != no; then // huh? +if test x$MINGWPREFIX != xno; then ICFLAGS="-I$MINGWPREFIX/include" ILDFLAGS="-$MINGWPREFIX/lib" fi @@ -941,12 +941,14 @@ fi + + for ac_prog in bison do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:950: checking for $ac_word" >&5 +echo "configure:952: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -980,7 +982,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:984: checking for $ac_word" >&5 +echo "configure:986: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1014,7 +1016,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1018: checking for $ac_word" >&5 +echo "configure:1020: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1048,7 +1050,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1052: checking for $ac_word" >&5 +echo "configure:1054: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_PODMAN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1084,7 +1086,7 @@ if test "x$TEXPREFIX" = xauto ; then echo $ac_n "checking TeX/MF root dir directory""... $ac_c" 1>&6 -echo "configure:1088: checking TeX/MF root dir directory" >&5 +echo "configure:1090: checking TeX/MF root dir directory" >&5 find_root_prefix="$prefix" @@ -1122,7 +1124,7 @@ if test "x$TEXDIR" = xauto ; then echo $ac_n "checking TeX input directory""... $ac_c" 1>&6 -echo "configure:1126: checking TeX input directory" >&5 +echo "configure:1128: checking TeX input directory" >&5 find_dirdir=`(cd $find_texprefix; $FIND ./ -type d -a -name tex -print |sort|head -1|sed 's#^\./##')` @@ -1144,7 +1146,7 @@ if test "x$MFDIR" = xauto; then echo $ac_n "checking MF input directory""... $ac_c" 1>&6 -echo "configure:1148: checking MF input directory" >&5 +echo "configure:1150: checking MF input directory" >&5 find_dirdir=`(cd $find_texprefix; $FIND ./ -type d -a -name source -print |sort|head -1|sed 's#^\./##')` @@ -1200,7 +1202,7 @@ else fi echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:1204: checking how to run the C++ preprocessor" >&5 +echo "configure:1206: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1213,12 +1215,12 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext <<EOF -#line 1217 "configure" +#line 1219 "configure" #include "confdefs.h" #include <stdlib.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1222: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1238,17 +1240,17 @@ echo "$ac_t""$CXXCPP" 1>&6 ac_safe=`echo "FlexLexer.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for FlexLexer.h""... $ac_c" 1>&6 -echo "configure:1242: checking for FlexLexer.h" >&5 +echo "configure:1244: checking for FlexLexer.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1247 "configure" +#line 1249 "configure" #include "confdefs.h" #include <FlexLexer.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1650,7 +1652,7 @@ fi eval "DIR_DATADIR=$datadir" DIR_DATADIR="$DIR_DATADIR/lilypond" echo $ac_n "checking ""... $ac_c" 1>&6 -echo "configure:1654: checking " >&5 +echo "configure:1656: checking " >&5 cat << EOF > lib/out/config.hh diff --git a/configure.in b/configure.in index 570f8866d2..dbaf1cd095 100644 --- a/configure.in +++ b/configure.in @@ -141,7 +141,7 @@ if test $checking_b = no; then fi # however, C++ support in mingw32 v 0.1.4 is still flaky -if test $MINGWPREFIX != no; then // huh? +if test x$MINGWPREFIX != xno; then ICFLAGS="-I$MINGWPREFIX/include" ILDFLAGS="-$MINGWPREFIX/lib" fi @@ -165,6 +165,8 @@ if test FIND = error; then AC_MSG_WARN(Couldn't find \`find'. Please use --enable-tex-dir) fi +AC_SUBST(CXXFLAGS) +AC_SUBST(CPPFLAGS) AC_SUBST(CXX) AC_SUBST(ICFLAGS) AC_SUBST(ILDFLAGS) diff --git a/flower/full-storage.cc b/flower/full-storage.cc index e9fb1f3ca5..0a7bf4efbe 100644 --- a/flower/full-storage.cc +++ b/flower/full-storage.cc @@ -213,3 +213,5 @@ Full_storage::try_right_multiply(Matrix_storage * dest, Matrix_storage const * r } IMPLEMENT_STATIC_NAME(Full_storage); IMPLEMENT_STATIC_NAME(Matrix_storage); +IMPLEMENT_IS_TYPE_B(Matrix_storage); +IMPLEMENT_IS_TYPE_B1(Full_storage,Matrix_storage); diff --git a/flower/include/cursor.hh b/flower/include/cursor.hh index c1fb23c183..05a3e897c4 100644 --- a/flower/include/cursor.hh +++ b/flower/include/cursor.hh @@ -42,7 +42,10 @@ class Cursor int operator -(Cursor<T> op) const; Cursor<T> operator -=(int); Cursor<T> operator +=(int); - + /// move one down + void next(); + /// move one up. + void previous(); /// return current and move one down Cursor<T> operator ++( int ); diff --git a/flower/include/cursor.icc b/flower/include/cursor.icc index 3390d69026..6a2ae6c538 100644 --- a/flower/include/cursor.icc +++ b/flower/include/cursor.icc @@ -108,25 +108,37 @@ Cursor<T>::ok()const { return ( pointer_ != 0 ); } - +template<class T> +inline void +Cursor<T>::next() +{ + assert( pointer_ ); + pointer_ = pointer_->next(); +} template<class T> inline Cursor<T> Cursor<T>::operator ++( int ) { Cursor<T> r (*this); - assert( pointer_ ); - pointer_ = pointer_->next(); + next(); return r; } template<class T> +inline void +Cursor<T>::previous() +{ + assert( pointer_ ); + pointer_ = pointer_->previous(); +} + +template<class T> inline Cursor<T> Cursor<T>::operator --( int ) { Cursor<T> r (*this); - assert( pointer_ ); - pointer_ = pointer_->previous(); + previous(); return r; } diff --git a/flower/include/pcursor.hh b/flower/include/pcursor.hh index 6144152614..6c9ceff0d7 100644 --- a/flower/include/pcursor.hh +++ b/flower/include/pcursor.hh @@ -25,6 +25,9 @@ public: Cursor<void*>::ok; Cursor<void*>::del; Cursor<void*>::backspace; + Cursor<void*>::next; + Cursor<void*>::previous; + T remove_p() { T p = ptr(); Cursor<void*>::del(); diff --git a/flower/include/virtual-methods.hh b/flower/include/virtual-methods.hh index fa6b5df9d4..f38d852934 100644 --- a/flower/include/virtual-methods.hh +++ b/flower/include/virtual-methods.hh @@ -16,6 +16,7 @@ */ #define NAME_MEMBERS() \ static char const *static_name();\ +virtual bool is_type_b(const char *)const; \ virtual char const *name() const{ return static_name(); } \ int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out() @@ -25,5 +26,21 @@ int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out() #define VIRTUAL_COPY_CONS(T, R)\ virtual R *clone() const { return new T(*this); } \ - +#define IMPLEMENT_IS_TYPE_B(D) \ + bool D::is_type_b(const char *s) const \ +{ \ + return s == static_name(); \ +} + +#define IMPLEMENT_IS_TYPE_B1(D,B) \ + bool D::is_type_b(const char *s)const \ +{ \ + return s == static_name() || B::is_type_b(s); \ +} +#define IMPLEMENT_IS_TYPE_B2(D, BA, BB) \ + bool D::is_type_b(const char *s) const \ +{ \ + return s == static_name() || BA::is_type_b(s) || BB::is_type_b(s); \ +} + #endif // CLASS-NAME_HH diff --git a/init/register.ini b/init/register.ini index 703b092e65..4b8d324fa9 100644 --- a/init/register.ini +++ b/init/register.ini @@ -1,33 +1,44 @@ % -melodicregs = \inputregister { - Staff_registers - \inputregister {Bar_register} - \inputregister {Clef_register} - \inputregister {Key_register} - \inputregister {Meter_register} - \inputregister {Local_key_register} - \inputregister { Staff_sym_register } - \inputregister { Collision_register } - \inputregister { Rest_collision_register } - \inputregister { - Voice_group_registers - \inputregister { Dynamic_register } - \inputregister { Stem_beam_register } - \inputregister { Text_register } - \inputregister { Script_register } - \inputregister { Note_column_register } - \inputregister { Slur_register } - \inputregister { Voice_registers - \inputregister { Note_head_register } - \inputregister { Tie_register } +\requestregister { + "Score_register" + \alias "Score"; +% \consists "Score_bar_register"; + \consists "Bar_align_register"; + \consists "Clef_align_register"; + \consists "Key_align_register"; + \consists "Meter_align_register"; + \consists "Score_horizontal_align_register"; + + \contains\requestregister { + "Staff_registers" + + \consists "Bar_register"; + \consists "Clef_register"; + \consists "Key_register"; + \consists "Meter_register"; + \consists "Local_key_register"; + \consists "Staff_sym_register"; + \consists "Collision_register"; + \consists "Rest_collision_register"; + \contains \requestregister { + "Voice_group_registers" + \alias "Voice_group"; + \consists "Dynamic_register"; + \consists "Stem_beam_register"; + \consists "Text_register"; + \consists "Script_register"; + \consists "Note_column_register"; + \consists "Slur_register"; + \contains \requestregister { + "Voice_registers" + \alias "Voice"; + \consists "Note_head_register" ; + \consists "Tie_register"; + } } } } -lyricregs = \inputregister { - Lyric_register % ugh. - \inputregister { Lyric_register } - \inputregister { Swallow_register } - -} + + diff --git a/init/symbol.ini b/init/symbol.ini index 9bab84d8af..adea156028 100644 --- a/init/symbol.ini +++ b/init/symbol.ini @@ -1,4 +1,4 @@ -\version "0.0.58"; +\version "0.0.59"; \include "register.ini" \include "dynamic.ini" @@ -7,4 +7,5 @@ \include "table_sixteen.ini" +%% Fix Me. This sux. \init_end ; diff --git a/init/table_sixteen.ini b/init/table_sixteen.ini index 58f2ef25a7..b331826f55 100644 --- a/init/table_sixteen.ini +++ b/init/table_sixteen.ini @@ -12,36 +12,36 @@ table_sixteen= % index TeXstring, xmin xmax ymin ymax "scripts" = \table { - "fermata" "\fermata" 0\pt 0\pt 0\pt 6\pt - "-fermata" "\ifermata" 0\pt 0\pt -6\pt 0\pt - "portato" "\portato" 0\pt 4.8\pt 0\pt 2\pt - "-portato" "\iportato" 0\pt 4.8\pt -2\pt 0\pt - "tenuto" "\tenuto" 0\pt 4.8\pt 0\pt 1\pt - "-tenuto" "\itenuto" 0\pt 4.8\pt -1\pt 0\pt + "fermata" "\fermata" 0.0\pt 0.0\pt 0.0\pt 6.0\pt + "-fermata" "\ifermata" 0.0\pt 0.0\pt -6.0\pt 0.0\pt + "portato" "\portato" 0.0\pt 4.8\pt 0.0\pt 2.0\pt + "-portato" "\iportato" 0.0\pt 4.8\pt -2.0\pt 0.0\pt + "tenuto" "\tenuto" 0.0\pt 4.8\pt 0.0\pt 1.0\pt + "-tenuto" "\itenuto" 0.0\pt 4.8\pt -1.0\pt 0.0\pt "sforzato" "\sforzato" -0.8\pt 4.8\pt -1.92\pt 1.92\pt - "marcato" "\marcato" 0\pt 4.8\pt 0\pt 4\pt - "-marcato" "\imarcato" 0\pt 4.8\pt -4\pt 0\pt - "staccato" "\staccato" 0\pt 0\pt 0\pt 5\pt - "staccatissimo" "\staccatissimo" 0\pt 0\pt 0\pt 1\pt - "-staccatissimo" "\istaccatissimo" 0\pt 0\pt 0\pt 1\pt - "upbow" "\upbow" -1\pt 6\pt 0\pt 5\pt - "downbow" "\downbow" 0\pt 5\pt 0\pt 7.5\pt - "back" "\backorfront" 0\pt 6\pt 0\pt 3\pt - "-front" "\backorfront" 0\pt 6\pt 0\pt 3\pt - "heel" "\heel" 0\pt 6\pt -1\pt 5\pt - "toe" "\toe" 0\pt 6\pt -1\pt 5\pt - "bheel" "\bheel" 0\pt 6\pt -1\pt 5\pt - "btoe" "\btoe" 0\pt 6\pt -1\pt 5\pt - "fheel" "\fheel" 0\pt 6\pt -1\pt 5\pt - "ftoe" "\ftoe" 0\pt 6\pt -1\pt 5\pt - "-back" "\backorfront" 0\pt 6\pt 0\pt 3\pt - "front" "\backorfront" 0\pt 6\pt 0\pt 3\pt + "marcato" "\marcato" 0.0\pt 4.8\pt 0.0\pt 4.0\pt + "-marcato" "\imarcato" 0.0\pt 4.8\pt -4.0\pt 0.0\pt + "staccato" "\staccato" 0.0\pt 0.0\pt 0.0\pt 5.0\pt + "staccatissimo" "\staccatissimo" 0.0\pt 0.0\pt 0.0\pt 1.0\pt + "-staccatissimo" "\istaccatissimo" 0.0\pt 0.0\pt 0.0\pt 1.0\pt + "upbow" "\upbow" -1.0\pt 6.0\pt 0.0\pt 5.0\pt + "downbow" "\downbow" 0.0\pt 5.0\pt 0.0\pt 7.5\pt + "back" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt + "-front" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt + "heel" "\heel" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "toe" "\toe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "bheel" "\bheel" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "btoe" "\btoe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "fheel" "\fheel" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "ftoe" "\ftoe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "-back" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt + "front" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt } "style" = \table { - "roman" "\settext{%}" 0\pt 5\pt 0\pt 8\pt - "italic" "\setitalic{%}" 0\pt 0\pt 0\pt 8\pt - "dynamic" "\setdynamic{%}" 0\pt 0\pt 0\pt 8\pt + "roman" "\settext{%}" 0.0\pt 5.0\pt 0.0\pt 8.0\pt + "italic" "\setitalic{%}" 0.0\pt 0.0\pt 0.0\pt 8.0\pt + "dynamic" "\setdynamic{%}" 0.0\pt 0.0\pt 0.0\pt 8.0\pt } "dynamics" = \table { @@ -62,20 +62,20 @@ table_sixteen= } "clefs" = \table { - "violin" "\violinclef" 0\pt 12.8\pt -10\pt 18\pt - "bass" "\bassclef" 0\pt 12.8\pt 0\pt 16\pt - "alto" "\altoclef" 0\pt 12.8\pt 0\pt 16\pt - "tenor" "\altoclef" 0\pt 12.8\pt 0\pt 16\pt - "violin_change" "\cviolinclef" 0\pt 11.2\pt -12\pt 12\pt - "bass_change" "\cbassclef" 0\pt 11.2\pt 0\pt 16\pt - "alto_change" "\caltoclef" 0\pt 11.2\pt 0\pt 16\pt - "tenor_change" "\caltoclef" 0\pt 11.2\pt 0\pt 16\pt + "violin" "\violinclef" 0.0\pt 12.8\pt -10.0\pt 18.0\pt + "bass" "\bassclef" 0.0\pt 12.8\pt 0.0\pt 16.0\pt + "alto" "\altoclef" 0.0\pt 12.8\pt 0.0\pt 16.0\pt + "tenor" "\altoclef" 0.0\pt 12.8\pt 0.0\pt 16.0\pt + "violin_change" "\cviolinclef" 0.0\pt 11.2\pt -12.0\pt 12.0\pt + "bass_change" "\cbassclef" 0.0\pt 11.2\pt 0.0\pt 16.0\pt + "alto_change" "\caltoclef" 0.0\pt 11.2\pt 0.0\pt 16.0\pt + "tenor_change" "\caltoclef" 0.0\pt 11.2\pt 0.0\pt 16.0\pt } "balls" = \table { - "1" "\wholeball" 0\pt 6\pt -2 \pt 2\pt - "2" "\halfball" 0\pt 5\pt -2 \pt 2\pt - "4" "\quartball" 0\pt 5\pt -2 \pt 2\pt + "1" "\wholeball" 0.0\pt 6.0\pt -2.0\pt 2.0\pt + "2" "\halfball" 0.0\pt 5.0\pt -2.0\pt 2.0\pt + "4" "\quartball" 0.0\pt 5.0\pt -2.0\pt 2.0\pt } "slur" = \table { @@ -83,73 +83,73 @@ table_sixteen= "half" "\hslurchar%{%}" } "accidentals" = \table { - "-2" "\flatflat" 0\pt 8.16\pt -2.5\pt 7.5\pt - "-1" "\flat" 0\pt 4.8\pt -2.5\pt 7.5\pt - "0" "\natural" 0\pt 4.8\pt -7.5\pt 7.5\pt - "1" "\sharp" 0\pt 3.6\pt -7.5\pt 7.5\pt - "2" "\sharpsharp" 0\pt 4.8\pt -2.5\pt 7.5\pt + "-2" "\flatflat" 0.0\pt 8.16\pt -2.5\pt 7.5\pt + "-1" "\flat" 0.0\pt 4.8\pt -2.5\pt 7.5\pt + "0" "\natural" 0.0\pt 4.8\pt -7.5\pt 7.5\pt + "1" "\sharp" 0.0\pt 3.6\pt -7.5\pt 7.5\pt + "2" "\sharpsharp" 0.0\pt 4.8\pt -2.5\pt 7.5\pt } "streepjes" = \table { - "toplines" "\toplines{%}" -1\pt 7\pt 0\pt 0\pt - "botlines" "\botlines{%}" -1\pt 7\pt 0\pt 0\pt + "toplines" "\toplines{%}" -1.0\pt 7.0\pt 0.0\pt 0.0\pt + "botlines" "\botlines{%}" -1.0\pt 7.0\pt 0.0\pt 0.0\pt } "bars" = \table { "empty" "\emptybar" - "|" "\maatstreep" 0\pt 0.4\pt -8\pt 8\pt - "||" "\doublebar" 0\pt 4\pt -8\pt 8\pt - "|." "\finishbar" -4\pt 0\pt -8\pt 8\pt - ":|" "\repeatbar" -4\pt 0\pt -8\pt 8\pt - "|:" "\startrepeat" 0\pt 4\pt -8\pt 8\pt - ":|:" "\repeatbarstartrepeat" 0\pt 16\pt -8\pt 8\pt + "|" "\maatstreep" 0.0\pt 0.4\pt -8.0\pt 8.0\pt + "||" "\doublebar" 0.0\pt 4.0\pt -8.0\pt 8.0\pt + "|." "\finishbar" -4.0\pt 0.0\pt -8.0\pt 8.0\pt + ":|" "\repeatbar" -4.0\pt 0.0\pt -8.0\pt 8.0\pt + "|:" "\startrepeat" 0.0\pt 4.0\pt -8.0\pt 8.0\pt + ":|:" "\repeatbarstartrepeat" 0.0\pt 16.0\pt -8.0\pt 8.0\pt } "rests" = \table { - "1" "\wholerest" 0\pt 6\pt 0\pt 2\pt - "2" "\halfrest" 0\pt 6\pt -2\pt 0\pt - "4" "\quartrest" -5\pt 2\pt -5\pt 5\pt - "8" "\eighthrest" 0\pt 5\pt 0\pt 8\pt - "16" "\sixteenthrest" 0\pt 6\pt 0\pt 12\pt - "32" "\thirtysecondrest" 0\pt 6\pt 0\pt 16\pt - "64" "\sixtyfourthrest" 0\pt 6\pt 0\pt 16\pt - "128" "\hundredtwentyeighthrest" 0\pt 6\pt 0\pt 16\pt + "1" "\wholerest" 0.0\pt 6.0\pt 0.0\pt 2.0\pt + "2" "\halfrest" 0.0\pt 6.0\pt -2.0\pt 0.0\pt + "4" "\quartrest" -5.0\pt 2.0\pt -5.0\pt 5.0\pt + "8" "\eighthrest" 0.0\pt 5.0\pt 0.0\pt 8.0\pt + "16" "\sixteenthrest" 0.0\pt 6.0\pt 0.0\pt 12.0\pt + "32" "\thirtysecondrest" 0.0\pt 6.0\pt 0.0\pt 16.0\pt + "64" "\sixtyfourthrest" 0.0\pt 6.0\pt 0.0\pt 16.0\pt + "128" "\hundredtwentyeighthrest" 0.0\pt 6.0\pt 0.0\pt 16.0\pt } "meters" = \table { - "C" "\fourfourmeter" 0\pt 10\pt -5\pt 5\pt - "C2" "\allabreve" 0\pt 10\pt -5\pt 5\pt + "C" "\fourfourmeter" 0.0\pt 10.0\pt -5.0\pt 5.0\pt + "C2" "\allabreve" 0.0\pt 10.0\pt -5.0\pt 5.0\pt } % dims ignored for this table "param" = \table { - "meter" "\generalmeter{%}{%}" 0\pt 10\pt -5\pt 5\pt + "meter" "\generalmeter{%}{%}" 0.0\pt 10.0\pt -5.0\pt 5.0\pt "linestaf" "\linestafsym{%}{%}" "stem" "\stem{%}{%}" "fill" "\hbox{}" % ugh. 8pt - "crescendosym" "\crescendosym{%}" 0\pt 0\pt -3\pt 3\pt - "decrescendosym" "\decrescendosym{%}" 0\pt 0\pt -3\pt 3\pt + "crescendosym" "\crescendosym{%}" 0.0\pt 0.0\pt -3.0\pt 3.0\pt + "decrescendosym" "\decrescendosym{%}" 0.0\pt 0.0\pt -3.0\pt 3.0\pt } "dots" = \table { - "1" "\lsingledot" 0\pt 2\pt -1\pt 1\pt - "2" "\ldoubledot" 0\pt 5\pt -1\pt 1\pt - "3" "\ltripledot" 0\pt 8\pt -1\pt 1\pt + "1" "\lsingledot" 0.0\pt 2.0\pt -1.0\pt 1.0\pt + "2" "\ldoubledot" 0.0\pt 5.0\pt -1.0\pt 1.0\pt + "3" "\ltripledot" 0.0\pt 8.0\pt -1.0\pt 1.0\pt } "flags" = \table { - "8" "\eighthflag" 0\pt 4\pt 0\pt 0\pt - "16" "\sixteenthflag" 0\pt 4\pt 0\pt 0\pt - "32" "\thirtysecondflag" 0\pt 4\pt 0\pt 0\pt - "64" "\sixtyfourthflag" 0\pt 4\pt 0\pt 0\pt - "128" "\hundredtwentyeighthflag" 0\pt 4\pt 0\pt 0\pt - "-8" "\deighthflag" 0\pt 4\pt 0\pt 0\pt - "-16" "\dsixteenthflag" 0\pt 4\pt 0\pt 0\pt - "-32" "\dthirtysecondflag" 0\pt 4\pt 0\pt 0\pt - "-64" "\dsixtyfourthflag" 0\pt 4\pt 0\pt 0\pt - "-128" "\dhundredtwentyeighthflag" 0\pt 4\pt 0\pt 0\pt + "8" "\eighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "16" "\sixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "32" "\thirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "64" "\sixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "128" "\hundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-8" "\deighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-16" "\dsixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-32" "\dthirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-64" "\dsixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-128" "\dhundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt } "beamslopes" = \table { diff --git a/input/cadenza.ly b/input/cadenza.ly index d8d758be8b..bcee0b0eb7 100644 --- a/input/cadenza.ly +++ b/input/cadenza.ly @@ -10,7 +10,7 @@ EndMudelaHeader %} -\version "0.0.58"; +\version "0.0.59"; cad = \melodic { @@ -56,10 +56,10 @@ cad = \melodic { } \score { - \staff { melodicregs cad } + \melodic{ \cad } \paper { - \unitspace 14\mm + \unitspace 14.0\mm \geometric 1.4} \midi { \tempo 4:90 } } diff --git a/input/collisions.ly b/input/collisions.ly index 65057eb784..d021f6e278 100644 --- a/input/collisions.ly +++ b/input/collisions.ly @@ -10,22 +10,21 @@ Tested Features:test the Collision resolution EndMudelaHeader %} -\version "0.0.58"; +\version "0.0.59"; -two_voice = \melodic { - < \multivoice - { \octave c'; \stem -1;\duration "last"; +two_voice = \melodic + < \multi 2; + { \octave c'; \stem -1; c4 d e f g2~ g4 a [c8 d e f] c2| } { \stem 1; g4 f e g ~ g2 g2 c4 g4 g2 } > -} -two_voice_steminvert = \melodic { - < \multivoice +two_voice_steminvert = \melodic + < \multi 2; { \octave c'; \stem 1; % the f and g on 4th beat are exceptionally ugh. c4 d e f g2 g4 a | } @@ -33,9 +32,9 @@ two_voice_steminvert = \melodic { g4 f e g g2 g2 } > -} -three_voice = \melodic { - < \multivoice + +three_voice = \melodic + < \multi 2; { \stem 1; g4 f e f g a g2 } { \hshift 1; \stem 1; @@ -43,10 +42,10 @@ three_voice = \melodic { { \stem -1; c4 d e d c d es } > -} -rests = \melodic { - < \multivoice + +rests = \melodic + < \multi 2; { \stem 1; | r8 r r r r r r r [c' b a g] [f e d c] @@ -56,13 +55,13 @@ rests = \melodic { r r r r r r r r r } > -} + \score{ - \staff{ melodicregs - \melodic { \$two_voice ++ \$two_voice_steminvert - ++ \$three_voice ++ \rests + + \melodic { \$two_voice \$two_voice_steminvert + \$three_voice \rests } - } + \paper {} % \midi { \tempo 4:80 } } diff --git a/input/coriolan-alto.ly b/input/coriolan-alto.ly index 87b22fc1ba..439ccfb0f6 100644 --- a/input/coriolan-alto.ly +++ b/input/coriolan-alto.ly @@ -21,7 +21,6 @@ EndMudelaHeader alto = \melodic{ \meter 4/4; - \duration 8 ; \key bes es as; \clef "alto"; @@ -31,13 +30,13 @@ alto = \melodic{ < { \octave c ; - [ c c-. ] c2.( | + [ c8 c-. ] c2.( | %31 - [ ) c c-. ] c2.( | + [ ) c8 c-. ] c2.( | %32 - [ ) c c-. ] c4. c-. c4( | + [ ) c8 c-. ] c4. c-. c4( | %33 - [ ) c c-. ] c4. c-. c4 + [ ) c8 c-. ] c4. c-. c4 \group "+bla"; \stem 1 ;[ c16^"div." c16 c16 c16 ] c4 c2 \group "-"; @@ -53,11 +52,11 @@ alto = \melodic{ - \ \ \ \ - \ \ \ \ -" ] c2.( | \textstyle "roman"; %31:2 - [ ) c c-. ] c2.( | + [ ) c8 c-. ] c2.( | %32:2 - [ ) c c-. ] c4. c-. c4( | + [ ) c8 c-. ] c4. c-. c4( | %33:2 - [ ) c c-. ] c4. c-. c4 | + [ ) c8 c-. ] c4. c-. c4 | \octave c ; %34 diff --git a/input/kortjakje.ly b/input/kortjakje.ly index 409fe49eba..95e8187dd9 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -3,14 +3,14 @@ filename: kortjakje.ly title: Ah, vous dirais-je, maman (variations) description: bare bones version. (written down from memory :-) - composers:Mozart, KV 265 + composers: Mozart, KV 265 entered-by: HWN copyright: none Tested Features: example file with comments EndMudelaHeader %} -\version "0.0.58"; +\version "0.0.59"; % the % is a comment. @@ -24,20 +24,20 @@ melodie = \melodic { \octave c'; % set the default octave % the default note duratino is 4 %%% theme - c c | % the '|' checks if there is a new measure here. + c4 c | % the '|' checks if there is a new measure here. g g| a a| g2| % g2 means a "g-1" pitched half-note - f f| e e| d d| c2 - g g| f f| e e| d d| g g| f f| e e| d d| + f4 f| e e| d d| c2 + g4 g| f f| e e| d d| g g| f f| e e| d d| %%% var 1 - c r8 c8 % r8 means an 8th rest. + c4 r8 c % r8 means an 8th rest. (| % start a slur % NOTE: the slurstart should be directly after the note ) % end a slur. - g r8 g8 () a r8 a8 () g r4 - f r8 f8 () e4 r8 e8 (|) d4 r8 d8 () c4 r4 + g4 r8 g8 () a4 r8 a8 () g4 r4 + f4 r8 f8 () e4 r8 e8 (|) d4 r8 d8 () c4 r4 } % more of this. @@ -47,19 +47,22 @@ begeleiding = \melodic{ \octave c'; % default octave: 1 below the first octave. %%% theme - 'c % ' before note means one octave lower. + 'c4 % ' before note means one octave lower. % Similarly: ' after means one higher. - c e c f c e c d 'b c 'a 'f 'g 'c2 + c e c f c e c d 'b c 'a 'f 'g 'c2 | \octave 'c ; - e 'g d 'g c 'g 'b 'g e 'g d 'g c 'g 'b 'g + e4 'g d 'g c 'g 'b 'g e 'g d 'g c 'g 'b 'g %%%% var 1 - r8 e8() c r8 e8() c r8 f8() c r8 e8() c - r8 d8() 'b r8 c8() 'a r8 'a8() 'f r8 'e8() 'c + r8 e8() c4 r8 e8() c4 r8 f8() c4 r8 e8() c4 + r8 d8() 'b4 r8 c8() 'a4 r8 'a8() 'f4 r8 'e8() 'c4 } \score{ - \staff{ melodicregs melodie } - \staff{ melodicregs begeleiding } + \melodic < \multi 3; + + \melodie + \begeleiding + > \paper{ \unitspace 2.5\cm % a whole note takes 2.5 \cm ideally. } diff --git a/input/multi.ly b/input/multi.ly new file mode 100644 index 0000000000..bb0fd590d3 --- /dev/null +++ b/input/multi.ly @@ -0,0 +1,13 @@ + +% stupid testfile for pl68 features. + +\score{ + \melodic + { \octave c'; c4 c4 + < \multi 1; { c2 c2 } { c'2 c'2 } > + < \multi 2; { \stem -1; c2 c2 } { \stem 1; c'2 c'2 } > + < \multi 3; { \clef "bass"; c2 c2 } { \bar "||"; \key cis ; c'2 c'2 } > + % c1 c1 % bug + + } +} diff --git a/input/scales.ly b/input/scales.ly index 2ccad6c895..3581515338 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -2,21 +2,19 @@ % scales with accents. % -\version "0.0.58"; -blah = \staff{ melodicregs - \melodic { +\version "0.0.59"; +blah = \melodic { \meter 6/8; - \duration 4.; \octave 'c ; - \clef "bass"; - c d + \clef "bass"; + c4. d \octave c ; c d \clef "violin" ; \octave c' ; - ++ \transpose { d { e f } } ++ + \transpose d { e f } \octave c'' ; - c d + c d \duration 8 ; %ugr |[6/9 a \< a a a a a a \! a a \ff \> ]1/1 @@ -66,7 +64,7 @@ c1 } \score{ - blah + \melodic {\blah} \paper{ \symboltables {table_sixteen} \unitspace 1.5 \cm diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly index 9ff18deb97..f52ea765c6 100644 --- a/input/scsii-menuetto.ly +++ b/input/scsii-menuetto.ly @@ -12,7 +12,8 @@ EndMudelaHeader %} -\version "0.0.58"; +\version "0.0.59"; + %% Stuff from MPP version % \lefttitle{Menuetto} % \tempo{Moderato} @@ -24,7 +25,7 @@ EndMudelaHeader % \stemlength3 % shorter \stemlength % % because piece is set very tightly -ii_menuetto = \melodic{ +IImenuetto = \melodic{ \clef"alto"; \meter 3/4; \key bes; @@ -58,14 +59,14 @@ ii_menuetto = \melodic{ %%10 < [ e' g > d' cis'_"2" e' a~ g ] | %%11 - < \multivoice + < \multi 2; {\stem 1; a4~ d'4 cis'4-. } { \stem -1; f2 e4 } > | %%12 < [ g'^"4" d > f' e' f' d'^"3"~ c' ] | %%13 \clef "alto"; - < \multivoice + < \multi 2; { \stem 1; bes2 c'4 } { \stem -1; g4~ f4 e4 }% ugh > | @@ -84,7 +85,7 @@ ii_menuetto = \melodic{ %%20 < { [ c'( bes a )bes g~ bes ] } { [ d ] } { [ g ] } > | %%21 - < \multivoice + < \multi 2; {\stem 1; d'4 (\stem 1; ) cis'4 d'4 } { \stem -1; g2 f4 } > | @@ -100,11 +101,11 @@ ii_menuetto = \melodic{ } \score{ - \staff{ melodicregs ii_menuetto } + \melodic { \IImenuetto } \paper{ - \width 195\mm - \unitspace 9\mm % to get lily to use only three lines - \geometric 1.4 + \width 195.0\mm + \unitspace 9.0\mm % to get lily to use only three lines + \geometric 1.40 \output "scsii-menuetto.out" } \midi{ diff --git a/input/toccata-fuga-E.ly b/input/toccata-fuga-E.ly index 19c862d90e..ab665b4e85 100644 --- a/input/toccata-fuga-E.ly +++ b/input/toccata-fuga-E.ly @@ -20,19 +20,18 @@ EndMudelaHeader %} -\version "0.0.58"; +\version "0.0.59"; toccata_commands = \melodic{ \meter 4/4; \key fis cis gis dis; % E-major } -%toccata_right = \melodic \$toccata_commands { toccata_right = \melodic{ - \$toccata_commands ++ + \$toccata_commands % 13 -- how to type -- where to split -- this more neatly ? \octave c'; - <\multivoice + <\multi 2; { \stem 1; r4 dis'4 e'4.-. e'8( | \hshift 1; )e'4 [d'8 fis'8] \hshift 0; gis'4 [gis'8 fis'16 e'16] | fis'4~ [fis'8 e'16 dis'16] e'4 r8 e'8 } { \stem 1; \hshift 1; r4 bis4 cis'4-. cis'4 | \hshift 0; a'4~ [a'16 gis'16 a'16 b'16] \hshift 1; dis'4 cis'4~ [cis'8 dis'16 a16] bis4 cis'4 r8 b8 } { \stem -1; r4 < gis4 fis4 dis4 > gis4-. gis4 | a4. cis'8 gis2 | fis4 gis4 gis4 r8 e8 } @@ -41,11 +40,11 @@ toccata_right = \melodic{ } toccata_left = \melodic{ - \$toccata_commands ++ + \$toccata_commands \octave c; \clef bass; % 13 - <\multivoice + <\multi 2; { \stem 1; bis2 cis'4-. cis'4~ [cis'8 a8 d'8 cis'8] [bis8 gis8] cis'4 | dis'2 cis'4 r8 cis'8 } { \stem 1; \hshift 1; r4 gis4. gis8~ gis4 | \stem -1; \hshift 0; a4. fis8 gis4. a8~ a4 gis4-. gis4 r8 gis8 } { \stem -1; r4 < dis4 fis4 > < cis4 e4 > } @@ -54,7 +53,7 @@ toccata_left = \melodic{ } toccata_pedal = \melodic{ - \$toccata_commands ++ + \$toccata_commands \octave c; \clef bass; % 13 @@ -72,10 +71,10 @@ fuga2_commands = \melodic{ } fuga2_right = \melodic{ - \$fuga2_commands ++ + \$fuga2_commands % 15 \octave c'; - <\multivoice + <\multi 2; { \stem 1; [b8 fis8] b4 } { \stem -1; fis2 } > @@ -87,14 +86,14 @@ fuga2_right = \melodic{ |x | %} - < \multivoice + < \multi 2; { \stem 1; \hshift 0; e'4 } { \stem 1; \hshift 1; cis'4 } { \stem 1; \hshift 2; ais4 } { \stem -1; fis4 } > | % 16 - <\multivoice + <\multi 2; { \stem 1; dis'2 dis'4 | cis'2 cis'4 | b4~ [b8 cis'8 dis'8 e'8] } { \stem 1; \hshift 1; [b8 fis8] b2~ [b8 a16 g16] a2 | a4 gis2 } { \stem -1; fis2.~ fis2.~ fis4 e2 } @@ -103,12 +102,12 @@ fuga2_right = \melodic{ } fuga2_left = \melodic{ - \$fuga2_commands ++ + \$fuga2_commands \octave c; \clef bass; % 15 b2 - <\multivoice + <\multi 2; { \stem 1; ais4 | bes2. } { \stem -1; e4 | fis2 fis4 } > @@ -119,7 +118,7 @@ fuga2_left = \melodic{ } fuga2_pedal = \melodic{ - \$fuga2_commands ++ + \$fuga2_commands \octave c; \clef bass; % 15 @@ -136,28 +135,13 @@ break = \melodic{ \meter 4/4; r1 } % these should be two separate scores... \score{ - \staff{ melodicregs - % why the extra "\melodic" (silly) - % let "[ x ]" be "dimension of x": - % [ melodic ++ melodic ] == [ simple-mudela ] - % [ \melodic{ melodic ++ melodic } ] == [ melodic ] - % ? - \melodic{ - \$toccata_right ++ \break ++ \$fuga2_right - } - } - \staff{ melodicregs - \melodic{ - \$toccata_left ++ \break ++ \$fuga2_left - } - } - \staff{ melodicregs - \melodic{ - \$toccata_pedal - ++ \break - ++ \$fuga2_pedal - } - } + \melodic < \multi 3; + { \$toccata_right \break \$fuga2_right } + { \$toccata_left \break \$fuga2_left } + + { \$toccata_pedal \break \$fuga2_pedal } + + > \paper{} \midi{ \tempo 4:96 diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly index eb6b0278f6..0e91713bcf 100644 --- a/input/wohltemperirt.ly +++ b/input/wohltemperirt.ly @@ -14,7 +14,7 @@ %} -\version "0.0.58"; +\version "0.0.59"; % should add \need{dutch.ini} for % correct parsing of note names @@ -29,7 +29,7 @@ dux = \melodic { \clef "violin"; \octave c'; - \duration \last; + \stem -1; r8 [c'16 b] [c'8 g] [as c'16 b] [c'8 d'] | [g c'16 b] [c'8 d'] [f16 g] as4 [g16 f] | @@ -131,7 +131,6 @@ comes = bassdux = \melodic { \clef "bass"; - \octave c'; r1 | r | @@ -175,27 +174,28 @@ bassdux = [F16 G] As4 [G16 F] Es4 r8 es | [d c g G] %% 30 - < \multivoice + < \multi 2; { \stem 1; c2~ | c1~ | c1 } { \stem -1; C2~ | C1~ | C1 } > } -% every "melody" declared in a staff has its own "voicegroup" -trebstaf = - \staff { - \inputregister{melodicregs} - global dux comes - } \score { - trebstaf - \staff { - \inputregister{melodicregs} - global bassdux - } + \melodic < \multi 1; + < \multi 2; + \global + \dux + \comes + > + < \multi 2; + \global + \bassdux + > + + > \paper{} \midi { \tempo 4:84 diff --git a/lib/includable-lexer.cc b/lib/includable-lexer.cc index 61f1c1b613..792cbc46ae 100644 --- a/lib/includable-lexer.cc +++ b/lib/includable-lexer.cc @@ -23,7 +23,7 @@ Includable_lexer::new_input(String s, Sources * global_sources) if (!sl) { LexerError("Can't find file `" + s+ "'"); return; - } else + } char_count_stack_.push(0); @@ -45,8 +45,8 @@ Includable_lexer::close_input() char_count_stack_.pop(); cout << "]"<<flush; yy_delete_buffer(yy_current_buffer ); + yy_current_buffer = 0; if (state_stack_.empty()) { - yy_current_buffer = 0; return false; }else { yy_switch_to_buffer(state_stack_.pop()); diff --git a/lib/include/moment.hh b/lib/include/moment.hh index e742bee900..4f44c07fd9 100644 --- a/lib/include/moment.hh +++ b/lib/include/moment.hh @@ -8,7 +8,7 @@ #include "rational.hh" class String; typedef Rational Moment; -void print(Moment); +void printm(Moment const&); #endif // diff --git a/lib/moment.cc b/lib/moment.cc index 46ed554d50..2557acb2a5 100644 --- a/lib/moment.cc +++ b/lib/moment.cc @@ -1,9 +1,17 @@ +/* + moment.cc -- implement Moment + + source file of the GNU LilyPond music typesetter + + (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include <iostream.h> #include "string.hh" #include "moment.hh" void -print(Moment m) +printm(Moment const &m) { cout << String(m) << flush; } diff --git a/lily/.version b/lily/.version index 1f39e39a1d..779974957f 100644 --- a/lily/.version +++ b/lily/.version @@ -1,7 +1,7 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 67 +PATCH_LEVEL = 68 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf -MY_PATCH_LEVEL = +MY_PATCH_LEVEL = pre diff --git a/lily/Stable.make b/lily/Stable.make index f32586508f..1e9ca02e60 100644 --- a/lily/Stable.make +++ b/lily/Stable.make @@ -1,11 +1,10 @@ # kept in dist bo stripping stable stuff, still to copy... # a bit of a hack to keep exec size under control. -stablecc=command-request.cc musical-request.cc bar.cc boxes.cc \ - item.cc keyword.cc leastsquares.cc \ +stablecc=atom.cc command-request.cc musical-request.cc bar.cc boxes.cc \ + keyword.cc leastsquares.cc \ lookup.cc molecule.cc meter.cc\ paper-def.cc parser.cc lexer.cc qlp.cc qlpsolve.cc\ template1.cc template2.cc template3.cc template4.cc\ template5.cc template6.cc version.cc tex-stream.cc tex.cc\ - voice.cc \ - voice-element.cc identifier.cc note.cc\ + identifier.cc note.cc\ diff --git a/lily/atom.cc b/lily/atom.cc index 0ca9649b35..f90625a25f 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -18,20 +18,20 @@ void Atom::print() const { - mtor << "texstring: " <<sym.tex<<"\n"; + mtor << "texstring: " <<sym_.tex<<"\n"; } Box Atom::extent() const { - Box b( sym.dim); - b.translate(off); + Box b( sym_.dim); + b.translate(off_); return b; } Atom::Atom(Symbol s) { - sym=s; + sym_=s; } @@ -39,14 +39,14 @@ String Atom::TeX_string() const { /* infinity checks. */ - assert( abs(off.x) < 100 CM); - assert( abs(off.y) < 100 CM); + assert( abs(off_.x) < 100 CM); + assert( abs(off_.y) < 100 CM); // whugh.. Hard coded... String s("\\placebox{%}{%}{%}"); Array<String> a; - a.push(print_dimen(off.y)); - a.push(print_dimen(off.x)); - a.push(sym.tex); + a.push(print_dimen(off_.y)); + a.push(print_dimen(off_.x)); + a.push(sym_.tex); return substitute_args(s, a); } diff --git a/lily/bar-reg.cc b/lily/bar-reg.cc index c66a33bdb4..46f7bf3b82 100644 --- a/lily/bar-reg.cc +++ b/lily/bar-reg.cc @@ -13,11 +13,11 @@ Bar_register::Bar_register() { - post_move_processing(); + do_post_move_processing(); } bool -Bar_register::try_request(Request*r_l) +Bar_register::do_try_request(Request*r_l) { Command_req* c_l = r_l->command(); if (!c_l|| !c_l->bar()) @@ -32,12 +32,13 @@ Bar_register::try_request(Request*r_l) } void -Bar_register::process_requests() +Bar_register::do_process_requests() { if (bar_req_l_ ) { - bar_p_ = new Bar(bar_req_l_->type_str_); + bar_p_ = new Bar; + bar_p_->type_str_=bar_req_l_->type_str_; } else if (!get_staff_info().time_C_->whole_in_measure_) { - bar_p_ = new Bar("|"); + bar_p_ = new Bar; } if (bar_p_){ @@ -46,42 +47,24 @@ Bar_register::process_requests() } - -void -Bar_register::split_bar(Bar *& pre, Bar * no, Bar * &post) -{ - String s= no->type; - if (s == ":|:") { - pre = new Bar(":|"); - post = new Bar("|:"); - }else if (s=="|:") { - post = new Bar(s); - } else { - pre = new Bar(*no); - } -} - void -Bar_register::pre_move_processing() +Bar_register::do_pre_move_processing() { if (bar_p_) { - Bar * post_p =0; - Bar * pre_p =0; - split_bar(pre_p, bar_p_, post_p); - - typeset_breakable_item(pre_p, bar_p_, post_p); + typeset_breakable_item(bar_p_); bar_p_ =0; } } void -Bar_register::post_move_processing() +Bar_register::do_post_move_processing() { bar_req_l_ = 0; bar_p_ =0; } IMPLEMENT_STATIC_NAME(Bar_register); +IMPLEMENT_IS_TYPE_B1(Bar_register,Request_register); ADD_THIS_REGISTER(Bar_register); diff --git a/lily/bar.cc b/lily/bar.cc index 8a6891b330..cf8d15bef2 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -13,24 +13,48 @@ #include "lookup.hh" #include "debug.hh" -Bar::Bar( String t) +Bar::Bar() { - type = t; + type_str_ = "|"; } + IMPLEMENT_STATIC_NAME(Bar); +IMPLEMENT_IS_TYPE_B1(Bar,Item); void Bar::do_print()const { - mtor << type; + mtor << type_str_; } Molecule* Bar::brew_molecule_p()const { - Symbol s = paper()->lookup_l()->bar(type); + Symbol s = paper()->lookup_l()->bar(type_str_); Molecule*output = new Molecule(Atom(s)); return output; } + +/** + TODO: parametrise this (input-settable) + */ +char const *bar_breaks[][3] ={ + {":|", ":|:", "|:"}, + {"|", "|", ""}, + {"", "|:", "|:"}, + {"||.", "||.", ""}, + {0,0,0} +}; + +void +Bar::do_pre_processing() +{ + for (int i=0; bar_breaks[i][0]; i++) { + if (bar_breaks[i][1] == type_str_) + type_str_ = bar_breaks[i][break_status_i()+1]; + } + + transparent_b_ = empty_b_ = (type_str_ == ""); +} diff --git a/lily/beam.cc b/lily/beam.cc index 3d16d96518..cf2eb652a8 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -12,6 +12,9 @@ */ +#include <math.h> + +#include "p-col.hh" #include "varray.hh" #include "proto.hh" #include "dimen.hh" @@ -21,7 +24,6 @@ #include "symbol.hh" #include "molecule.hh" #include "leastsquares.hh" -#include "p-col.hh" #include "stem.hh" #include "paper-def.hh" #include "lookup.hh" @@ -79,16 +81,30 @@ Beam::add(Stem*s) void Beam::set_default_dir() { - int dirs_single = 0, dirs_chord = 0; + int up = 0, down = 0; + int up_count = 0, down_count = 0; + for (int i=0; i <stems.size(); i++) { Stem *sl = stems[i]; - if (sl->chord_b()) - dirs_chord += sl->get_default_dir(); - else - dirs_single += sl->get_center_distance(); + int cur_down = sl->get_center_distance_from_top(); + int cur_up = sl->get_center_distance_from_bottom(); + if (cur_down) { + down += cur_down; + down_count++; + } + if (cur_up) { + up += cur_up; + up_count++; + } } - dirs_single = -sign(dirs_single); - dir_i_ = (dirs_single + dirs_chord > 0) ? 1 : -1; + if (!down) + down_count = 1; + if (!up) + up_count = 1; + + // the following relation is equal to + // up / up_count > down / down_count + dir_i_ = (up * down_count > down * up_count) ? 1 : -1; for (int i=0; i <stems.size(); i++) { Stem *sl = stems[i]; @@ -103,7 +119,7 @@ void Beam::solve_slope() { Array<Stem_info> sinfo; - for (int j=0; j <stems.size(); j++) { + for (int j=0; j <stems.size(); j++) { Stem *i = stems[j]; i->set_default_extents(); @@ -131,7 +147,9 @@ Beam::solve_slope() } left_pos += dy; left_pos *= dir_i_; + slope *= dir_i_; + slope = 0.6 * tanh(slope); // damping // ugh Real sl = slope*paper()->internote_f(); @@ -195,8 +213,6 @@ Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur) void Beam::do_pre_processing() { - left_col_l_ = stems[0] ->pcol_l_; - right_col_l_ = stems.top()->pcol_l_; assert(stems.size()>1); if (!dir_i_) set_default_dir(); @@ -239,7 +255,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const a.translate(Offset (-w, -w * sl)); for (int j = 0; j < lhalfs; j++) { Atom b(a); - b.translate(Offset(0, -dir_i_ * dy * (lwholebeams+j))); + b.translate_y( -dir_i_ * dy * (lwholebeams+j)); leftbeams.add( b ); } } @@ -254,7 +270,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const int j = 0; for (; j < rwholebeams; j++) { Atom b(a); - b.translate(Offset(0, -dir_i_ * dy * j)); + b.translate_y( -dir_i_ * dy * j); rightbeams.add( b ); } @@ -264,7 +280,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const for (; j < rwholebeams + rhalfs; j++) { Atom b(a); - b.translate(Offset(0, -dir_i_ * dy * j)); + b.translate_y( -dir_i_ * dy * j); rightbeams.add(b ); } @@ -291,11 +307,12 @@ Beam::brew_molecule_p() const sb.translate(Offset(x, (x * slope + left_pos)* inter)); out->add(sb); } - out->translate(Offset(x0 - left_col_l_->hpos,0)); + out->translate_x(x0 - left_col_l_->hpos); return out; } IMPLEMENT_STATIC_NAME(Beam); +IMPLEMENT_IS_TYPE_B1(Beam, Spanner); void Beam::do_print()const diff --git a/lily/bow.cc b/lily/bow.cc index e24f79d067..de9269b2e4 100644 --- a/lily/bow.cc +++ b/lily/bow.cc @@ -56,3 +56,4 @@ Bow::brew_molecule_p() const } IMPLEMENT_STATIC_NAME(Bow); +IMPLEMENT_IS_TYPE_B1(Bow,Directional_spanner); diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc new file mode 100644 index 0000000000..808a7813d8 --- /dev/null +++ b/lily/break-align-item.cc @@ -0,0 +1,18 @@ +/* + break-align-item.cc -- implement Break_align_item + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ +#include "break-align-item.hh" + +void +Break_align_item::do_pre_processing() +{ + + align_i_ = break_status_i(); + Horizontal_align_item::do_pre_processing(); +} +IMPLEMENT_STATIC_NAME(Break_align_item); +IMPLEMENT_IS_TYPE_B1(Break_align_item, Horizontal_align_item); diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 055b282b2e..626cfe64be 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -14,10 +14,21 @@ #include "clef-reg.hh" +void +Clef_item::do_pre_processing() +{ + change_b_ = ! (break_status_i() == 1); + + if (default_b_){ + empty_b_ = (break_status_i() != 1); + transparent_b_ = (break_status_i() != 1); + } +} Clef_item::Clef_item() { - change = true; + default_b_ = false; + change_b_ = true; read("violin"); } @@ -44,12 +55,13 @@ Molecule* Clef_item::brew_molecule_p()const { String t = type_; - if (change) + if (change_b_) t += "_change"; Symbol s = paper()->lookup_l()->clef(t); Molecule*output = new Molecule(Atom(s)); - output->translate(Offset(0, paper()->internote_f() * y_off)); + output->translate_y( paper()->internote_f() * y_off); return output; } IMPLEMENT_STATIC_NAME(Clef_item); +IMPLEMENT_IS_TYPE_B1(Clef_item,Item); diff --git a/lily/clef-reg.cc b/lily/clef-reg.cc index 9f1d5fa9c7..4e3d25eb40 100644 --- a/lily/clef-reg.cc +++ b/lily/clef-reg.cc @@ -6,20 +6,20 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>, Mats Bengtsson <matsb@s3.kth.se> */ + #include "bar.hh" #include "clef-reg.hh" #include "clef-item.hh" #include "debug.hh" #include "command-request.hh" #include "time-description.hh" -#include "staff-column.hh" Clef_register::Clef_register() { clef_p_ = 0; + clef_req_l_ =0; - /* ugly hack to prevent segfault (daddy_reg_l_ == 0 at construction) */ - clef_type_str_ = ""; + set_type("violin"); } bool @@ -34,13 +34,18 @@ Clef_register::set_type(String s) c0_position_i_= 6; } else if (clef_type_str_ == "bass") { c0_position_i_= 10; - }else + } else return false; - *get_staff_info().c0_position_i_l_ = c0_position_i_; return true; } +void +Clef_register::fill_staff_info(Staff_info &i) +{ + i.c0_position_i_l_ = &c0_position_i_; +} + void Clef_register::read_req(Clef_change_req*c_l) { @@ -50,15 +55,23 @@ Clef_register::read_req(Clef_change_req*c_l) void Clef_register::acknowledge_element(Score_elem_info info) { - if (info.elem_l_->name() == Bar::static_name()) { + if (info.elem_l_->name() == Bar::static_name() ) { if (!clef_p_){ create_clef(); - clef_p_->change = false; + clef_p_->default_b_ = true; } } } + +void +Clef_register::do_creation_processing() +{ + create_clef(); + clef_p_->default_b_ = false; +} + bool -Clef_register::try_request(Request * r_l) +Clef_register::do_try_request(Request * r_l) { Command_req* creq_l= r_l->command(); if (!creq_l || !creq_l->clefchange()) @@ -74,45 +87,46 @@ Clef_register::try_request(Request * r_l) void Clef_register::create_clef() { - clef_p_ = new Clef_item; - clef_p_->read(*this); - announce_element(Score_elem_info(clef_p_, - clef_req_l_)); -} + if (!clef_p_) { + clef_p_ = new Clef_item; + announce_element(Score_elem_info(clef_p_, + clef_req_l_)); + + clef_p_->read(*this); + } +} void -Clef_register::process_requests() +Clef_register::do_process_requests() { if (clef_req_l_) { create_clef(); - clef_p_->change = true; + clef_p_->default_b_ = false; } } void -Clef_register::pre_move_processing() +Clef_register::do_pre_move_processing() { if (!clef_p_) return; - if (clef_p_->change) { - Clef_item* post_p = new Clef_item(*clef_p_); - post_p->change = false; - typeset_breakable_item(new Clef_item(*clef_p_), - clef_p_, post_p); - } else { - typeset_breakable_item(0, 0, clef_p_); - } + typeset_breakable_item(clef_p_); clef_p_ = 0; } void -Clef_register::post_move_processing() +Clef_register::do_post_move_processing() { clef_req_l_ = 0; - /* not in ctor, since the reg might not be linked in.*/ - if (clef_type_str_ == "") { - set_type("violin"); - } } + +void +Clef_register::do_removal_processing() +{ + delete clef_p_; + clef_p_ =0; +} + IMPLEMENT_STATIC_NAME(Clef_register); +IMPLEMENT_IS_TYPE_B1(Clef_register,Request_register); ADD_THIS_REGISTER(Clef_register); diff --git a/lily/collision-reg.cc b/lily/collision-reg.cc index 73582d5d90..8a895d79c8 100644 --- a/lily/collision-reg.cc +++ b/lily/collision-reg.cc @@ -23,7 +23,7 @@ Collision_register::acknowledge_element(Score_elem_info i) } void -Collision_register::pre_move_processing() +Collision_register::do_pre_move_processing() { if (col_p_) { typeset_element(col_p_); @@ -36,4 +36,5 @@ Collision_register::Collision_register() } IMPLEMENT_STATIC_NAME(Collision_register); +IMPLEMENT_IS_TYPE_B1(Collision_register,Request_register); ADD_THIS_REGISTER(Collision_register); diff --git a/lily/collision.cc b/lily/collision.cc index 8f43ee4233..554d54ac60 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -120,7 +120,8 @@ Collision::do_pre_processing() // reproduction of bugfix at 3am ? Note_head * nu_l= col_l_a[idx(1,0)]->head_l_arr_[0]; Note_head * nd_l = col_l_a[idx(-1,0)]->head_l_arr_.top(); - if (! (nu_l->balltype_i_ == nd_l->balltype_i_ && nu_l->dots_i_ == nd_l->dots_i_ && middle.length() == 0 )) { + if (! (nu_l->balltype_i_ == nd_l->balltype_i_ + && nu_l->dots_i_ == nd_l->dots_i_ && middle.length() == 0 )) { x_off[idx(1,0)] -= 0.5; x_off[idx(1,1)] -= 0.5; x_off[idx(-1,1)] += 0.5; @@ -139,6 +140,7 @@ Collision::do_pre_processing() } IMPLEMENT_STATIC_NAME(Collision); +IMPLEMENT_IS_TYPE_B1(Collision, Item); void Collision::do_substitute_dependency(Score_elem*o_l,Score_elem*n_l) diff --git a/lily/command-request.cc b/lily/command-request.cc index 7a70fced2e..1d4b35dadf 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -14,7 +14,10 @@ void Command_script_req::do_print() const {} IMPLEMENT_STATIC_NAME(Command_script_req); +IMPLEMENT_IS_TYPE_B1(Command_script_req,Command_req); + IMPLEMENT_STATIC_NAME(Cadenza_req); +IMPLEMENT_IS_TYPE_B1(Cadenza_req, Timing_req); void Cadenza_req::do_print()const @@ -36,6 +39,7 @@ Bar_req::compare(Bar_req const &c1)const } IMPLEMENT_STATIC_NAME(Bar_req); +IMPLEMENT_IS_TYPE_B1(Bar_req,Command_req); void Bar_req::do_print() const @@ -55,22 +59,26 @@ Partial_measure_req::Partial_measure_req(Moment m) /* *************** */ IMPLEMENT_STATIC_NAME(Timing_req); +IMPLEMENT_IS_TYPE_B1(Timing_req,Command_req); void Timing_req::do_print()const{} IMPLEMENT_STATIC_NAME(Command_req); +IMPLEMENT_IS_TYPE_B1(Command_req,Request); void Command_req::do_print()const{} /* *************** */ IMPLEMENT_STATIC_NAME(Barcheck_req); +IMPLEMENT_IS_TYPE_B1(Barcheck_req,Timing_req); void Barcheck_req::do_print() const{} /* *************** */ IMPLEMENT_STATIC_NAME(Clef_change_req); +IMPLEMENT_IS_TYPE_B1(Clef_change_req,Command_req); void Clef_change_req::do_print() const @@ -86,6 +94,7 @@ Clef_change_req::Clef_change_req(String s) } /* *************** */ IMPLEMENT_STATIC_NAME(Group_feature_req); +IMPLEMENT_IS_TYPE_B1(Group_feature_req,Command_req); void Group_feature_req::do_print() const @@ -95,25 +104,10 @@ Group_feature_req::do_print() const #endif } -IMPLEMENT_STATIC_NAME(Group_change_req); - -void -Group_change_req::do_print()const -{ -#ifndef NPRINT - mtor << "id : " << newgroup_str_; -#endif -} /* *************** */ -IMPLEMENT_STATIC_NAME(Terminate_voice_req); - -void -Terminate_voice_req::do_print()const -{ -} -/* *************** */ IMPLEMENT_STATIC_NAME(Partial_measure_req); +IMPLEMENT_IS_TYPE_B1(Partial_measure_req,Timing_req); void Partial_measure_req::do_print() const @@ -122,6 +116,7 @@ Partial_measure_req::do_print() const } IMPLEMENT_STATIC_NAME(Meter_change_req); +IMPLEMENT_IS_TYPE_B1(Meter_change_req,Timing_req); void Meter_change_req::do_print() const @@ -151,6 +146,7 @@ Meter_change_req::set(int b,int o) /* *************** */ IMPLEMENT_STATIC_NAME(Measure_grouping_req); +IMPLEMENT_IS_TYPE_B1(Measure_grouping_req,Timing_req); void Measure_grouping_req::do_print() const @@ -171,6 +167,7 @@ Key_change_req::transpose(Melodic_req const & d)const } IMPLEMENT_STATIC_NAME(Key_change_req); +IMPLEMENT_IS_TYPE_B1(Key_change_req,Command_req); void Key_change_req::squash_octaves() { diff --git a/lily/complex-walker.cc b/lily/complex-walker.cc deleted file mode 100644 index d32d9db2eb..0000000000 --- a/lily/complex-walker.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* - complex-walker.cc -- implement Complex_walker - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ -#include "score.hh" -#include "staff-column.hh" -#include "voice.hh" -#include "p-score.hh" -#include "debug.hh" -#include "complex-walker.hh" -#include "walk-regs.hh" -#include "score-elem.hh" -#include "staff.hh" -#include "staffline.hh" - -void -Complex_walker::do_post_move() -{ - walk_regs_p_->post_move_processing(); -} - -void -Complex_walker::do_pre_move() -{ - walk_regs_p_->pre_move_processing(); -} - -void -Complex_walker::do_announces() -{ - walk_regs_p_->do_announces(); -} - - -void -Complex_walker::try_request(Request*req) -{ - bool b =walk_regs_p_->try_request(req); - if (!b) - req->warning("junking request: " + String(req->name())); -} - -void -Complex_walker::process_requests() -{ - Staff_column*c =ptr(); - - for (int i=0; i < c->creationreq_l_arr_.size(); i++) { - try_request(c->creationreq_l_arr_[i]); - } - for (int i=0; i < c->commandreq_l_arr_.size(); i++) { - try_request(c->commandreq_l_arr_[i]); - } - - for (int i=0; i < c->musicalreq_l_arr_.size(); i++) { - try_request(c->musicalreq_l_arr_[i]); - } - - regs_process_requests(); - do_announces(); -} - -void -Complex_walker::regs_process_requests() -{ - walk_regs_p_->process_requests(); -} - -void -Complex_walker::typeset_element(Score_elem *elem_p) -{ - if (!elem_p) - return; - staff_l_->staff_line_l_->add_element(elem_p); - if (elem_p->spanner()) - pscore_l_->typeset_unbroken_spanner(elem_p->spanner()); - else - ptr()->typeset_musical_item(elem_p->item()); -} - -Complex_walker::Complex_walker(Staff*s) - : Staff_walker(s, s->score_l_->pscore_p_) -{ - walk_regs_p_ = new Walker_registers(this); - do_post_move(); -} - - -Complex_walker::~Complex_walker() -{ - delete walk_regs_p_; -} - - - diff --git a/lily/crescendo.cc b/lily/crescendo.cc index 4ca1196b09..bcf6c1c8b7 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -54,3 +54,4 @@ Crescendo::brew_molecule_p() const } IMPLEMENT_STATIC_NAME(Crescendo); +IMPLEMENT_IS_TYPE_B1(Crescendo,Spanner); diff --git a/lily/debug.cc b/lily/debug.cc index a2bce7c8ce..3d046bd414 100644 --- a/lily/debug.cc +++ b/lily/debug.cc @@ -5,9 +5,12 @@ #include "debug.hh" #include "dstream.hh" #include "flower-debug.hh" +#include "moment.hh" Dstream *monitor=0; ostream * nulldev =0; +static void (*rat_printer)(Moment const&); + // ugh struct _Dinit { _Dinit() { @@ -41,6 +44,7 @@ float_handler(int) void debug_init() { + rat_printer = printm; // make sure this is linked in #ifndef NDEBUG set_new_handler(&mynewhandler); #endif @@ -56,6 +60,6 @@ set_debug(bool b) { check_debug =b; set_flower_debug(*monitor, check_debug); - } +} diff --git a/lily/dynamic-reg.cc b/lily/dynamic-reg.cc index 94b887432a..3e953a6519 100644 --- a/lily/dynamic-reg.cc +++ b/lily/dynamic-reg.cc @@ -19,20 +19,20 @@ Dynamic_register::Dynamic_register() { dir_i_ =0; - post_move_processing(); + do_post_move_processing(); dynamic_p_ =0; to_end_cresc_p_ = cresc_p_ = 0; cresc_req_l_ = 0; } void -Dynamic_register::post_move_processing() +Dynamic_register::do_post_move_processing() { dynamic_req_l_arr_.set_size(0); } bool -Dynamic_register::try_request(Request * r) +Dynamic_register::do_try_request(Request * r) { Musical_req * m = r->musical(); if (!m || !m->dynamic()) @@ -41,7 +41,7 @@ Dynamic_register::try_request(Request * r) return true; } void -Dynamic_register::process_requests() +Dynamic_register::do_process_requests() { Crescendo* new_cresc_p=0; for (int i=0; i < dynamic_req_l_arr_.size(); i++) { @@ -90,7 +90,7 @@ Dynamic_register::process_requests() } void -Dynamic_register::pre_move_processing() +Dynamic_register::do_pre_move_processing() { Staff_symbol* s_l = get_staff_info().staff_sym_l_; if (dynamic_p_) { @@ -109,13 +109,6 @@ Dynamic_register::pre_move_processing() } } -bool -Dynamic_register::acceptable_request_b(Request*r)const -{ - Musical_req * m = r->musical(); - return (m && m->dynamic()); -} - void Dynamic_register::set_feature(Feature i) { @@ -124,6 +117,7 @@ Dynamic_register::set_feature(Feature i) } IMPLEMENT_STATIC_NAME(Dynamic_register); +IMPLEMENT_IS_TYPE_B1(Dynamic_register,Request_register); ADD_THIS_REGISTER(Dynamic_register); Dynamic_register::~Dynamic_register() diff --git a/lily/elem-group-item.cc b/lily/elem-group-item.cc new file mode 100644 index 0000000000..2c174c6379 --- /dev/null +++ b/lily/elem-group-item.cc @@ -0,0 +1,21 @@ +/* + elem-group-item.cc -- implement Horizontal_vertical_group_item + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#include "elem-group-item.hh" + +void +Horizontal_vertical_group_item::do_print()const +{ + Horizontal_vertical_group::do_print(); +} +IMPLEMENT_STATIC_NAME(Horizontal_vertical_group_item); +IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group,Item); + +IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group, Item); +IMPLEMENT_STATIC_NAME(Horizontal_group_item); diff --git a/lily/elem-group.cc b/lily/elem-group.cc index e4a012d3f3..e104187fc2 100644 --- a/lily/elem-group.cc +++ b/lily/elem-group.cc @@ -1,5 +1,5 @@ /* - elem-group.cc -- implement Element_group + elem-group.cc -- implement Horizontal_vertical_group source file of the GNU LilyPond music typesetter @@ -11,8 +11,14 @@ #include "item.hh" #include "debug.hh" +bool +Elbement_group::contains_b(Score_elem const*e)const +{ + return elem_l_arr_.find_l(e); +} + Interval -Element_group::do_height()const +Vertical_group::do_height()const { Interval r; for (int i=0; i < elem_l_arr_.size(); i++) @@ -21,7 +27,7 @@ Element_group::do_height()const } Interval -Element_group::do_width()const +Horizontal_group::do_width()const { Interval r; for (int i=0; i < elem_l_arr_.size(); i++) @@ -30,27 +36,55 @@ Element_group::do_width()const return r; } +IMPLEMENT_STATIC_NAME(Horizontal_group); +IMPLEMENT_IS_TYPE_B1(Horizontal_group, Elbement_group); +IMPLEMENT_IS_TYPE_B1(Vertical_group, Elbement_group); +IMPLEMENT_STATIC_NAME(Vertical_group); + void -Element_group::add_element(Score_elem*i_l) +Elbement_group::add_element(Score_elem*i_l) { - i_l->group_element_i_ ++; - - assert(! elem_l_arr_.find_l(i_l)); + assert(i_l!= this); + assert(! contains_b(i_l)); + elem_l_arr_.push(i_l); add_dependency(i_l); } void -Element_group::translate(Offset o) +Horizontal_group::add_element(Score_elem*elt) +{ + elt->x_group_element_i_ ++; + Elbement_group::add_element(elt); +} + +void +Vertical_group::add_element(Score_elem*e) +{ + e->y_group_element_i_++; + Elbement_group::add_element(e); +} + + +void +Horizontal_group::translate_x(Real x) +{ + for (int i=0; i < elem_l_arr_.size(); i++) + elem_l_arr_[i]->translate_x(x); +} + +void +Vertical_group::translate_y(Real y) { for (int i=0; i < elem_l_arr_.size(); i++) - elem_l_arr_[i]->translate(o); + elem_l_arr_[i]->translate_y(y); } -IMPLEMENT_STATIC_NAME(Element_group); +IMPLEMENT_STATIC_NAME(Elbement_group); +IMPLEMENT_IS_TYPE_B1(Elbement_group, Score_elem); void -Element_group::do_print() const +Elbement_group::do_print() const { #ifndef NPRINT for (int i=0; i < elem_l_arr_.size(); i++) @@ -59,35 +93,91 @@ Element_group::do_print() const } void -Element_group::do_substitute_dependency(Score_elem* old, Score_elem *new_l) +Horizontal_group::do_substitute_dependency(Score_elem* old, Score_elem *new_l) { int i; while ((i=elem_l_arr_.find_i(old))>=0) { + old->x_group_element_i_--; - old->group_element_i_--; if (new_l){ - new_l->group_element_i_ ++; + new_l->x_group_element_i_ ++; elem_l_arr_[i] = new_l; }else { elem_l_arr_.del(i); } } +} + +void +Vertical_group::do_substitute_dependency(Score_elem* old, Score_elem *new_l) +{ + int i; + while ((i=elem_l_arr_.find_i(old))>=0) { + old->y_group_element_i_--; + + if (new_l){ + new_l->y_group_element_i_ ++; + elem_l_arr_[i] = new_l; + }else { + elem_l_arr_.del(i); + } + } } -String -Element_group::TeX_string()const +Vertical_group::Vertical_group(Vertical_group + const &s) + : Elbement_group(s) { - return ""; + for (int i=0; i < elem_l_arr_.size(); i++) + elem_l_arr_[i]->y_group_element_i_ ++; } -Element_group::Element_group(Element_group const&s) - :elem_l_arr_(s.elem_l_arr_) +Horizontal_group::Horizontal_group(Horizontal_group + const &s) + : Elbement_group(s) { for (int i=0; i < elem_l_arr_.size(); i++) - elem_l_arr_[i]->group_element_i_ ++; + elem_l_arr_[i]->x_group_element_i_ ++; +} + +Elbement_group::Elbement_group() +{ + transparent_b_ = true; +} + +IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group, Horizontal_group, Vertical_group); +IMPLEMENT_STATIC_NAME(Horizontal_vertical_group); + +void +Horizontal_vertical_group::do_substitute_dependency(Score_elem*o,Score_elem*n) +{ + Vertical_group::do_substitute_dependency(o,n); + Horizontal_group::do_substitute_dependency(o,n); +} + +void +Horizontal_vertical_group::add_element(Score_elem*e) +{ + Vertical_group::add_element(e); + Horizontal_group::add_element(e); +} + +void +Horizontal_vertical_group::do_print()const +{ + Vertical_group::do_print(); } -Element_group::Element_group() -{} +void +Vertical_group::do_print()const +{ + Elbement_group::do_print(); +} + +void +Horizontal_group::do_print() const +{ + Elbement_group::do_print(); +} diff --git a/lily/general-script-def.cc b/lily/general-script-def.cc index e35a56cc2e..688e9cdd36 100644 --- a/lily/general-script-def.cc +++ b/lily/general-script-def.cc @@ -68,3 +68,4 @@ General_script_def::get_atom(Paper_def*, int)const return Atom(s); } IMPLEMENT_STATIC_NAME(General_script_def); +IMPLEMENT_IS_TYPE_B(General_script_def); diff --git a/lily/global-regs.cc b/lily/global-regs.cc index f05f98c6aa..ca027af462 100644 --- a/lily/global-regs.cc +++ b/lily/global-regs.cc @@ -38,7 +38,7 @@ add_request_register(String s, Reg_ctor f) Request_register* -get_nongroup_register_p(String s) +get_register_p(String s) { for (int i=0; i < reg_table->size(); i++) { if ((*reg_table)[i].name_str_ == s) diff --git a/lily/head-reg.cc b/lily/head-reg.cc index 8a144ad142..e5a7279fa2 100644 --- a/lily/head-reg.cc +++ b/lily/head-reg.cc @@ -7,18 +7,20 @@ #include "note-head.hh" #include "head-reg.hh" #include "paper-def.hh" -#include "complex-walker.hh" #include "musical-request.hh" Note_head_register::Note_head_register() { note_p_ = 0; - post_move_processing(); + do_post_move_processing(); } bool -Note_head_register::try_request(Request *req_l) +Note_head_register::do_try_request(Request *req_l) { + if (note_req_l_) + return false; + if (req_l->musical() && (req_l->musical()->note() || req_l->musical()->rest())) note_req_l_=req_l->musical()->rhythmic(); else @@ -28,7 +30,7 @@ Note_head_register::try_request(Request *req_l) } void -Note_head_register::process_requests() +Note_head_register::do_process_requests() { if (!note_req_l_) return; @@ -53,7 +55,7 @@ Note_head_register::process_requests() } void -Note_head_register::pre_move_processing() +Note_head_register::do_pre_move_processing() { if (note_p_) { typeset_element(note_p_); @@ -61,10 +63,11 @@ Note_head_register::pre_move_processing() } } void -Note_head_register::post_move_processing() +Note_head_register::do_post_move_processing() { note_req_l_ = 0; } IMPLEMENT_STATIC_NAME(Note_head_register); +IMPLEMENT_IS_TYPE_B1(Note_head_register,Request_register); ADD_THIS_REGISTER(Note_head_register); diff --git a/lily/horizontal-align-item.cc b/lily/horizontal-align-item.cc new file mode 100644 index 0000000000..6cfb0c00c0 --- /dev/null +++ b/lily/horizontal-align-item.cc @@ -0,0 +1,108 @@ +/* + horizontal-align-item.cc -- implement Horizontal_align_item + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "horizontal-align-item.hh" +IMPLEMENT_STATIC_NAME(Horizontal_align_item); +IMPLEMENT_IS_TYPE_B1(Horizontal_align_item,Item); + +bool +Horizontal_align_item::contains_b(Item *i)const +{ + return item_l_arr_.find_l(i); +} + +void +Horizontal_align_item::add(Item *i,int p) +{ + assert(! contains_b(i)); + priority_i_arr_.push(p); + item_l_arr_.push(i); + add_dependency(i); +} + +void +Horizontal_align_item::do_substitute_dependency(Score_elem*o,Score_elem*n) +{ + int i; + while ((i = item_l_arr_.find_i(o->item())) >=0) { + if (n) + item_l_arr_[i] = n->item(); + else + item_l_arr_.del(i); + } +} + +struct Horizontal_align_item_content { + Item * item_l_; + int priority_i_; + static int compare (Horizontal_align_item_content const &h1, + Horizontal_align_item_content const &h2) { + return h1.priority_i_ - h2.priority_i_; + } + Horizontal_align_item_content(Item*i, int p) { + priority_i_ = p; + item_l_ = i; + } + Horizontal_align_item_content(){item_l_ =0; priority_i_ =0; } +}; + + +void +Horizontal_align_item::do_pre_processing() +{ + { + Array<Horizontal_align_item_content> content; + for (int i =0; i < item_l_arr_.size(); i++) + content.push( + Horizontal_align_item_content( + item_l_arr_[i], priority_i_arr_[i])); + content.sort(Horizontal_align_item_content::compare); + item_l_arr_.set_size(0); + priority_i_arr_.set_size(0); + for (int i =0; i < content.size(); i++) { + item_l_arr_.push( content[i].item_l_ ); + priority_i_arr_.push( content[i].priority_i_); + } + } + + Array<Interval> dims; + Real total =0; + for (int i =0; i < item_l_arr_.size(); i++) { + + Interval item_width= item_l_arr_[i]->width(); + if (item_width.empty_b()) { + item_width = Interval(0,0); + } + dims.push( item_width); + total += item_width.length(); + } + + Real where_f= total * (align_i_-1.0)/2.0; + for ( int i=0 ; i < item_l_arr_.size(); i++) { + item_l_arr_[i]->translate_x(where_f -dims[i][-1] ); + where_f += dims[i].length(); + } +} + +Interval +Horizontal_align_item::do_width() const +{ + return Interval(0,0); +} + +void +Horizontal_align_item::do_print()const +{ +} + +Horizontal_align_item::Horizontal_align_item() +{ + align_i_ = 0; + empty_b_ = true; + transparent_b_ = true; +} diff --git a/lily/identifier.cc b/lily/identifier.cc index 9829e40a42..d306953191 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -8,19 +8,20 @@ #include <assert.h> +#include "score.hh" #include "identifier.hh" #include "my-lily-lexer.hh" #include "debug.hh" #include "input-register.hh" -#include "input-score.hh" #include "symtable.hh" -#include "input-staff.hh" -#include "input-music.hh" #include "lookup.hh" #include "script-def.hh" #include "request.hh" #include "input-register.hh" +IMPLEMENT_STATIC_NAME(Identifier); +IMPLEMENT_IS_TYPE_B(Identifier); + Identifier::~Identifier() { if (!accessed_b_ && !init_b_) @@ -30,7 +31,7 @@ void Identifier::error(String expect) { String e("Wrong identifier type: "); - e += String(classname()) + "(expected " + expect + ")"; + e += String(name()) + "(expected " + expect + ")"; ::error(e); } @@ -58,14 +59,12 @@ Class::do_print() const { \ } \ class Class -DEFAULT_PRINT(Script_id, Script_def, script); +DEFAULT_PRINT(Script_id, General_script_def, script); DEFAULT_PRINT(Lookup_id, Lookup, lookup); DEFAULT_PRINT(Symtables_id, Symtables, symtables); -DEFAULT_PRINT(Staff_id, Input_staff, staff); -DEFAULT_PRINT(M_chord_id, Music_general_chord, mchord); -DEFAULT_PRINT(M_voice_id, Music_voice, mvoice); +DEFAULT_PRINT(Music_id,Music , music); DEFAULT_PRINT(Request_id, Request, request); -DEFAULT_PRINT(Score_id, Input_score, score); +DEFAULT_PRINT(Score_id, Score, score); DEFAULT_PRINT(Input_regs_id, Input_register, iregs); void @@ -75,11 +74,7 @@ Real_id::do_print() const mtor << *((Real_id*)this)->real(false)<< "\n"; } -#define implement_id_class(Idclass, Class, accessor) \ -char const * Idclass::classname() const\ -{\ - return #Class;\ -}\ +#define default_accessor(Idclass, Class, accessor)\ Class*\ Idclass::accessor(bool copy) {\ if (copy){ \ @@ -88,18 +83,32 @@ Idclass::accessor(bool copy) {\ }else\ return (Class*) data;\ }\ + +#define virtual_accessor(Idclass, Class, accessor)\ +Class*\ +Idclass::accessor(bool copy) {\ + if (copy){ \ + accessed_b_ = true;\ + return (Class*) ((Class*) data)->clone();\ + }else\ + return (Class*) data;\ + }\ + + +#define implement_id_class(Idclass, Class, accessor) \ +IMPLEMENT_STATIC_NAME(Idclass)\ +IMPLEMENT_IS_TYPE_B1(Idclass,Identifier)\ Idclass::~Idclass() { delete accessor(false); }\ Idclass::Idclass(String s, Class*st, int code):Identifier(s,code) { data = st; }\ + implement_id_class(Real_id, Real, real); -implement_id_class(Script_id, Script_def, script); +implement_id_class(Script_id, General_script_def, script); implement_id_class(Lookup_id, Lookup, lookup); implement_id_class(Symtables_id, Symtables, symtables); -implement_id_class(Staff_id, Input_staff, staff); -implement_id_class(M_chord_id, Music_general_chord, mchord); -implement_id_class(M_voice_id, Music_voice, mvoice); -implement_id_class(Score_id, Input_score, score); +implement_id_class(Music_id, Music, music); +implement_id_class(Score_id, Score, score); implement_id_class(Request_id, Request, request); implement_id_class(Input_regs_id, Input_register, iregs); @@ -107,3 +116,13 @@ Identifier::Identifier(Identifier const&) { assert(false); } + + +default_accessor(Real_id, Real, real); +default_accessor(Script_id, General_script_def, script); +default_accessor(Lookup_id, Lookup, lookup); +default_accessor(Symtables_id, Symtables, symtables); +virtual_accessor(Music_id, Music, music); +default_accessor(Score_id, Score, score); +virtual_accessor(Request_id, Request, request); +default_accessor(Input_regs_id, Input_register, iregs); diff --git a/lily/include/atom.hh b/lily/include/bar-align-reg.hh index 5e9f2601ff..7219cf4bac 100644 --- a/lily/include/atom.hh +++ b/lily/include/bar-align-reg.hh @@ -1,5 +1,5 @@ /* - atom.hh -- declare + bar-align-reg.hh -- declare source file of the GNU LilyPond music typesetter @@ -7,11 +7,7 @@ */ -#ifndef ATOM_HH -#define ATOM_HH +#ifndef BAR_ALIGN_REG_HH +#define BAR_ALIGN_REG_HH -#include "symbol.hh" -#error - - -#endif // ATOM_HH +#endif // BAR_ALIGN_REG_HH diff --git a/lily/include/bar-reg.hh b/lily/include/bar-reg.hh index f871915a01..8a6d1606c5 100644 --- a/lily/include/bar-reg.hh +++ b/lily/include/bar-reg.hh @@ -15,17 +15,18 @@ generate bars. Either user ("|:"), or default (new measure) */ class Bar_register : public Request_register { - void split_bar(Bar *& pre, Bar * no, Bar * &post); -public: Bar_req * bar_req_l_; Bar * bar_p_; - - virtual bool try_request(Request *req_l); - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); +public: Bar_register(); NAME_MEMBERS(); + + +protected: + virtual bool do_try_request(Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); }; #endif // BARREG_HH diff --git a/lily/include/bar.hh b/lily/include/bar.hh index eecc32f51f..447a807f0a 100644 --- a/lily/include/bar.hh +++ b/lily/include/bar.hh @@ -12,12 +12,15 @@ */ class Bar:public Item { public: - String type; + String type_str_; NAME_MEMBERS(); - Bar(String type); + SCORE_ELEM_CLONE(Bar) + Bar(); private: void do_print() const; +protected: + virtual void do_pre_processing(); Molecule*brew_molecule_p()const; }; #endif // BAR_HH diff --git a/lily/include/beam.hh b/lily/include/beam.hh index d1e28ee4f6..01726c57df 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -31,7 +31,7 @@ public: void set_grouping(Rhythmic_grouping def, Rhythmic_grouping current); void set_stemlens(); - SPANNER_CLONE(Beam) + SCORE_ELEM_CLONE(Beam) protected: virtual Interval do_width()const; virtual Offset center() const; diff --git a/lily/include/break-align-item.hh b/lily/include/break-align-item.hh new file mode 100644 index 0000000000..916e284d57 --- /dev/null +++ b/lily/include/break-align-item.hh @@ -0,0 +1,25 @@ +/* + break-align-item.hh -- declare Break_align_item + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef BREAK_ALIGN_ITEM_HH +#define BREAK_ALIGN_ITEM_HH + +#include "horizontal-align-item.hh" + +/// align breakable items (clef, bar, etc.) +class Break_align_item : public Horizontal_align_item { + +protected: + virtual void do_pre_processing(); +public: + NAME_MEMBERS(); + SCORE_ELEM_CLONE(Break_align_item) + +}; +#endif // BREAK_ALIGN_ITEM_HH diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index 23e346c083..ab089f0ffc 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -1,4 +1,3 @@ - /* clef-item.hh -- declare Clef_item @@ -14,6 +13,7 @@ */ class Clef_item : public Item { protected: + virtual void do_pre_processing(); Molecule* brew_molecule_p()const; public: @@ -21,10 +21,14 @@ public: int y_off; /// is this a change clef (smaller size)? - bool change; + bool change_b_; + + /// set because of existence of a bar + bool default_b_; /* *************** */ -NAME_MEMBERS(); + NAME_MEMBERS(); + SCORE_ELEM_CLONE(Clef_item) Clef_item(); void read(Clef_register const&); void read(String); diff --git a/lily/include/clef-reg.hh b/lily/include/clef-reg.hh index b78f3dd682..91dd8d57e7 100644 --- a/lily/include/clef-reg.hh +++ b/lily/include/clef-reg.hh @@ -19,10 +19,13 @@ class Clef_register : public Request_register { void read_req(Clef_change_req*); bool set_type(String); protected: - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); - virtual bool try_request(Request*); + virtual void do_process_requests(); + virtual void fill_staff_info(Staff_info&); + virtual void do_pre_move_processing(); + virtual void do_removal_processing(); + virtual void do_creation_processing(); + virtual void do_post_move_processing(); + virtual bool do_try_request(Request*); virtual void acknowledge_element(Score_elem_info); public: int c0_position_i_; diff --git a/lily/include/collision-reg.hh b/lily/include/collision-reg.hh index 5eef92a9e9..d0affb0df4 100644 --- a/lily/include/collision-reg.hh +++ b/lily/include/collision-reg.hh @@ -17,7 +17,7 @@ class Collision_register : public Request_register { protected: virtual void acknowledge_element(Score_elem_info); - virtual void pre_move_processing(); + virtual void do_pre_move_processing(); public: Collision_register(); NAME_MEMBERS(); diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index c4676c76af..285d0cbb85 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -18,8 +18,6 @@ class Command_req : public virtual Request { public: REQUESTMETHODS(Command_req, command); - virtual Terminate_voice_req *terminate() {return 0;} - virtual Group_change_req * groupchange() { return 0;} virtual Group_feature_req * groupfeature() { return 0; } virtual Measure_grouping_req * measuregrouping() { return 0; } virtual Clef_change_req * clefchange() { return 0; } @@ -93,12 +91,6 @@ public: REQUESTMETHODS(Measure_grouping_req, measuregrouping); }; -class Group_change_req : public Command_req { -public: - String newgroup_str_; - REQUESTMETHODS(Group_change_req, groupchange); -}; - /** draw a (repeat)-bar. This something different than #Barcheck_req#, the latter should only happen at the start of a measure. */ class Bar_req : public Command_req { @@ -108,10 +100,6 @@ public: int compare(const Bar_req&)const; REQUESTMETHODS(Bar_req,bar); }; -class Terminate_voice_req : public Command_req { -public: - REQUESTMETHODS(Terminate_voice_req,terminate); -}; class Group_feature_req : public Command_req { public: diff --git a/lily/include/complex-walker.hh b/lily/include/complex-walker.hh deleted file mode 100644 index cc16eef1b3..0000000000 --- a/lily/include/complex-walker.hh +++ /dev/null @@ -1,45 +0,0 @@ -/* - complex-walker.hh -- declare Complex_walker - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef COMPLEXWALKER_HH -#define COMPLEXWALKER_HH - -#include "lily-proto.hh" -#include "staff-walker.hh" -#include "score-elem-info.hh" - -/** - A staff walker which uses registers to decide what to print - */ -class Complex_walker: public Staff_walker { - bool try_command_request(Command_req *req_l); - void do_announces(); - void try_request(Request*req); - - - -public: - Walker_registers *walk_regs_p_; - - /* *************** */ - - void regs_process_requests(); - void typeset_element(Score_elem *elem_p); - void announce_element(Score_elem_info); - virtual void process_requests(); - virtual void do_post_move(); - virtual void do_pre_move(); - - Complex_walker(Staff*); - ~Complex_walker(); - -private: -}; - - -#endif // COMPLEXWALKER_HH - - diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh index 56a3e1a921..ece423d154 100644 --- a/lily/include/crescendo.hh +++ b/lily/include/crescendo.hh @@ -26,7 +26,7 @@ public: bool left_dyn_b_; Crescendo(); protected: - SPANNER_CLONE(Crescendo) + SCORE_ELEM_CLONE(Crescendo) virtual Molecule*brew_molecule_p()const; NAME_MEMBERS(); diff --git a/lily/include/dimen.hh b/lily/include/dimen.hh index a3f4e8876b..71b0036b72 100644 --- a/lily/include/dimen.hh +++ b/lily/include/dimen.hh @@ -4,7 +4,7 @@ #include "real.hh" #include "string.hh" -const Real INCH_TO_PT=72.0; +const Real INCH_TO_PT=72.270; const Real CM_TO_PT=INCH_TO_PT/2.54; const Real MM_TO_PT=CM_TO_PT/10; const Real PT_TO_PT =1.0; diff --git a/lily/include/dynamic-reg.hh b/lily/include/dynamic-reg.hh index 72823a79a1..4e13d25a6f 100644 --- a/lily/include/dynamic-reg.hh +++ b/lily/include/dynamic-reg.hh @@ -26,11 +26,10 @@ public: NAME_MEMBERS(); protected: virtual void acknowledge_element(Score_elem_info); - 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 bool do_try_request(Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); virtual void set_feature(Feature); }; diff --git a/lily/include/elem-group-item.hh b/lily/include/elem-group-item.hh new file mode 100644 index 0000000000..6a799526d0 --- /dev/null +++ b/lily/include/elem-group-item.hh @@ -0,0 +1,31 @@ +/* + elem-group-item.hh -- declare Element_group_item + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef ELEM_GROUP_ITEM_HH +#define ELEM_GROUP_ITEM_HH + +#include "elem-group.hh" +#include "item.hh" + +class Horizontal_vertical_group_item : public Item, public Horizontal_vertical_group { +public: + NAME_MEMBERS(); + SCORE_ELEM_CLONE(Horizontal_vertical_group_item) +protected: + virtual void do_print() const; +}; + +class Horizontal_group_item : public Item, public Horizontal_group { + NAME_MEMBERS(); + SCORE_ELEM_CLONE(Horizontal_group_item) +protected: + virtual void do_print() const { Elbement_group::do_print(); } +}; + +#endif // ELEM_GROUP_ITEM_HH diff --git a/lily/include/elem-group.hh b/lily/include/elem-group.hh index c0a23ccbcb..c49c425a45 100644 --- a/lily/include/elem-group.hh +++ b/lily/include/elem-group.hh @@ -1,5 +1,5 @@ /* - elem-group.hh -- declare Element_group + elem-group.hh -- declare Horizontal_vertical_group source file of the GNU LilyPond music typesetter @@ -11,27 +11,61 @@ #define ELEM_GROUP_HH #include "score-elem.hh" +class Elbement_group: public virtual Score_elem { +protected: + Link_array<Score_elem> elem_l_arr_; + + virtual void do_print() const ; +public: + Elbement_group(); + bool contains_b(Score_elem const *)const; + void add_element(Score_elem*); + NAME_MEMBERS(); + +}; + +class Horizontal_group : public Elbement_group { +public: + NAME_MEMBERS(); + Horizontal_group(Horizontal_group const&); + Horizontal_group(){} + void add_element(Score_elem*); +protected: + virtual void do_substitute_dependency(Score_elem*,Score_elem*); + virtual void do_print() const ; + virtual void translate_x(Real); + virtual Interval do_width()const; +}; + +class Vertical_group : public Elbement_group { +protected: + virtual void translate_y(Real); + virtual void do_print() const ; + virtual Interval do_height()const; + virtual void do_substitute_dependency(Score_elem*,Score_elem*); + void add_element(Score_elem*); +public: + Vertical_group(Vertical_group const &); + Vertical_group(){} + NAME_MEMBERS(); +}; + /** A class to treat a group of elements as a single entity. The dimensions are the unions of the dimensions of what it contains. Translation means translating the contents. */ -class Element_group : virtual Score_elem{ +class Horizontal_vertical_group : public Vertical_group, + public Horizontal_group +{ protected: - Link_array<Score_elem> elem_l_arr_; - virtual void do_substitute_dependency(Score_elem* old, Score_elem* new_l); - virtual Interval do_height()const; - virtual Interval do_width()const; - virtual void do_print() const ; - virtual Element_group* elem_group() { return this; } - - + virtual Horizontal_vertical_group* elem_group() { return this; } public: Element_group(); - Element_group(Element_group const&); + bool contains_b(Score_elem const *)const; NAME_MEMBERS(); - virtual void translate(Offset); - virtual void add_element(Score_elem*); - virtual String TeX_string()const; + virtual void do_substitute_dependency(Score_elem*,Score_elem*); + virtual void do_print() const; + void add_element(Score_elem*); }; #endif // ELEM_GROUP_HH diff --git a/lily/include/head-reg.hh b/lily/include/head-reg.hh index 82487b6882..e4e3c1ef16 100644 --- a/lily/include/head-reg.hh +++ b/lily/include/head-reg.hh @@ -15,10 +15,10 @@ struct Note_head_register : Request_register { /* *************** */ Note_head_register(); - virtual bool try_request(Request *req_l) ; - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); + virtual bool do_try_request(Request *req_l) ; + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); NAME_MEMBERS(); }; diff --git a/lily/include/horizontal-align-item.hh b/lily/include/horizontal-align-item.hh new file mode 100644 index 0000000000..6132046a26 --- /dev/null +++ b/lily/include/horizontal-align-item.hh @@ -0,0 +1,39 @@ +/* + horizontal-align-item.hh -- declare Horizontal_align_item + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef HORIZONTAL_ALIGN_ITEM_HH +#define HORIZONTAL_ALIGN_ITEM_HH +#include "elem-group.hh" +#include "item.hh" + +/** + Order elems left to right. + + TODO: insert(order, elem) + */ +class Horizontal_align_item : public Item { +protected: + Link_array<Item> item_l_arr_; + Array<int> priority_i_arr_; + int align_i_; + +public: + NAME_MEMBERS(); + SCORE_ELEM_CLONE(Horizontal_align_item) + void add(Item*, int p); + Horizontal_align_item(); +protected: + virtual void do_substitute_dependency(Score_elem * , Score_elem *); + /// do calculations before determining horizontal spacing + virtual void do_pre_processing(); + virtual void do_print()const; + virtual Interval do_width()const; + bool contains_b(Item*)const; +}; +#endif // HORIZONTAL_ALIGN_ITEM_HH diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index 1a413cfef4..bd45068ab4 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -10,6 +10,7 @@ #include "lily-proto.hh" #include "string.hh" #include "input.hh" +#include "virtual-methods.hh" /* boolean argument to accesor is copy_b..*/ #define IDACCESSOR( Input_staff, staff)\ @@ -27,20 +28,17 @@ struct Identifier : public Input { virtual ~Identifier() ; void print()const; - virtual char const *classname() const{ return "new Identifier"; } + NAME_MEMBERS(); void error(String); - IDACCESSOR(Input_staff, staff) - IDACCESSOR(Input_music, music) - IDACCESSOR(Music_voice, mvoice) + IDACCESSOR(Music, music) IDACCESSOR(Input_register, iregs) - - IDACCESSOR(Script_def, script) + IDACCESSOR(General_script_def, script) IDACCESSOR(Symtables, symtables) - IDACCESSOR(Music_general_chord, mchord) IDACCESSOR(Lookup,lookup) IDACCESSOR(Real,real) IDACCESSOR(Request, request) - IDACCESSOR(Input_score, score) + IDACCESSOR(Score, score) + IDACCESSOR(int, intid) protected: virtual void do_print()const=0; @@ -50,7 +48,7 @@ private: #define declare_id_class(Idclass, Class, accessor) \ struct Idclass : Identifier {\ - virtual char const *classname()const;\ + NAME_MEMBERS(); \ Idclass(String s, Class*st, int code);\ virtual Class* accessor(bool copy);\ ~Idclass();\ @@ -60,13 +58,12 @@ struct Idclass : Identifier {\ declare_id_class(Real_id, Real, real); -declare_id_class(Script_id, Script_def, script); +declare_id_class(Script_id, General_script_def, script); declare_id_class(Lookup_id, Lookup, lookup); declare_id_class(Symtables_id, Symtables, symtables); -declare_id_class(Staff_id, Input_staff, staff); -declare_id_class(M_chord_id, Music_general_chord, mchord); -declare_id_class(M_voice_id, Music_voice, mvoice); -declare_id_class(Score_id, Input_score, score); +declare_id_class(Music_id, Music, music); +declare_id_class(Int_id, int, intid); +declare_id_class(Score_id, Score, score); declare_id_class(Request_id, Request, request); declare_id_class(Input_regs_id, Input_register, iregs); diff --git a/lily/include/input-music.hh b/lily/include/input-music.hh deleted file mode 100644 index 31c60c2fc8..0000000000 --- a/lily/include/input-music.hh +++ /dev/null @@ -1,134 +0,0 @@ -/* - input-music.hh -- part of GNU LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef INPUTMUSIC_HH -#define INPUTMUSIC_HH - -#include "plist.hh" -#include "lily-proto.hh" -#include "voice.hh" -#include "moment.hh" - -struct Voice_list : public Link_list<Voice*> { - void translate_time(Moment dt); -}; - -/** - - A set voices. - Input_music is anything that can simply be regarded as/converted to - a set of voices "cooperating" or independant. It has some basic - characteristics that real music has too: - - - it is rhythmic (it has a length, and can be translated horizontally) - - a pitch (it can be transposed) - - */ -struct Input_music { - virtual Voice_list convert()const=0; - virtual Moment length()const=0; - virtual void translate_time(Moment dt)=0; - virtual ~Input_music(){} - virtual void print() const =0; - virtual void set_default_group(String)=0; - virtual void transpose(Melodic_req const&) const =0; - - - virtual Input_music *clone() const = 0; - virtual Simple_music *simple() { return 0; } -}; - -/// Simple music consists of one voice -struct Simple_music : Input_music { - Voice voice_; - - /* *** */ - virtual void transpose(Melodic_req const&) const ; - - virtual Simple_music*simple() { return this; } - void add(Voice_element*); - virtual void set_default_group(String g) { voice_.set_default_group(g); } - virtual Moment length()const; - virtual Voice_list convert()const; - virtual void translate_time(Moment dt); - virtual void print() const; - virtual Input_music *clone() const { - return new Simple_music(*this); - } -}; - -/// Complex_music consists of multiple voices -struct Complex_music : Input_music { - Pointer_list<Input_music*> elts; - /* *************** */ - virtual void transpose(Melodic_req const&) const ; - virtual void set_default_group(String g); - void add(Input_music*inmusic_p); - Complex_music(); - Complex_music(Complex_music const &); - virtual void print() const ; - void concatenate(Complex_music*); -}; - - -/** - A voice like list of music. - - different music forms which start after each other ( concatenated, - stacked "horizontally ) - - */ - -struct Music_voice : Complex_music { - - - /* *************** */ - Moment length()const; - virtual void translate_time(Moment dt); - virtual Voice_list convert()const; - void add_elt(Voice_element*); - virtual Input_music *clone() const { - return new Music_voice(*this); - } - virtual void print() const ; -}; - -/** - Multiple musicstuff stacked on top of each other - chord like : - - - different music forms which start at the same time ( stacked "vertically" ) - - */ -struct Music_general_chord : Complex_music { - - - /* *************** */ - - virtual Moment length()const; - virtual Voice_list convert()const; - virtual void translate_time(Moment dt); - void add_elt(Voice_element*); - virtual Input_music *clone() const { - return new Music_general_chord(*this); - } - - virtual void print() const ; -}; - -struct Multi_voice_chord : Music_general_chord { - void set_default_group(String); - virtual Input_music *clone() const { - return new Multi_voice_chord(*this); - } -}; -struct Voice_group_chord : Music_general_chord { - - virtual Input_music *clone() const { - return new Voice_group_chord(*this); - } -}; -#endif // INPUTMUSIC_HH diff --git a/lily/include/input-register.hh b/lily/include/input-register.hh index 74cfa7acf5..2d088a146b 100644 --- a/lily/include/input-register.hh +++ b/lily/include/input-register.hh @@ -14,32 +14,29 @@ #include "string.hh" #include "lily-proto.hh" #include "input.hh" +#include "string.hh" +#include "varray.hh" struct Input_register : Input { - Pointer_list<Input_register*> ireg_list_; + Pointer_list<Input_register*> contains_ireg_p_list_; + Array<String> consists_str_arr_; + Array<String> alias_str_arr_; String name_str_; + + void add(Input_register *); - void add(Input_register*); - Input_register(); - bool group_b() const; - ~Input_register(); - /** Get an Input_register with a certain name - - @return 0 if not found. - */ - Input_register *get_ireg_l(String name) const; - Input_register(Input_register const&); - /** - The names of all non -groups. - */ - Array<String> get_nongroups_str_arr() const; + bool accept_req_b(); + bool accepts_b(String); void print() const; - /** - Construct the registers. - */ - Array<Request_register*> get_nongroup_p_arr()const; + Register_group_register * get_group_register_p(); + Input_register * get_default_ireg_l(); + Input_register * recursive_find(String nm); + Input_register * find_ireg_l(String nm); }; -Request_register * get_nongroup_register_p(String); + +void add_global_input_register(Input_register* ireg_p); +Input_register*lookup_reg(String); +Request_register*get_register_p(String s); #endif // INPUT_REGISTER_HH diff --git a/lily/include/input-score.hh b/lily/include/input-score.hh deleted file mode 100644 index 436e5e0947..0000000000 --- a/lily/include/input-score.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* - input-score.hh -- declare Input_score - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef INPUTSCORE_HH -#define INPUTSCORE_HH - -#include "varray.hh" -#include "lily-proto.hh" -#include "plist.hh" -#include "string.hh" -#include "input.hh" - -/// the total music def of one movement -class Input_score : public Input { -public: - int errorlevel_i_; - - /// paper_, staffs_ and commands_ form the problem definition. - Paper_def *paper_p_; - Midi_def* midi_p_; - Pointer_list<Input_staff*> staffs_; - - - /* *************************************************************** */ - Input_score(); - Input_score(Input_score const&); - - void add(Input_staff*); - ~Input_score(); - /// construction - void set(Paper_def* paper_p); - void set(Midi_def* midi_p); - void print() const; - Score*parse(); -}; - -#endif diff --git a/lily/include/input-staff.hh b/lily/include/input-staff.hh deleted file mode 100644 index 4cf819876f..0000000000 --- a/lily/include/input-staff.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* - input-staff.hh -- declare Input_staff - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef INPUTSTAFF_HH -#define INPUTSTAFF_HH - -#include "string.hh" -#include "plist.hh" -#include "varray.hh" -#include "lily-proto.hh" -#include "input.hh" - -class Input_staff:public Input { -public: - - Pointer_list<Input_music*> music_; - Input_register * ireg_p_; - - /* *************** */ - ~Input_staff(); - void add(Input_music*m); - Input_staff(Input_staff const&); - Input_staff(); - Staff* parse(Score*); - void print() const; -}; - - -#endif // INPUTSTAFF_HH - diff --git a/lily/include/interpreter.hh b/lily/include/interpreter.hh new file mode 100644 index 0000000000..1c0703f16b --- /dev/null +++ b/lily/include/interpreter.hh @@ -0,0 +1,18 @@ +/* + interpretor.hh -- declare Interpreter + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef Interpreter_HH +#define Interpreter_HH + +class Interpreter { +public: + virtual bool interpret_request_b(Request*) { return false;} +}; + +#endif // Interpreter_HH diff --git a/lily/include/interpretor.hh b/lily/include/interpretor.hh new file mode 100644 index 0000000000..b13582f45a --- /dev/null +++ b/lily/include/interpretor.hh @@ -0,0 +1,32 @@ +/* + interpretor.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef Interpreter_HH +#define Interpreter_HH + +class Interpreter { +public: + /// link to my definition + Input_register * ireg_l_; + void interpret_request(Request *); + NAME_MEMBERS(); + ~Interpreter(); + /** typeset any items/spanners. Default: do nothing + */ + virtual void do_pre_move_processing(){} +}; + +class Paper_interpreter : Interpreter { + +}; + +class Midi_interpreter : Interpreter { +}; + +#endif // Interpreter_HH diff --git a/lily/include/item.hh b/lily/include/item.hh index 4ddc3ebd6c..109a9c8191 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -27,6 +27,13 @@ class Item : public virtual Score_elem { public: /// indirection to the column it is in PCol * pcol_l_; + + Item * broken_to_a_[2]; + + // nobreak = 0, pre =1, post = 2 + int break_status_i()const; + Item * find_prebroken_piece(PCol*)const; + Item * find_prebroken_piece(Line_of_score*)const; virtual Item *item() { return this; } Item(); @@ -34,6 +41,8 @@ public: NAME_MEMBERS(); virtual Line_of_score * line_l() const; protected: + virtual void do_breakable_col_processing(); + virtual void handle_prebroken_dependencies(); virtual void do_print()const; }; diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index 4b4c347eef..fda86e5375 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -19,7 +19,9 @@ struct Key_item : Item { /* *************** */ -NAME_MEMBERS(); + NAME_MEMBERS(); + SCORE_ELEM_CLONE(Key_item) + Key_item(int cposition); void add(int pitch, int acc); void read(const Key_register&); diff --git a/lily/include/key-reg.hh b/lily/include/key-reg.hh index bfa5fd0514..39a416bb64 100644 --- a/lily/include/key-reg.hh +++ b/lily/include/key-reg.hh @@ -21,10 +21,10 @@ struct Key_register : Request_register { bool default_key_b_; bool change_key_b_; - virtual bool try_request(Request *req_l); - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); + virtual bool do_try_request(Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); virtual void acknowledge_element(Score_elem_info); Key_register(); NAME_MEMBERS(); diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index b54fd5623e..380b5d1056 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -22,20 +22,23 @@ struct Beam; struct Beam_req; struct Blank_req; struct Box; +struct Break_align_item; struct Bracket_req; struct Cadenza_req; +struct Change_iterator; +struct Change_reg; struct Chord; struct Clef_change_req; struct Clef_item; struct Clef_register; struct Col_hpositions; +struct Chord; struct Colinfo; struct Collision; struct Collision_register; struct Command_req; struct Command_script_req; struct Complex_music; -struct Complex_walker; struct Cresc_req; struct Crescendo ; struct Decresc_req; @@ -44,18 +47,21 @@ struct Durational_req; struct Dynamic; struct Dynamic_req; struct Element_group; +struct Element_group_item; struct Feature; struct General_script_def; struct Group_change_req; struct Group_feature_req; +struct Horizontal_align_item; +struct Horizontal_group; +struct Horizontal_group_item; +struct Horizontal_vertical_group; struct Idealspacing; struct Identifier; -struct Input; +struct Interpreter; struct Input_file; -struct Input_music; struct Input_register; struct Input_score; -struct Input_staff; struct Item; struct Key; struct Key_change_req; @@ -85,16 +91,16 @@ struct Midi_item; struct Midi_output; struct Midi_pitch; struct Midi_score; -struct Midi_staff; struct Midi_stream; struct Midi_track; -struct Midi_walker; struct Mixed_qp; struct Molecule; struct Music_general_chord; struct Musical_script_req; struct Music_voice; struct Musical_req; +struct Music; +struct Music_list; struct My_lily_parser; struct Note_column; struct Note_column_register; @@ -128,7 +134,6 @@ struct Score; struct Score_column; struct Score_elem; struct Score_elem_info; -struct Score_walker; struct Script; struct Script_column; struct Script_def; @@ -143,11 +148,8 @@ struct Spacing_req ; struct Span_dynamic_req; struct Span_req; struct Spanner; -struct Staff; -struct Staff_column; struct Staff_side; struct Staff_symbol; -struct Staff_walker; struct Stem; struct Stem_beam_register; struct Stem_req; @@ -171,6 +173,8 @@ struct Time_description; struct Timing_req; struct Vertical_brace; struct Vertical_spanner; +struct Vertical_group; + struct Voice; struct Voice_element; struct Voice_group_registers; diff --git a/lily/include/local-key-reg.hh b/lily/include/local-key-reg.hh index 98abf99ccd..41088f7c60 100644 --- a/lily/include/local-key-reg.hh +++ b/lily/include/local-key-reg.hh @@ -20,9 +20,9 @@ struct Local_key_register : Request_register { Link_array<Item > forced_l_arr_; Link_array<Item > tied_l_arr_; /* *************** */ - virtual void process_requests(); + virtual void do_process_requests(); virtual void acknowledge_element(Score_elem_info); - virtual void pre_move_processing(); + virtual void do_pre_move_processing(); Local_key_register(); NAME_MEMBERS(); }; diff --git a/lily/include/lyric-register.hh b/lily/include/lyric-register.hh index 083654e66f..e8468f0b9f 100644 --- a/lily/include/lyric-register.hh +++ b/lily/include/lyric-register.hh @@ -16,10 +16,9 @@ class Lyric_register : public Request_register { Array<Lyric_req*> lreq_arr_; - virtual bool acceptable_request_b(Request*); - virtual bool try_request(Request*); - virtual void process_requests(); - virtual void post_move_processing(); + virtual bool do_try_request(Request*); + virtual void do_process_requests(); + virtual void do_post_move_processing(); public: NAME_MEMBERS(); Lyric_register(); diff --git a/lily/include/main.hh b/lily/include/main.hh index 334777183d..7ec479ebd2 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -5,7 +5,7 @@ void debug_init(); void set_debug(bool); void do_scores(); -void add_score(Input_score * s); +void add_score(Score* s); void set_default_output(String s); Input_score* current_iscore_l(); String find_file(String); diff --git a/lily/include/meter-reg.hh b/lily/include/meter-reg.hh index 5930ea08d9..26f9eaf0bf 100644 --- a/lily/include/meter-reg.hh +++ b/lily/include/meter-reg.hh @@ -10,19 +10,26 @@ #ifndef METERREG_HH #define METERREG_HH #include "register.hh" +#include "time-description.hh" +#include "grouping.hh" /** generate meters. */ class Meter_register : public Request_register { public: + Time_description time_; + Rhythmic_grouping default_grouping_; + Meter_change_req * meter_req_l_; Meter * meter_p_; - virtual bool try_request(Request *req_l); - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); + virtual void fill_staff_info(Staff_info&); + virtual bool do_try_request(Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_creation_processing(); + virtual void do_post_move_processing(); Meter_register(); NAME_MEMBERS(); }; diff --git a/lily/include/meter.hh b/lily/include/meter.hh index 7cd1d40ac3..14a50f0f45 100644 --- a/lily/include/meter.hh +++ b/lily/include/meter.hh @@ -24,6 +24,7 @@ protected: public: Meter(Array<Scalar> args) ; NAME_MEMBERS(); + SCORE_ELEM_CLONE(Meter) }; #endif // METER_HH diff --git a/lily/include/midi-output.hh b/lily/include/midi-output.hh index 575842ebbd..0338916a53 100644 --- a/lily/include/midi-output.hh +++ b/lily/include/midi-output.hh @@ -13,6 +13,7 @@ struct Midi_output { + #if 0 Midi_output(Score* score_l, Midi_def* ); void do_staff(Staff*st_l, int count); @@ -22,6 +23,7 @@ struct Midi_output { Score* score_l_; Midi_def* midi_l_; Midi_stream* midi_stream_l_; +#endif }; #endif // MIDIOUTPUT_HH diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index 2eac3747d6..96005c8931 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -7,11 +7,14 @@ #ifndef MIDIWALKER_HH #define MIDIWALKER_HH +#if 0 #include "lily-proto.hh" #include "grouping.hh" #include "staff-walker.hh" #include "pcursor.hh" #include "pqueue.hh" + + struct Note_event : PQueue_ent<Moment,Melodic_req*> { bool ignore_b_; @@ -42,10 +45,10 @@ class Midi_walker : public PCursor<Staff_column*> public: Midi_walker(Staff*, Midi_track*); - void process_requests(); + void do_process_requests(); ~Midi_walker(); }; - +#endif #endif // MIDIWALKER_HH diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index 37021a214e..2eccfd3ee8 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -22,6 +22,8 @@ struct Molecule { void add_bottom(const Molecule &m); void add(Molecule const &m); void translate(Offset); + void translate_y(Real); + void translate_x(Real); void add(Atom const & a) ; /// how big is #this#? Box extent() const; diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh new file mode 100644 index 0000000000..a0501d7fc9 --- /dev/null +++ b/lily/include/music-iterator.hh @@ -0,0 +1,96 @@ +/* + music-iterator.hh -- declare {Music,Chord,Voice}_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef MUSIC_ITERATOR_HH +#define MUSIC_ITERATOR_HH + +#include "lily-proto.hh" +#include "plist.hh" +#include "moment.hh" + +class Music_iterator { +protected: + bool first_b_; + +public: + Music_iterator *daddy_iter_l_; + NAME_MEMBERS(); + Register_group_register *report_to_reg_l_; + + static Music_iterator* static_get_iterator_p(Music*,Register_group_register*); + Music_iterator* get_iterator_p(Music*)const; + Music_iterator(); + virtual void next(Moment until); + virtual Moment next_moment()const; + virtual bool ok()const; + virtual ~Music_iterator(); + virtual void construct_children(); + virtual Register_group_register * get_req_acceptor_l(); +}; + +// duh. +class Request_iterator : public Music_iterator { + Request *req_l_; +public: + Request_iterator(Request const *); + NAME_MEMBERS(); +protected: + virtual void next(Moment); +}; + +class Change_iterator : public Music_iterator { + Change_reg * change_l_; +public: + NAME_MEMBERS(); + virtual void next(Moment); + Change_iterator(Change_reg*); +}; + +class Chord_iterator : public Music_iterator +{ + const Chord *chord_C_; + Pointer_list<Music_iterator*> children_p_list_; +public: + Chord_iterator(Chord const*); + NAME_MEMBERS(); +protected: + virtual void construct_children(); + virtual void next(Moment); + virtual Moment next_moment()const; + virtual bool ok()const; +}; + +class Voice_element_iterator : public Chord_iterator { + +protected: + virtual void construct_children(); +public: + Voice_element_iterator(Voice_element*); + NAME_MEMBERS(); +}; + + +class Voice_iterator : private PCursor<Music*>, public Music_iterator +{ + Moment here_mom_; + const Voice * voice_C_; + Music_iterator * iter_p_; + void next_element(); +public: + Voice_iterator(Voice const*); + NAME_MEMBERS(); +protected: + virtual void construct_children(); + ~Voice_iterator(); + virtual void next(Moment); + virtual Moment next_moment()const; + virtual bool ok()const; +}; + +#endif // MUSIC_ITERATOR_HH diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh new file mode 100644 index 0000000000..0198e98d8c --- /dev/null +++ b/lily/include/music-list.hh @@ -0,0 +1,91 @@ +/* + music-list.hh -- declare Music_list, Chord and Voice + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef MUSIC_LIST_HH +#define MUSIC_LIST_HH + +#include "music.hh" +#include "plist.hh" + + +/** + Music can be a list of other "Music" elements + */ +class Music_list : public Music { + +public: + int multi_level_i_; + + /// what kind of iterator needed to walk this music? + String type_str_; + + /// what name (or look for this name) + String id_str_; + Music_list(Music_list const&); + Music_list(); + NAME_MEMBERS(); + VIRTUAL_COPY_CONS(Music_list,Music) + virtual void add(Music*); + virtual void transpose(Melodic_req const *); + + Pointer_list<Music*> music_p_list_; +protected: + + virtual void do_print() const; +}; + +/** + Chord is a list of music-elements which happen simultaneously + */ + +class Chord : public Music_list { +public: + Chord(); + NAME_MEMBERS(); + VIRTUAL_COPY_CONS(Chord,Music) + virtual void translate(Moment dt); + virtual MInterval time_int()const; +}; + +class Voice_element : public Chord { +public: + NAME_MEMBERS(); + VIRTUAL_COPY_CONS(Voice_element,Music) +}; + +/** + Voice is a list of music-elements which are placed behind each other. + */ +class Voice : public Music_list { + +public: + Moment offset_mom_; + + Voice(); + NAME_MEMBERS(); + VIRTUAL_COPY_CONS(Voice, Music) + virtual void translate(Moment dt); + virtual MInterval time_int()const; +}; + +/** A simple piece of music, which wishes to change the spot of its + interpretor */ +class Change_reg : public Music { +public: + + /// what kind of iterator needed to walk this music? + String type_str_; + + /// what name (or look for this name) + String id_str_; + + NAME_MEMBERS(); + VIRTUAL_COPY_CONS(Change_reg, Music) +}; +#endif // MUSIC_LIST_HH diff --git a/lily/include/music.hh b/lily/include/music.hh index 06fbcd7395..eb4058c6dd 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -11,14 +11,23 @@ #ifndef MUSIC_HH #define MUSIC_HH -#include "plist.hh" #include "virtual-methods.hh" #include "input.hh" #include "minterval.hh" #include "lily-proto.hh" +#include "string.hh" +/** In Lily, everything that has a length and a pitch (which can be + transposed) is considered "music", + + Music is hierarchical: + + @seealso Music_list + */ class Music:public Input { public: + Music_list * parent_music_l_; + virtual MInterval time_int()const; virtual ~Music(){} void print() const; @@ -32,38 +41,6 @@ protected: }; -class Music_list : public Music { -public: - Music_list(Music_list const&); - Music_list(); - NAME_MEMBERS(); - VIRTUAL_COPY_CONS(Music_list,Music) - virtual void add(Music*); - virtual void transpose(Melodic_req const *); -protected: - Pointer_list<Music*> music_p_list_; - - virtual void do_print() const; -}; - - -class Chord : public Music_list { -public: - NAME_MEMBERS(); - VIRTUAL_COPY_CONS(Chord,Music) - virtual void translate(Moment dt); - virtual MInterval time_int()const; -}; - - -class MVoice : public Music_list { -public: - NAME_MEMBERS(); - VIRTUAL_COPY_CONS(MVoice, Music) - virtual void translate(Moment dt); - virtual MInterval time_int()const; -}; - #endif // MUSIC_HH diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 84d1da4440..122f1c20a8 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -16,7 +16,7 @@ /** - A request which is coupled to a #Voice_element# with nonzero duration. + A request which is coupled to a #Voice_element# Base class only */ class Musical_req : public virtual Request { @@ -30,6 +30,8 @@ public: virtual Beam_req *beam() { return 0 ; } virtual Rhythmic_req*rhythmic() { return 0; } virtual Musical_script_req*musicalscript() { return 0; } + virtual Text_req*text() { return 0; } + virtual Rest_req *rest() { return 0; } virtual Skip_req* skip() { return 0; } virtual Dynamic_req* dynamic() { return 0; } virtual Absolute_dynamic_req * absdynamic() { return 0; } @@ -40,13 +42,6 @@ public: }; -class Skip_req : public Musical_req { -public: - Moment duration_; - - virtual Moment duration() const; - REQUESTMETHODS(Skip_req, skip); -}; /** a request with a duration. This request is used only a base class. @@ -63,6 +58,10 @@ public: REQUESTMETHODS(Rhythmic_req, rhythmic); }; +class Skip_req : public Rhythmic_req { +public: + REQUESTMETHODS(Skip_req, skip); +}; struct Spacing_req :virtual Request { Moment next; Real distance; diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index feb3301b00..5ecfd7d62c 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -25,11 +25,12 @@ class My_lily_parser { Array<Input> define_spot_array_; String init_str_; - void add_requests( Voice_element*v); + void add_requests( Chord*v); + + Chord * get_note_element(Note_req * ,Duration *); + Chord* get_rest_element(String,Duration *); + Chord* get_word_element(Text_def*, Duration*); - Voice_element * get_note_element(Note_req * ,Duration *); - Voice_element* get_rest_element(String,Duration *); - Voice_element* get_word_element(Text_def*, Duration*); void set_last_duration(Duration const *); void set_default_duration(Duration const *); void set_duration_mode(String s); @@ -39,7 +40,7 @@ public: Duration default_duration_; String textstyle_str_; bool first_b_; - bool last_duration_mode ; + bool last_duration_mode_b_ ; Array<Request*> pre_reqs, post_reqs; int fatal_error_i_; Sources * source_l_; diff --git a/lily/include/note-column-reg.hh b/lily/include/note-column-reg.hh index 45b8d4d4fb..a15cd9108b 100644 --- a/lily/include/note-column-reg.hh +++ b/lily/include/note-column-reg.hh @@ -28,8 +28,8 @@ class Note_column_register :public Request_register { protected: virtual void set_feature(Feature); virtual void acknowledge_element(Score_elem_info); - virtual void pre_move_processing(); - virtual void post_move_processing(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); public: Note_column_register(); NAME_MEMBERS(); diff --git a/lily/include/p-col.hh b/lily/include/p-col.hh index 11d1cc8cc0..593420cea0 100644 --- a/lily/include/p-col.hh +++ b/lily/include/p-col.hh @@ -56,6 +56,8 @@ public: /// does this column have items bool used_b() const; + bool breakpoint_b() const; + void clean_breakable_items(); void add(Item *i); diff --git a/lily/include/p-score.hh b/lily/include/p-score.hh index 75b875c616..32231f6371 100644 --- a/lily/include/p-score.hh +++ b/lily/include/p-score.hh @@ -49,7 +49,7 @@ public: add the item in specified containers. If breakstatus is set properly, add it to the {pre,post}break of the pcol. */ - void typeset_item(Item *item_p, PCol *pcol_l,int breakstatus=1); + void typeset_item(Item *item_p, PCol *pcol_l,int breakstatus=0); /// add to bottom of pcols void add(PCol*); diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 1c067669e9..2ce328406b 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -1,5 +1,5 @@ /* -paper-def.hh -- declare Paper_def + paper-def.hh -- declare Paper_def source file of the GNU LilyPond music typesetter @@ -20,14 +20,15 @@ paper-def.hh -- declare Paper_def symbols, dimensions and constants This struct takes care of all kinds of symbols, dimensions and - constants. Most of them are related to the point-size of the fonts, - so therefore, the lookup table for symbols is also in here. - - TODO: - - add support for multiple fontsizes - split into "Input_paper_def" and Paper_def - add support for other len->wid conversions. + constants. Most of them are related to the point-size of the fonts, + so therefore, the lookup table for symbols is also in here. + + TODO: + + add support for multiple fontsizes + split into "Input_paper_def" and Paper_def + add support for other len->wid conversions. + */ class Paper_def { Lookup *lookup_p_; diff --git a/lily/include/pulk-voice.hh b/lily/include/pulk-voice.hh deleted file mode 100644 index 085a0a3ff6..0000000000 --- a/lily/include/pulk-voice.hh +++ /dev/null @@ -1,46 +0,0 @@ -/* - pulk-voice.hh -- declare Pulk_voice - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef PULK_VOICE_HH -#define PULK_VOICE_HH - -#include "lily-proto.hh" -#include "lily-proto.hh" -#include "moment.hh" -#include "priorities.hh" -#include "pcursor.hh" - -/** - Align requests with starting time. - - To our foreign readers "pulk"ing is what you do with the stuff in - your nose to get it out. (and I don't mean blowing) */ -class Pulk_voice -{ - PCursor<Voice_element*> cur_; - Moment elt_mom_; - Priorities<Moment> subtle_moment_priorities_; - int subtle_idx_; - void set_subtle(); - void next(); -public: - int staff_idx_; - - Moment when()const; - bool ok()const { return cur_.ok() ; } - - Pulk_voice(Voice*, int staff_idx); - - /** - Get the requests at when(), and advance. - */ - Array<Request*> get_req_l_arr(); -}; - -#endif // PULK_VOICE_HH diff --git a/lily/include/pulk-voices.hh b/lily/include/pulk-voices.hh deleted file mode 100644 index fd388d143e..0000000000 --- a/lily/include/pulk-voices.hh +++ /dev/null @@ -1,53 +0,0 @@ -/* - pulk-voices.hh -- declare Pulk_voices - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> - - TODO - integrate Meter handling, to guarantee proper creation of staff_columns. -*/ - - -#ifndef PULK_VOICES_HH -#define PULK_VOICES_HH - -#include "pqueue.hh" -#include "plist.hh" -#include "moment.hh" -#include "lily-proto.hh" -#include "lily-proto.hh" -#include "voice.hh" -#include "time-description.hh" - - -struct Voice_l { - Voice *l_; - int staff_idx_; - Voice_l(Voice*v, int i){ l_ = v; - staff_idx_ = i; - } - Voice_l() { l_ = 0; staff_idx_ =0; } -}; -int compare(Voice_l const &p1, Voice_l const &p2); - -class Pulk_voices -{ -PQueue< Voice_l > voice_pq_; - Pointer_list< Pulk_voice * > pulk_p_list_; - Link_list<Staff *> staff_l_list_; - Array < Time_description > time_arr_; - Moment next_mom_; - -public: - Moment last_; - bool time_checks_failed_b() const; - bool ok() const; - Moment next_mom() const; - Pulk_voices(Link_list<Staff*> const&); - void get_aligned_request(Request_column *col_l ); -}; - - -#endif // PULK_VOICES_HH diff --git a/lily/include/register-group.hh b/lily/include/register-group.hh index 9d13c292f9..e0778d8e4e 100644 --- a/lily/include/register-group.hh +++ b/lily/include/register-group.hh @@ -10,7 +10,7 @@ #ifndef REGISTERGROUP_HH #define REGISTERGROUP_HH - +#include "parray.hh" #include "plist.hh" #include "score-elem-info.hh" #include "register.hh" @@ -22,9 +22,24 @@ class Register_group_register : public Request_register { protected: Pointer_list<Request_register*> reg_list_; + Link_array<Register_group_register> group_l_arr_; + Link_array<Request_register> nongroup_l_arr_; + String id_str_; + + Array<Score_elem_info> announce_info_arr_; + virtual void do_print()const; + public: - + /// Score_register = 0, Staff_registers = 1, etc) + virtual int depth_i()const; + /** + Go up in the tree. default: choose next parent + */ + Register_group_register * ancestor_l(int l=1); + + Input_register * ireg_l_; + /** Junk #reg_l#. @@ -38,18 +53,25 @@ public: /** Remove #reg_l# from the list, and return it. */ - virtual Request_register * get_register_p(Request_register*reg_l); + virtual Request_register * remove_register_p(Request_register*reg_l); virtual void set_feature(Feature i); - virtual bool acceptable_request_b(Request*)const; virtual void sync_features() ; - virtual void pre_move_processing(); - virtual void post_move_processing(); - virtual void acknowledge_element(Score_elem_info info); - virtual bool try_request(Request*); - virtual void process_requests(); - virtual ~Register_group_register(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); + + virtual void do_removal_processing(); + virtual bool do_try_request(Request*); + virtual void do_process_requests(); + virtual Staff_info get_staff_info()const; + + virtual Register_group_register * find_register_l(String name,String id); + virtual void do_announces(); + virtual void announce_element(Score_elem_info); + virtual Register_group_register* find_get_reg_l(String name, String id); + virtual Register_group_register * get_default_interpreter(); + virtual void add(Request_register* reg_p); - void add(Array<Request_register*> reg_p_arr); + virtual bool contains_b(Request_register*)const; }; diff --git a/lily/include/register.hh b/lily/include/register.hh index 8ede14b1d3..c628276429 100644 --- a/lily/include/register.hh +++ b/lily/include/register.hh @@ -16,6 +16,9 @@ #include "score-elem-info.hh" #include "staff-info.hh" + + + /** a struct which processes requests, and creates the #Score_elem#s. It may use derived classes. Hungarian postfix: register @@ -26,46 +29,43 @@ class Request_register { You cannot copy a Request_register */ Request_register(const Request_register&){} + + enum { + VIRGIN, + CREATION_INITED, + MOVE_INITED, + ACCEPTED_REQS, + PROCESSED_REQS, + ACKED_REQS, + MOVE_DONE + } status; + protected: /// utility virtual Paper_def * paper() const; - /** - try to fit the request in this register - - @return - false: not noted, not taken. - - true: request swallowed. Don't try to put the request elsewhere. - - - Default: always return false - */ - virtual bool try_request(Request *req_l); /// make items/spanners with the requests you got - virtual void process_requests(){} + virtual void do_process_requests(){} /** typeset any items/spanners. Default: do nothing */ - virtual void pre_move_processing(){} + virtual void do_pre_move_processing(){} /** reset any appropriate data. Default: do nothing */ - virtual void post_move_processing(){} + virtual void do_post_move_processing(){} - /** - Is this request eligible to be processed? Default: return false. - */ - virtual bool acceptable_request_b(Request*) const; + + virtual void do_creation_processing () {} + virtual void do_removal_processing() {} /** typeset a "command" item. Default: pass on to daddy. If the column is not breakable, #pre_p# and #post_p# are junked */ - virtual void typeset_breakable_item(Item * pre_p , - Item * nobreak_p, Item * post_p); + virtual void typeset_breakable_item(Item * nobreak_p); /** Invoke walker method to typeset element. Default: pass on to daddy. */ @@ -95,18 +95,38 @@ protected: */ virtual void sync_features() {} - + virtual bool contains_b(Request_register*reg_l)const; /** Get information on the staff. Default: ask daddy. */ - virtual Staff_info get_staff_info(); + virtual Staff_info get_staff_info()const; + virtual void fill_staff_info(Staff_info&); virtual void do_print()const; + /* + @see{try_request} + Default: always return false + */ + virtual bool do_try_request(Request *req_l); public: - /** Every Request_register (except for the 'top' which is directly - inside the Staff_walker, is a element of a group. */ + void pre_move_processing(); + void process_requests(); + /** + try to fit the request in this register + + @return + false: not noted, not taken. + + true: request swallowed. Don't try to put the request elsewhere. + + */ + bool try_request(Request*); + + void post_move_processing(); + virtual Interpreter * interpreter_l() { return 0; } + Register_group_register * daddy_reg_l_; Request_register(); diff --git a/lily/include/request-column.hh b/lily/include/request-column.hh deleted file mode 100644 index 82377cf3df..0000000000 --- a/lily/include/request-column.hh +++ /dev/null @@ -1,35 +0,0 @@ -/* - request-column.hh -- declare Request_column - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef REQUEST_COLUMN_HH -#define REQUEST_COLUMN_HH -#include "plist.hh" -#include "lily-proto.hh" -#include "moment.hh" -#include "varray.hh" -/** - Like staff_column, but Score wide. One per when(). - */ -class Request_column -{ - Pointer_list<Staff_column*> staff_cols_; - Array<Staff_column*> staff_col_l_arr_; - Moment when_; - -public: - Score_column *musical_column_l_, *command_column_l_; - Request_column(Link_list<Staff*> const& ); - bool used_b()const; - Moment when(); - void add_reqs(int staff_idx, Array<Request*> const&); - void update_time(int staff_idx, Time_description &); - void set_score_cols(Score_column*, Score_column*); -}; - -#endif // REQUEST_COLUMN_HH diff --git a/lily/include/request.hh b/lily/include/request.hh index 6d9343a065..4fa49691d8 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -8,33 +8,33 @@ #ifndef REQUEST_HH #define REQUEST_HH -// GNU LilyPond's second egg of columbus! #include "glob.hh" #include "string.hh" #include "moment.hh" #include "virtual-methods.hh" #include "input.hh" +#include "music.hh" /** a voice element wants something printed. Hungarian postfix: req @see lilygut manpage */ -class Request : public Input { +class Request : public Music { + public: - Voice_element*elt_l_; + Voice * voice_l(); /* *************** */ - Voice * voice_l(); - Request(); - Request(Request const&); + virtual ~Request(){} NAME_MEMBERS(); - virtual Request* clone() const { return new Request(*this); } - void print()const ; + VIRTUAL_COPY_CONS(Request,Music) + void print()const ; + virtual MInterval time_int() const; virtual void transpose(Melodic_req const &){} virtual Moment duration() const { return 0; } @@ -43,8 +43,6 @@ public: */ virtual Barcheck_req *barcheck() { return 0; } virtual Script_req *script() { return 0;} - virtual Text_req*text() { return 0; } - virtual Rest_req *rest() { return 0; } virtual Span_req *span() { return 0; } virtual Spacing_req * spacing() { return 0; } virtual Blank_req * blank() { return 0; } diff --git a/lily/include/rest-collision-reg.hh b/lily/include/rest-collision-reg.hh index a1e1395735..b324fe245f 100644 --- a/lily/include/rest-collision-reg.hh +++ b/lily/include/rest-collision-reg.hh @@ -18,7 +18,7 @@ class Rest_collision_register : public Request_register { Array< Collision *> collision_l_arr_; protected: virtual void acknowledge_element(Score_elem_info); - virtual void pre_move_processing(); + virtual void do_pre_move_processing(); public: Rest_collision_register(); NAME_MEMBERS(); diff --git a/lily/include/score-align-reg.hh b/lily/include/score-align-reg.hh new file mode 100644 index 0000000000..533e47103c --- /dev/null +++ b/lily/include/score-align-reg.hh @@ -0,0 +1,28 @@ +/* + score-align-reg.hh -- declare Score_align_reg + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef SCORE_ALIGN_REG_HH +#define SCORE_ALIGN_REG_HH + +#include "register.hh" + +class Score_align_register: public Request_register +{ + + const char* type_ch_C_; + Horizontal_group_item * align_p_; +public: + int priority_i_; + Score_align_register(char const*); + NAME_MEMBERS(); +protected: + virtual void acknowledge_element(Score_elem_info); + virtual void do_pre_move_processing(); +}; +#endif // SCORE_ALIGN_REG_HH diff --git a/lily/include/score-column.hh b/lily/include/score-column.hh index 4d6fc17af7..80986a4f82 100644 --- a/lily/include/score-column.hh +++ b/lily/include/score-column.hh @@ -1,11 +1,15 @@ /* - sccol.hh -- part of GNU LilyPond + score-column.hh -- declare Score_column - (c) 1996,97 Han-Wen Nienhuys + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#ifndef SCCOL_HH -#define SCCOL_HH + +#ifndef SCORE_COLUMN_HH +#define SCORE_COLUMN_HH + #include "lily-proto.hh" #include "varray.hh" #include "moment.hh" @@ -54,7 +58,9 @@ public: instantiate_compare(Score_column&, Score_column::compare); -#endif // SCCOL_HH +#endif // SCORE_COLUMN_HH + + diff --git a/lily/include/score-elem.hh b/lily/include/score-elem.hh index d567f8ef02..95c6b0ba1d 100644 --- a/lily/include/score-elem.hh +++ b/lily/include/score-elem.hh @@ -13,6 +13,7 @@ #include "virtual-methods.hh" #include "directed-graph.hh" +#define SCORE_ELEM_CLONE(T) VIRTUAL_COPY_CONS(T, Score_elem) /** Both Spanner and Item are Score_elem's. Most Score_elem's depend on other Score_elem's, eg, Beam needs to know and set direction of @@ -37,6 +38,8 @@ class Score_elem : private Directed_graph_node { enum Status { ORPHAN, // not yet added to pstaff VIRGIN, // added to pstaff + PREBREAKING, + PREBROKEN, PRECALCING, PRECALCED, // calcs before spacing done BREAKING, @@ -48,15 +51,10 @@ class Score_elem : private Directed_graph_node { DELETED, // to catch malloc mistakes. } status; - - Score_elem* dependency(int) const; - Score_elem* dependent(int) const; - int dependent_size() const; - int dependency_size() const; public: PScore *pscore_l_; - int group_element_i_; - + int x_group_element_i_; + int y_group_element_i_; Score_elem(Score_elem const&); virtual String TeX_string () const ; virtual void print() const; @@ -66,20 +64,22 @@ public: virtual ~Score_elem(); Score_elem(); NAME_MEMBERS(); - virtual bool is_type_b(const char *); Interval width() const; Interval height() const; + virtual void translate_x(Real); + virtual void translate_y(Real); /** translate the symbol. The symbol does not have to be created yet. Overridable, since this score-elem might act as a pseudo-list. */ - virtual void translate(Offset); + void translate(Offset); Offset offset()const; void add_processing(); void OK() const; void pre_processing(); + void breakable_col_processing(); void break_processing(); void post_processing(); @@ -95,9 +95,10 @@ public: virtual Spanner* spanner() { return 0; } - virtual Element_group* elem_group() { return 0; } + virtual Horizontal_vertical_group* elem_group() { return 0; } virtual Item * item() { return 0; } virtual Line_of_score * line_l() const; + SCORE_ELEM_CLONE(Score_elem) protected: virtual Interval do_height()const; @@ -112,13 +113,25 @@ protected: /// do calculations before determining horizontal spacing virtual void do_pre_processing(); - + virtual void do_breakable_col_processing(); /// do calculations after determining horizontal spacing virtual void do_post_processing(); virtual void do_substitute_dependency(Score_elem * , Score_elem *); virtual void do_break_processing(); virtual void handle_broken_dependencies(); + virtual void handle_prebroken_dependencies(); + + Score_elem* dependency(int) const; + Score_elem* dependent(int) const; + int dependent_size() const; + int dependency_size() const; + + + /// no dimension, translation is noop + bool empty_b_; + /// do not print anything black + bool transparent_b_; }; diff --git a/lily/include/score-halign-reg.hh b/lily/include/score-halign-reg.hh new file mode 100644 index 0000000000..8a0559ff8d --- /dev/null +++ b/lily/include/score-halign-reg.hh @@ -0,0 +1,23 @@ +/* + score-halign-reg.hh -- declare Score_horizontal_align_register + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef SCORE_HALIGN_REG_HH +#define SCORE_HALIGN_REG_HH +#include "register.hh" +class Score_horizontal_align_register : public Request_register { + + Break_align_item * halign_p_; +public: + NAME_MEMBERS(); + Score_horizontal_align_register(); +protected: + virtual void acknowledge_element(Score_elem_info); + virtual void do_pre_move_processing(); +}; +#endif // SCORE_HALIGN_REG_HH diff --git a/lily/include/score-reg.hh b/lily/include/score-reg.hh new file mode 100644 index 0000000000..569ddb7ac2 --- /dev/null +++ b/lily/include/score-reg.hh @@ -0,0 +1,55 @@ +/* + score-reg.hh -- declare Score_register + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef SCORE_REG_HH +#define SCORE_REG_HH + +#include "register-group.hh" +#include "pqueue.hh" + +class Score_register : public Register_group_register { + Line_of_score * scoreline_l_; + Score * score_l_; + + Array<Item*> nobreak_item_p_arr_; + Link_array<Score_elem> musical_item_p_arr_; + + Score_column* command_column_l_; + Score_column* musical_column_l_; + + friend class Score; + void set_cols(Score_column*,Score_column*); + void typeset_all(); + + PQueue<Moment> extra_mom_pq_; + Moment last_mom_; +public: + NAME_MEMBERS(); + + void add_moment_to_process(Moment); + Score_register(); + int depth_i() const; +protected: + void set_score(Score * score_l); + + + virtual Staff_info get_staff_info()const; + virtual bool do_try_request(Request*); + virtual void do_creation_processing(); + virtual void do_removal_processing(); + virtual void announce_element(Score_elem_info); + virtual void typeset_breakable_item(Item * nobreak_p); + virtual void do_announces(); + virtual void typeset_element(Score_elem*elem_p); + virtual Paper_def * paper() const; + virtual void do_pre_move_processing(); + +}; + +#endif // SCORE_REG_HH diff --git a/lily/include/score-walker.hh b/lily/include/score-walker.hh deleted file mode 100644 index ca19c0f942..0000000000 --- a/lily/include/score-walker.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* - score-walker.hh -- declare Score_walker - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> - - -*/ - - -#ifndef SCOREWALKER_HH -#define SCOREWALKER_HH -#include "pcursor.hh" -#include "lily-proto.hh" -#include "varray.hh" - - -/** - walk through the score_columns, and while doing so, walk all staffs in a score. - - TODO - support for vertical spanners. - */ -class Score_walker : public PCursor<Score_column *> -{ - Score* score_l_; - /// walkers for the individual staves. - Array<Staff_walker *> walker_p_arr_; - Array<Staff_walker *> disallow_break_walk_l_arr; - int disallow_break_count_; - int breaks_i_; - void reinit(); -public: - bool break_allowed_b(); - void allow_break(Staff_walker*w); - Score_walker(Score*); - ~Score_walker(); - Moment when(); - void operator++(int); - /// process staff walkers. - void process(); -}; -#endif // SCOREWALKER_HH diff --git a/lily/include/score.hh b/lily/include/score.hh index 3641468837..846144d0cd 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -20,19 +20,17 @@ #include "lily-proto.hh" /// the total music def of one movement -struct Score { +class Score: public Input { +public: /// paper_, staffs_ and commands_ form the problem definition. Paper_def *paper_p_; Midi_def *midi_p_; - Pointer_list<Staff*> staffs_; + Music * music_p_; - /// "runtime" fields for setting up spacing - Pointer_list<Request_column*> rcols_; Pointer_list<Score_column*> cols_; PScore *pscore_p_; - Input input_; int errorlevel_i_; /* *************************************************************** */ @@ -40,7 +38,6 @@ struct Score { /// construction Score(); ~Score(); - void add(Staff*); /// do everything except outputting to file void process(); @@ -64,10 +61,11 @@ struct Score { /// when does the last *musical* element finish? Moment last() const; + Score(Score const&); + private: void paper_output(); void setup_music(); - void process_music(); /// do midi stuff void midi(); @@ -77,7 +75,6 @@ private: // utils: PCursor<Score_column*> create_cols(Moment, PCursor<Score_column*> &last); - Score(Score const&){} /** make the pcol_l_ fields of each Score_column point to the correct PCol, diff --git a/lily/include/scoreline.hh b/lily/include/scoreline.hh index 1aa02fa7dd..16accf1a83 100644 --- a/lily/include/scoreline.hh +++ b/lily/include/scoreline.hh @@ -1,4 +1,3 @@ - /* scoreline.hh -- part of GNU LilyPond @@ -10,23 +9,26 @@ #include "colhpos.hh" #include "spanner-elem-group.hh" +#include "vertical-align-elem.hh" /// the columns of a score that form one line. -class Line_of_score : public Spanner_elem_group { +class Line_of_score : public Spanner, public Vertical_align_elem { public: - Link_array<Spanner_elem_group> line_arr_; - Link_array<PCol > cols; + Link_array<PCol> cols; bool error_mark_b_; virtual String TeX_string() const; - /* *************** */ + NAME_MEMBERS(); Line_of_score(); - void add_line(Spanner_elem_group *); + void add(Score_elem *); /// is #c# contained in #*this#? bool contains_b(PCol const *c)const; + bool contains_b(Score_elem const*e) const { + return Vertical_align_elem::contains_b(e); + } Link_array<Line_of_score> get_lines()const; void set_breaking(Array<Col_hpositions> const&); @@ -34,11 +36,9 @@ public: protected: virtual void break_into_pieces(); virtual void do_substitute_dependency(Score_elem*,Score_elem*); - virtual void do_pre_processing(); - virtual void do_post_processing(); - - - SPANNER_CLONE(Line_of_score) + virtual Interval do_width()const; + virtual void do_print() const; + SCORE_ELEM_CLONE(Line_of_score) }; #endif diff --git a/lily/include/script-column.hh b/lily/include/script-column.hh index 3b94feda7a..242acd4bdb 100644 --- a/lily/include/script-column.hh +++ b/lily/include/script-column.hh @@ -10,12 +10,11 @@ #ifndef SCRIPT_COLUMN_HH #define SCRIPT_COLUMN_HH -#include "elem-group.hh" -#include "item.hh" +#include "elem-group-item.hh" /** a struct for treating a group of noteheads (noteheads, stem (chord) and scripts ) as a single entity. */ -class Script_column : public Item, public Element_group { +class Script_column : public Horizontal_vertical_group_item { protected: virtual void do_print() const; diff --git a/lily/include/script-reg.hh b/lily/include/script-reg.hh index 7fa5294814..41dccfb6c3 100644 --- a/lily/include/script-reg.hh +++ b/lily/include/script-reg.hh @@ -21,11 +21,11 @@ public: NAME_MEMBERS(); Script_register(); protected: - virtual bool try_request(Request*); - virtual void process_requests(); + virtual bool do_try_request(Request*); + virtual void do_process_requests(); virtual void acknowledge_element(Score_elem_info); - virtual void pre_move_processing(); - virtual void post_move_processing(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); }; diff --git a/lily/include/slur-reg.hh b/lily/include/slur-reg.hh index a18d7234b6..4fae2f9bbc 100644 --- a/lily/include/slur-reg.hh +++ b/lily/include/slur-reg.hh @@ -19,13 +19,12 @@ class Slur_register :public Request_register { /* *************** */ protected: virtual ~Slur_register(); - virtual bool try_request(Request*); + virtual bool do_try_request(Request*); virtual void set_feature(Feature); - virtual bool acceptable_request_b(Request*); - virtual void process_requests(); + virtual void do_process_requests(); virtual void acknowledge_element(Score_elem_info); - virtual void pre_move_processing(); - virtual void post_move_processing(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); public: Slur_reg(); NAME_MEMBERS(); diff --git a/lily/include/slur.hh b/lily/include/slur.hh index 5731317866..7ec510afa2 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -24,7 +24,7 @@ protected: virtual void do_post_processing(); virtual void do_substitute_dependency(Score_elem*, Score_elem*); virtual void do_pre_processing(); - SPANNER_CLONE(Slur) + SCORE_ELEM_CLONE(Slur) NAME_MEMBERS(); }; diff --git a/lily/include/spanner-elem-group.hh b/lily/include/spanner-elem-group.hh index 0d91319b63..d133fb66b5 100644 --- a/lily/include/spanner-elem-group.hh +++ b/lily/include/spanner-elem-group.hh @@ -13,12 +13,13 @@ #include "spanner.hh" #include "elem-group.hh" -class Spanner_elem_group : public Spanner, public Element_group { +class Spanner_elem_group : public Spanner, public Horizontal_vertical_group { protected: virtual Interval do_width()const; virtual void do_print() const; - SPANNER_CLONE(Spanner_elem_group) + SCORE_ELEM_CLONE(Spanner_elem_group) +public: NAME_MEMBERS(); }; #endif // SPANNER_ELEM_GROUP_HH diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 84c85f3e98..2aee51cc2e 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -11,7 +11,6 @@ #include "score-elem.hh" -#define SPANNER_CLONE(T) VIRTUAL_COPY_CONS(T, Spanner) /** a symbol which is attached between two columns. A spanner is a symbol which spans across several columns, so its final appearance @@ -44,7 +43,7 @@ public: bool broken_b() const; Spanner* find_broken_piece(Line_of_score*)const; protected: - SPANNER_CLONE(Spanner) + SCORE_ELEM_CLONE(Spanner) virtual void break_into_pieces(); Link_array<Spanner> broken_into_l_arr_; diff --git a/lily/include/staff-column.hh b/lily/include/staff-column.hh deleted file mode 100644 index 7550ae27fa..0000000000 --- a/lily/include/staff-column.hh +++ /dev/null @@ -1,50 +0,0 @@ -/* - staff-column.hh -- declare Staff_column - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STAFFCOLUMN_HH -#define STAFFCOLUMN_HH - -#include "lily-proto.hh" -#include "varray.hh" -#include "moment.hh" - -/// store simultaneous requests -class Staff_column { - - Staff_column(Staff_column const&); - -public: - Array<Request*> creationreq_l_arr_; - Array<Request*> musicalreq_l_arr_; - Array<Request*> commandreq_l_arr_; - Staff * staff_l_; - Request_column * req_col_l_; - /// fields to collect timing data vertically. - Array<Timing_req*> timing_req_l_arr_; - - /* *************** */ - - Staff_column(); - Score_column* command_column_l(); - Score_column* musical_column_l(); - Moment when() const; - void set_req_col(Request_column *c1); - void add_reqs (Array<Request*> req_l_arr); - void OK() const; - ~Staff_column(); - void update_time(Time_description&, Rhythmic_grouping*); - void typeset_breakable_items(Array<Item *> &pre_p_arr, - Array<Item *> &nobreak_p_arr, - Array<Item *> &post_p_arr); - void typeset_musical_item(Item *i); - void setup_one_request(Request*); -protected: -}; - - - -#endif // STAFFCOLUMN_HH - diff --git a/lily/include/staff-info.hh b/lily/include/staff-info.hh index a3aa533d2b..1f65f20f00 100644 --- a/lily/include/staff-info.hh +++ b/lily/include/staff-info.hh @@ -10,27 +10,28 @@ #ifndef STAFF_INFO_HH #define STAFF_INFO_HH +#include "lily-proto.hh" + /// struct to pass staff info along a Request_register hierarchy. 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_; Rhythmic_grouping const *rhythmic_C_; + Score_column *musical_l_; + Score_column *command_l_; /// bool break_allowed_b_; - + Score * score_l_; Moment when(); - Staff * staff_l(); Score *score_l(); PCol * command_pcol_l(); - PCol * musical_pcol_l(); - Staff_column *column_l(); - Score_column *musical_l(); + Score_column* musical_l(); Score_column *command_l(); + PCol * musical_pcol_l(); Staff_info(); }; diff --git a/lily/include/staff-regs.hh b/lily/include/staff-regs.hh index 8f7bba3485..783a7438f5 100644 --- a/lily/include/staff-regs.hh +++ b/lily/include/staff-regs.hh @@ -14,28 +14,24 @@ /** Registers which manage a Staff (one 5-line linestaff) + */ class Staff_registers : public Register_group_register { - int c0_position_i_; - Input_register const *ireg_C_; - int base_position_i_; - Array<Voice_group_registers*> group_l_arr_; - Staff_symbol * staff_sym_l_; + Line_of_staff *staffline_p_; + Link_array<Score_elem> staff_elem_l_arr_; + + void group_staff_elems(); protected: - virtual bool try_request(Request * r); - virtual Staff_info get_staff_info(); - virtual bool acceptable_request_b(Request*) const ; - virtual void acknowledge_element(Score_elem_info); + virtual void do_pre_move_processing(); + virtual void do_creation_processing(); + virtual void do_removal_processing(); + virtual void typeset_element(Score_elem*); + virtual void typeset_breakable_item( Item * it_p); + public: - /* *************** */ NAME_MEMBERS(); - void change_group(Group_change_req * greq_l, - Voice_registers *voice_regs_l, - Voice_group_registers * old_group); - Voice_group_registers * get_group(String id); - void terminate_register(Request_register * reg); - Staff_registers(Input_register const*); + Staff_registers(); }; #endif // STAFF_REGS_HH diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index d25d109d22..1d4245abbb 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -34,6 +34,7 @@ public: Staff_side(); void add_support(Score_elem*); + NAME_MEMBERS(); protected: virtual void do_substitute_dependency(Score_elem *, Score_elem*); diff --git a/lily/include/staff-sym-reg.hh b/lily/include/staff-sym-reg.hh index 06303c0aa4..b21e697dea 100644 --- a/lily/include/staff-sym-reg.hh +++ b/lily/include/staff-sym-reg.hh @@ -17,14 +17,14 @@ */ class Staff_sym_register : public Request_register { Staff_symbol *span_p_; - Moment last_mom_; public: Staff_sym_register(); NAME_MEMBERS(); protected: - virtual void process_requests(); - ~Staff_sym_register(); - virtual void pre_move_processing(); - virtual void post_move_processing(); + virtual void do_process_requests(); + virtual void fill_staff_info(Staff_info&); + virtual void do_removal_processing(); + virtual void do_creation_processing(); + }; #endif // STAFF_SYM_REG_HH diff --git a/lily/include/staff-sym.hh b/lily/include/staff-sym.hh index dc50a37e0a..68b1c11d4a 100644 --- a/lily/include/staff-sym.hh +++ b/lily/include/staff-sym.hh @@ -28,7 +28,7 @@ public: Real inter_note_f()const; int steps_i()const; protected: - SPANNER_CLONE(Staff_symbol) + SCORE_ELEM_CLONE(Staff_symbol) virtual Molecule* brew_molecule_p() const; virtual void do_print()const; }; diff --git a/lily/include/staff-walker.hh b/lily/include/staff-walker.hh deleted file mode 100644 index e46f0a8fb0..0000000000 --- a/lily/include/staff-walker.hh +++ /dev/null @@ -1,47 +0,0 @@ -/* - staff-walker.hh -- declare Staff_walker - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STAFFWALKER_HH -#define STAFFWALKER_HH - -#include "lily-proto.hh" -#include "time-description.hh" -#include "pcursor.hh" - -/** - manage run-time info when walking staffcolumns such as: key, - meter, pending beams & slurs - */ -struct Staff_walker : public PCursor<Staff_column*> { - Staff * staff_l_; - PScore * pscore_l_; - Score_walker *score_walk_l_; - Time_description time_; - Rhythmic_grouping *default_grouping; - - /* *************** */ - - Moment when() const; - virtual ~Staff_walker(); - Staff_walker(Staff*, PScore*); - void process() ; - - void operator++(int); - void allow_break(); - -protected: - /// every time before ++ is called - virtual void do_pre_move(){} - /// every time after ++ is called - virtual void do_post_move(){} - virtual void process_requests()=0; -private: - void process_timing_reqs(); - Staff_walker(Staff_walker const&); -}; - -#endif // STAFFWALKER_HH - diff --git a/lily/include/staff.hh b/lily/include/staff.hh deleted file mode 100644 index f9f24d8150..0000000000 --- a/lily/include/staff.hh +++ /dev/null @@ -1,55 +0,0 @@ -/* - staff.hh -- declare Staff - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#ifndef STAFF_HH -#define STAFF_HH - -#include "plist.hh" -#include "lily-proto.hh" -#include "moment.hh" - -/// A collection of voices. -class Staff { - Staff(const Staff&src); - -public: - Input_register * ireg_p_; - - Link_list<Voice*> voice_list_; - /// runtime field - Link_list<Staff_column*> cols_; - Line_of_staff * staff_line_l_; - - Score *score_l_; - PScore *pscore_l_; - - /* *************************************************************** */ - - void add(Link_list<Voice*> const&s); - - void add_voice(Voice *v_p); - Paper_def*paper()const; - - void OK() const; - void print() const; - - /// when does the last *musical* element finish? - Moment last() const; - - /// remove unused cols - void clean_cols() ; - Staff(); - - virtual void set_output(PScore * destination); - Staff_walker *get_walker_p(); - virtual ~Staff(); - void add_col(Staff_column*); -protected: - -}; -#endif diff --git a/lily/include/staffeleminfo.hh b/lily/include/staffeleminfo.hh deleted file mode 100644 index 8eb28bc235..0000000000 --- a/lily/include/staffeleminfo.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - staffeleminfo.hh -- declare Score_elem_info - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef STAFFELEMINFO_HH -#define STAFFELEMINFO_HH - -#include "lily-proto.hh" - -/// data container. -struct Score_elem_info { - Score_elem * elem_p_; - Request*req_l_; - Voice const * voice_l_; - Voice_group_registers * group_regs_l_; - Request_register * origin_reg_l_; - - /* *** */ - Score_elem_info(Score_elem*, Request*, Request_register*); - Score_elem_info(); -}; - -#endif // STAFFELEMINFO_HH diff --git a/lily/include/staffline.hh b/lily/include/staffline.hh index 9d9174e688..5afdc785c0 100644 --- a/lily/include/staffline.hh +++ b/lily/include/staffline.hh @@ -12,7 +12,7 @@ /// one broken line of staff. struct Line_of_staff : public Spanner_elem_group{ - SPANNER_CLONE(Line_of_staff) + SCORE_ELEM_CLONE(Line_of_staff) public: NAME_MEMBERS(); diff --git a/lily/include/stem-beam-reg.hh b/lily/include/stem-beam-reg.hh index f6b1b5317e..a162e725e4 100644 --- a/lily/include/stem-beam-reg.hh +++ b/lily/include/stem-beam-reg.hh @@ -31,10 +31,10 @@ public: protected: ~Stem_beam_register(); virtual void set_feature(Feature dir_i_); - virtual bool try_request(Request*); - virtual void process_requests(); + virtual bool do_try_request(Request*); + virtual void do_process_requests(); virtual void acknowledge_element(Score_elem_info); - virtual void pre_move_processing(); - virtual void post_move_processing(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); }; #endif // STEMBEAMREG_HH diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 34cb868d56..d2b8a7e19f 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -21,6 +21,10 @@ \end{itemize} should move beam_{left, right} into Beam + + TODO. + + Stem size depends on flag. */ class Stem : public Item { @@ -73,7 +77,8 @@ public: void do_print() const; void set_stemend(Real); int get_default_dir(); - int get_center_distance(); + int get_center_distance_from_top(); + int get_center_distance_from_bottom(); void set_default_dir(); void set_default_stemlen(); void set_default_extents(); @@ -84,7 +89,6 @@ public: Real stem_start_f() const; bool invisible_b()const; - bool chord_b()const; /// heads that the stem encompasses (positions) int max_head_i() const; diff --git a/lily/include/swallow-reg.hh b/lily/include/swallow-reg.hh index 391d0b6472..937f890d0b 100644 --- a/lily/include/swallow-reg.hh +++ b/lily/include/swallow-reg.hh @@ -19,7 +19,7 @@ class Swallow_register : public Request_register { protected: bool acceptable_request_b(Request*) const; - bool try_request(Request*) ; + bool do_try_request(Request*) ; public: NAME_MEMBERS(); }; diff --git a/lily/include/symbol.hh b/lily/include/symbol.hh index 96fbd7c9b8..e1e24b25e0 100644 --- a/lily/include/symbol.hh +++ b/lily/include/symbol.hh @@ -25,13 +25,19 @@ struct Symbol { /// a symbol which can be translated, and freely copied struct Atom { - Offset off; - Symbol sym; + Offset off_; + Symbol sym_; /* *************** */ void translate(Offset o) { - off += o; + off_ += o; + } + void translate_x(Real r){ + off_.x += r; + } + void translate_y(Real r) { + off_.y += r; } /// how big is #this#? diff --git a/lily/include/text-reg.hh b/lily/include/text-reg.hh index c1f4929044..7b8213bdb6 100644 --- a/lily/include/text-reg.hh +++ b/lily/include/text-reg.hh @@ -16,10 +16,10 @@ class Text_register : public Request_register{ /* *************** */ protected: virtual void set_feature(Feature ); - virtual bool try_request(Request*); - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); + virtual bool do_try_request(Request*); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); virtual void acknowledge_element(Score_elem_info); public: Text_register(); diff --git a/lily/include/text-spanner.hh b/lily/include/text-spanner.hh index c7e6ca9a92..1381be3b5e 100644 --- a/lily/include/text-spanner.hh +++ b/lily/include/text-spanner.hh @@ -23,7 +23,7 @@ public: void set_support(Directional_spanner*); Text_spanner(); protected: - SPANNER_CLONE(Text_spanner) + SCORE_ELEM_CLONE(Text_spanner) ~Text_spanner(); virtual void do_substitute_dependency(Score_elem*,Score_elem*); virtual void do_pre_processing(); diff --git a/lily/include/tie-reg.hh b/lily/include/tie-reg.hh index eb4772b500..a1ea3ed14d 100644 --- a/lily/include/tie-reg.hh +++ b/lily/include/tie-reg.hh @@ -25,12 +25,12 @@ class Tie_register : public Request_register { protected: virtual ~Tie_register(); virtual void acknowledge_element(Score_elem_info); - virtual bool try_request(Request*); + virtual bool do_try_request(Request*); virtual bool acceptable_request_b(Request*); virtual void sync_features(); - virtual void process_requests(); - virtual void post_move_processing(); - virtual void pre_move_processing(); + virtual void do_process_requests(); + virtual void do_post_move_processing(); + virtual void do_pre_move_processing(); virtual void set_feature(Feature); public: Tie_register(); diff --git a/lily/include/tie.hh b/lily/include/tie.hh index dc3b812f5e..70c6a8a7af 100644 --- a/lily/include/tie.hh +++ b/lily/include/tie.hh @@ -29,6 +29,6 @@ public: Tie(); NAME_MEMBERS(); - SPANNER_CLONE(Tie) + SCORE_ELEM_CLONE(Tie) }; #endif // TIE_HH diff --git a/lily/include/vertical-align-elem.hh b/lily/include/vertical-align-elem.hh new file mode 100644 index 0000000000..0f17b97fbf --- /dev/null +++ b/lily/include/vertical-align-elem.hh @@ -0,0 +1,27 @@ +/* + vertical-align-item.hh -- declare Vertical_align_elem + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef VERTICAL_ALIGN_ITEM_HH +#define VERTICAL_ALIGN_ITEM_HH + +#include "elem-group.hh" +/** + Order elements top to bottom. + */ +class Vertical_align_elem : virtual public Score_elem { + Link_array<Score_elem> elem_l_arr_; +public: + void add(Score_elem*); + bool contains_b(Score_elem const*)const; + NAME_MEMBERS(); +protected: + virtual void do_substitute_dependency(Score_elem*,Score_elem*); + virtual void do_post_processing() ; +}; +#endif // VERTICAL_ALIGN_ITEM_HH diff --git a/lily/include/voice-element.hh b/lily/include/voice-element.hh deleted file mode 100644 index 6bc85597af..0000000000 --- a/lily/include/voice-element.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* - voice-element.hh -- declare Voice_element - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef VOICE_ELEMENT_HH -#define VOICE_ELEMENT_HH - -#include "lily-proto.hh" -#include "plist.hh" -#include "moment.hh" -#include "input.hh" - -/** one horizontal bit. Voice_element is nothing but a container for - *the requests, */ -class Voice_element : public Input{ -public: - /** the duration of the element. This can be 0; The duration is - determined from rhythmical requests contained in this - Voice_element */ - Moment duration_; - Voice const *voice_C_; - Pointer_list<Request*> req_p_list_; - Request * principal_req_l_; - - /* *************** */ - void transpose(Melodic_req const &)const; - Voice_element(); - Voice_element(Voice_element const & src ); - - void add(Request*); - void print ()const; - void set_default_group(String id); -}; - -#endif // VOICE-ELEMENT_HH diff --git a/lily/include/voice-group-regs.hh b/lily/include/voice-group-regs.hh index 187b6c147e..c4f04e1af2 100644 --- a/lily/include/voice-group-regs.hh +++ b/lily/include/voice-group-regs.hh @@ -17,28 +17,18 @@ */ class Voice_group_registers : public Register_group_register { Moment termination_mom_; - Input_register const *ireg_C_; int dir_i_; protected: virtual void do_print() const; - virtual void set_feature(Feature); virtual Scalar get_feature(String); - virtual void post_move_processing(); - virtual bool try_request(Request*); + virtual void do_post_move_processing(); + virtual bool do_try_request(Request*); public: - void OK() const; - virtual Request_register * get_register_p(Request_register * reg_l); - /// each group in a staff has an unique ID. - String group_id_str_; - - /// The pointers are in the base class. This is just administration - Array<Voice_registers*> voice_reg_l_arr_; - /* *************** */ + NAME_MEMBERS(); static bool static_acceptable_request_b(Request*); - virtual void add(Request_register*); - Voice_group_registers(String id, Input_register const *); + Voice_group_registers(); }; #endif // VOICEGROUPREGS_HH diff --git a/lily/include/voice-regs.hh b/lily/include/voice-regs.hh index 5f99de381f..3c282b34b2 100644 --- a/lily/include/voice-regs.hh +++ b/lily/include/voice-regs.hh @@ -11,22 +11,16 @@ #define VOICEREGS_HH #include "register-group.hh" +#include "interpreter.hh" -class Voice_registers : public Register_group_register { - Input_register const *ireg_C_; - bool terminate_b_; +class Voice_registers : public Interpreter, public Register_group_register { public: - Voice *voice_l_; - /* *************** */ - - Voice_registers(Voice*, Input_register const*); + Voice_registers(); NAME_MEMBERS(); protected: - virtual void pre_move_processing(); - virtual bool acceptable_request_b(Request*); - virtual void acknowledge_element(Score_elem_info info); - virtual bool try_request(Request*); + virtual bool interpret_request_b(Request*); + virtual Interpreter* interpreter_l() { return this; } virtual void do_print() const; }; diff --git a/lily/include/voice.hh b/lily/include/voice.hh deleted file mode 100644 index a40142d56f..0000000000 --- a/lily/include/voice.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* - voice.hh -- declare Voice - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#ifndef VOICE_HH -#define VOICE_HH - -#include "lily-proto.hh" -#include "plist.hh" -#include "moment.hh" - -/** class for horizontal stuff. - - Voice is a ordered row of Voice_elements. It is strictly - horizontal: you cannot have two rhythmic elements running parallel - in a Voice. For proper processing, each Voice should have - Group_change_req as a first element. - - */ - -struct Voice { - /** the elements, earliest first. - Please use the member #add()# to add a new element - */ - Pointer_list<Voice_element *> elts_; - Moment start_; - - /* *************** */ - Voice(); - Voice(Voice const&); - - Moment when(Voice_element const *)const; - Moment last() const; - void transpose(Melodic_req const &)const; - void add(Voice_element*); - void print() const; - void set_default_group(String id); -}; - -#endif diff --git a/lily/include/walk-regs.hh b/lily/include/walk-regs.hh deleted file mode 100644 index e339baa983..0000000000 --- a/lily/include/walk-regs.hh +++ /dev/null @@ -1,51 +0,0 @@ -/* - walkregs.hh -- declare Walker_registers - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef WALKREGS_HH -#define WALKREGS_HH - - -#include "register-group.hh" -#include "parray.hh" -/** - Top level registers: the interface to Complex_walker. - - [sigh. Sometimes I wish C++ could do better late binding.] - - Basically, this distributes and collects elements and elementinfo to - children - */ -class Walker_registers : public Register_group_register { - - Array<Item*> prebreak_item_p_arr_; - Array<Item*> nobreak_item_p_arr_; - Array<Item*> postbreak_item_p_arr_; - Link_array<Score_elem> musical_item_p_arr_; - - Array<Score_elem_info> announce_info_arr_; - - Complex_walker * walk_l_; -protected: - virtual Staff_info get_staff_info(); - - virtual void announce_element(Score_elem_info); - virtual void acknowledge_element(Score_elem_info); - virtual void typeset_breakable_item(Item * pre_p , Item * nobreak_p, Item * post_p); - virtual void typeset_element(Score_elem*elem_p); - virtual Paper_def * paper() const; -public: - virtual void pre_move_processing(); - virtual void post_move_processing(); - - - void do_announces(); - Walker_registers(Complex_walker*); -}; - -#endif // WALKREGS_HH diff --git a/lily/input-music.cc b/lily/input-music.cc deleted file mode 100644 index 2d4527c44a..0000000000 --- a/lily/input-music.cc +++ /dev/null @@ -1,230 +0,0 @@ -#include "debug.hh" -#include "input-music.hh" -#include "voice.hh" -#include "musical-request.hh" -#include "command-request.hh" -#include "voice-element.hh" - -void -Simple_music::transpose(Melodic_req const &d)const -{ - voice_.transpose(d); -} - -void -Simple_music::add(Voice_element*v) -{ - voice_.add(v); -} - -Moment -Simple_music::length()const -{ - return voice_.last(); -} -void -Simple_music::translate_time(Moment t) -{ - voice_.start_ += t; -} - -Voice_list -Simple_music::convert()const -{ - Voice_list l; - Voice * v_p = new Voice(voice_); - PCursor<Voice_element*> i= v_p->elts_.bottom(); - - if (!i.ok() || i->duration_) { - v_p->add ( new Voice_element); - i=v_p->elts_.bottom(); - } - - // need-to-have, otherwise memory will be filled up with regs. - i->add(new Terminate_voice_req); - l.bottom().add(v_p); - return l; -} - - -void -Simple_music::print() const -{ -#ifndef NPRINT - mtor << "Simple_music {"; - voice_.print(); - mtor << "}\n"; -#endif -} - -/* *************** */ - -void -Complex_music::transpose(Melodic_req const& d) const -{ - for (iter_top(elts,i); i.ok(); i++) - i->transpose(d); -} -void -Complex_music::add(Input_music*v) -{ - elts.bottom().add(v); -} - -void -Complex_music::print() const -{ - for (iter_top(elts,i); i.ok(); i++) - i->print(); -} - -void -Complex_music::concatenate(Complex_music*h) -{ - for (iter_top(h->elts,i); i.ok(); i++) - add(i->clone()); -} - -Complex_music::Complex_music() -{ -} - -Complex_music::Complex_music(Complex_music const&s) -{ - for (iter_top(s.elts,i); i.ok(); i++) - add(i->clone()); -} -void -Complex_music::set_default_group(String g) -{ - for (iter_top(elts,i); i.ok(); i++) - i->set_default_group(g); -} -/* *************************************************************** */ - -void -Music_voice::print() const -{ - mtor << "Music_voice {"; - Complex_music::print(); - mtor << "}\n"; -} - -void -Music_voice::add_elt(Voice_element*v) -{ - PCursor<Input_music*> c(elts.bottom()); - if (!c.ok() || !c->simple()) { - Simple_music*vs = new Simple_music; - - c.add(vs); - } - - c = elts.bottom(); - Simple_music *s = c->simple(); - s->add(v); -} - -Moment -Music_voice::length()const -{ - Moment l = 0; - - for (iter_top(elts,i); i.ok(); i++) - l += i->length(); - return l; -} - - -Voice_list -Music_voice::convert()const -{ - Voice_list l; - Moment here = 0; - - for (iter_top(elts,i); i.ok(); i++) { - Moment len = i->length(); - Voice_list k(i->convert()); - k.translate_time(here); - l.concatenate(k); - here +=len; - } - return l; -} - -void -Music_voice::translate_time(Moment t) -{ - elts.bottom()->translate_time(t); -} - - - -/* *************** */ - -void -Music_general_chord::add_elt(Voice_element*v) -{ - Simple_music*vs = new Simple_music; - vs->add(v); - elts.bottom().add(vs); -} - -void -Music_general_chord::print() const -{ - mtor << "Music_general_chord {"; - Complex_music::print(); - mtor << "}\n"; -} - -void -Music_general_chord::translate_time(Moment t) -{ - for (iter_top(elts,i); i.ok(); i++) - i->translate_time(t); -} - -Moment -Music_general_chord::length()const -{ - Moment l =0; - - for (iter_top(elts,i); i.ok(); i++) - l = l >? i->length(); - return l; -} - -Voice_list -Music_general_chord::convert()const -{ - Voice_list l; - for (iter_top(elts,i); i.ok(); i++) { - Voice_list k(i->convert()); - l.concatenate(k); - } - return l; -} - -/* *************** */ - -void -Multi_voice_chord::set_default_group(String g) -{ - int j=0; - for (iter_top(elts, i); i.ok(); i++) { - i->set_default_group(g + String(j)); - j++; - } -} - - -/* *************** */ - -void -Voice_list::translate_time(Moment x) -{ - for (iter_top(*this,i); i.ok(); i++) - i->start_ += x; -} - diff --git a/lily/input-register.cc b/lily/input-register.cc index 4d0d24902a..f946e622fe 100644 --- a/lily/input-register.cc +++ b/lily/input-register.cc @@ -5,74 +5,102 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ + #include "debug.hh" #include "register.hh" #include "input-register.hh" -Input_register::~Input_register() -{} +#include "parray.hh" +#include "input-register.hh" +#include "register-group.hh" -Input_register::Input_register() +void +Input_register::print() const { +#ifndef NPRINT + mtor << "name " << name_str_; + mtor << "Consists of "; + for (int i=0; i< consists_str_arr_.size(); i++) + mtor << consists_str_arr_[i] << ','; + mtor << "contains " ; + for (iter(contains_ireg_p_list_.top(), i); i.ok(); i++) + i->print(); +#endif } -bool -Input_register::group_b()const +/* + UGH. Global. + */ +Link_array<Input_register> iregs_p_arr; + +void +add_global_input_register(Input_register *reg_p) { - return ireg_list_.size(); + iregs_p_arr.push(reg_p); } -Array<String> -Input_register::get_nongroups_str_arr()const +Input_register * +lookup_reg(String nm) { - Array<String> s_arr; - for (iter_top(ireg_list_, i); i.ok(); i++) { - if (!i->group_b()) - s_arr.push(i->name_str_); - } - return s_arr; + for (int i=0; i < iregs_p_arr.size(); i++) + if (iregs_p_arr[i]->name_str_ == nm) + return iregs_p_arr[i]; + + error("can't find reg `" + nm + "'"); } -Input_register* -Input_register::get_ireg_l(String nm)const +Input_register * +Input_register::recursive_find(String nm) +{ + if ( nm == name_str_) + return this; + + Input_register * r =0; + for (iter(contains_ireg_p_list_.top(), i); !r &&i.ok(); i++) + r = i->recursive_find(nm); + + return r; +} +Input_register * +Input_register::find_ireg_l(String nm) { - for (iter_top(ireg_list_, i); i.ok(); i++) { + for (iter(contains_ireg_p_list_.top(), i); i.ok(); i++) if (i->name_str_ == nm) return i; - } + return 0; } -Array<Request_register*> -Input_register::get_nongroup_p_arr() const + + +Register_group_register * +Input_register::get_group_register_p() { - Array <Request_register*>a; - Array<String> sa(get_nongroups_str_arr()); - for (int i=0; i < sa.size(); i++) - a.push(get_nongroup_register_p(sa[i])); - return a; + Register_group_register * reg_p = (Register_group_register*) + get_register_p(name_str_); + + + + for (int i=0; i < consists_str_arr_.size(); i++) { + reg_p->add( get_register_p( consists_str_arr_[i]) ); + } + reg_p -> ireg_l_ = this; + return reg_p; } -void -Input_register::add(Input_register *p) + +bool +Input_register::accept_req_b() { - ireg_list_.bottom().add(p); + return ! contains_ireg_p_list_.size(); } void -Input_register::print() const +Input_register::add(Input_register *ip) { -#ifndef NPRINT - mtor << name_str_ << " { "; - for (iter_top(ireg_list_, i); i.ok(); i++) - i->print(); - mtor <<" }\n"; -#endif + contains_ireg_p_list_.bottom().add(ip); } - -Input_register::Input_register(Input_register const&s) - : Input(s) +Input_register* +Input_register::get_default_ireg_l() { - name_str_ = s.name_str_; - for (iter_top(s.ireg_list_, i); i.ok(); i++) - add(new Input_register(*i.ptr())); + return contains_ireg_p_list_.top(); } diff --git a/lily/input-score.cc b/lily/input-score.cc deleted file mode 100644 index 5ba571aefc..0000000000 --- a/lily/input-score.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* - input-score.cc -- implement Input_score - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "debug.hh" -#include "input-score.hh" -#include "input-staff.hh" -#include "input-music.hh" -#include "score.hh" -#include "paper-def.hh" -#include "midi-def.hh" - - - -void -Input_score::add(Input_staff*s) -{ - staffs_.bottom().add(s); -} - -void -Input_score::set(Paper_def*p) -{ - delete paper_p_; - paper_p_ = p; -} - -void -Input_score::set(Midi_def* midi_p) -{ - delete midi_p_; - midi_p_ = midi_p; -} - -Input_score::Input_score(Input_score const&s) - : Input(s) -{ - paper_p_ = (s.paper_p_)? new Paper_def(*s.paper_p_) :0; - midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_p_) : 0; - errorlevel_i_ = s.errorlevel_i_; -} - -Score* -Input_score::parse() -{ - Score *s_p = new Score; - - s_p->errorlevel_i_ = errorlevel_i_; - if (midi_p_) - s_p->set(new Midi_def(*midi_p_)); - if (paper_p_) - s_p->set(new Paper_def(*paper_p_)); - - for (iter_top(staffs_,i); i.ok(); i++) { - Staff* staf_p=i->parse(s_p); - s_p->add(staf_p); - } - - return s_p; -} - - -Input_score::~Input_score() -{ - delete paper_p_; - delete midi_p_; -} - -Input_score::Input_score() -{ - paper_p_= 0; - midi_p_ = 0; - errorlevel_i_ = 0; -} - -void -Input_score::print()const -{ -#ifndef NPRINT - mtor << "Input_score {\n"; - for (iter_top(staffs_,i); i.ok(); i++) { - i->print(); - } - mtor << "}\n"; -#endif -} diff --git a/lily/input-staff.cc b/lily/input-staff.cc deleted file mode 100644 index 0b127baacb..0000000000 --- a/lily/input-staff.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - input-staff.cc -- implement Input_staff - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "debug.hh" -#include "score.hh" -#include "input-music.hh" -#include "input-staff.hh" -#include "staff.hh" -#include "my-lily-lexer.hh" -#include "input-register.hh" - -Input_staff::Input_staff() -{ - ireg_p_ =0; -} - -void -Input_staff::add(Input_music*m) -{ - music_.bottom().add(m); -} - -Staff* -Input_staff::parse(Score*score_l) -{ - Staff *p=new Staff; - - p->score_l_ = score_l; - p->ireg_p_ = (ireg_p_)? new Input_register(*ireg_p_):0; - for (iter_top(music_,i); i.ok(); i++) { - Voice_list vl = i->convert(); - p->add(vl); - } - return p; -} - -Input_staff::Input_staff(Input_staff const&s) - : Input(s) -{ - for (iter_top(s.music_,i); i.ok(); i++) - add(i->clone()); - - ireg_p_ = (s.ireg_p_)? new Input_register(*s.ireg_p_):0; -} - -void -Input_staff::print() const -{ -#ifndef NPRINT - mtor << "Input_staff {\n"; - for (iter_top(music_,i); i.ok(); i++) - i->print(); - ireg_p_->print(); - mtor << "}\n"; -#endif -} -Input_staff::~Input_staff() -{ - delete ireg_p_; -} diff --git a/lily/item.cc b/lily/item.cc index 7c3b207eac..f1de7827e8 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -5,7 +5,7 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ - +#include "p-score.hh" #include "debug.hh" #include "item.hh" #include "p-col.hh" @@ -13,9 +13,13 @@ Item::Item() { pcol_l_ = 0; + + broken_to_a_[0] + = broken_to_a_[1]=0; } IMPLEMENT_STATIC_NAME(Item); +IMPLEMENT_IS_TYPE_B1(Item, Score_elem); void Item::do_print() const @@ -39,3 +43,67 @@ Item::line_l()const { return pcol_l_->line_l_; } + +int +Item::break_status_i() const +{ + PCol * c = pcol_l_; + if (c->breakable_b()) + return 0; + else if (!c->daddy_l_) + return 0; + else if (c == c->daddy_l_->prebreak_p_) + return -1; + else + return 1; +} + +void +Item::do_breakable_col_processing() +{ + PCol * c = pcol_l_; + if (!c->breakable_b()) + return; + + for (int i=0; i < 2; i++) { + broken_to_a_[i] = clone()->item(); + pscore_l_->typeset_item(broken_to_a_[i], c, -1+ 2*i); + broken_to_a_[i]->handle_prebroken_dependencies(); + } + + handle_prebroken_dependencies(); +} + +Item* +Item::find_prebroken_piece(Line_of_score*l) const +{ + if (line_l() == l) + return this; + else if (broken_to_a_[0] && broken_to_a_[0]->line_l() == l) + return broken_to_a_[0]; + else if (broken_to_a_[1] && broken_to_a_[1]->line_l() == l) + return broken_to_a_[1]; + + return 0; +} + +Item* +Item::find_prebroken_piece(PCol*c)const +{ + if (c == pcol_l_ ) + return (Item *) this; // ugh + + if (c == pcol_l_->prebreak_p_) + return (Item *) broken_to_a_[0]; + else if (c==pcol_l_->postbreak_p_) + return (Item *)broken_to_a_[1]; + + assert(false); +} + +void +Item::handle_prebroken_dependencies() +{ + if ( pcol_l_->breakable_b() || pcol_l_->daddy_l_ ) + Score_elem::handle_prebroken_dependencies(); +} diff --git a/lily/key-item.cc b/lily/key-item.cc index 783572b093..54ee56b195 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -59,14 +59,16 @@ Key_item::brew_molecule_p()const for (int i =0; i < pitch.size(); i++) { Symbol s= paper()->lookup_l()->accidental(acc[i]); Atom a(s); - a.translate(Offset(0,(c_position + pitch[i]) * inter)); + a.translate_y((c_position + pitch[i]) * inter); Molecule m(a); output->add_right(m); } Molecule m(paper()->lookup_l()->fill(Box( Interval(0, paper()->note_width()), Interval(0,0)))); - output->add_right(m); + if ( pitch.size() ) + output->add_right(m); return output; } IMPLEMENT_STATIC_NAME(Key_item); +IMPLEMENT_IS_TYPE_B1(Key_item,Item); diff --git a/lily/key-reg.cc b/lily/key-reg.cc index 459ddf4d42..4effed1fee 100644 --- a/lily/key-reg.cc +++ b/lily/key-reg.cc @@ -12,7 +12,6 @@ #include "key-reg.hh" #include "key-item.hh" #include "command-request.hh" -#include "staff-column.hh" #include "local-key-reg.hh" #include "musical-request.hh" #include "local-key-item.hh" @@ -21,17 +20,18 @@ Key_register::Key_register() { - post_move_processing(); + do_post_move_processing(); } bool -Key_register::try_request(Request * req_l) +Key_register::do_try_request(Request * req_l) { Command_req* creq_l= req_l->command(); if (!creq_l|| !creq_l->keychange()) return false; - assert(!keyreq_l_); // todo + if (keyreq_l_) + return false; // TODO keyreq_l_ = creq_l->keychange(); change_key_b_ = true; read_req(keyreq_l_); @@ -41,44 +41,46 @@ Key_register::try_request(Request * req_l) void Key_register::acknowledge_element(Score_elem_info info) { - Command_req * r_l = info.req_l_->command() ; + int c0_i= *get_staff_info().c0_position_i_l_; + Command_req * r_l = info.req_l_->command() ; if (r_l && r_l->clefchange()) { - change_key_b_ = true; + + if (!kit_p_) { + kit_p_ = new Key_item(c0_i); + announce_element(Score_elem_info(kit_p_,0)); + } + change_key_b_ = true; } - if (info.elem_l_->name() == Bar::static_name()) + if (info.elem_l_->name() == Bar::static_name()) { default_key_b_ = true; + if (!kit_p_) { + kit_p_ = new Key_item(c0_i); + announce_element(Score_elem_info(kit_p_,0)); + } + } } void -Key_register::process_requests() +Key_register::do_process_requests() { int c0_i= *get_staff_info().c0_position_i_l_; if (key_.multi_octave_b_) assert(false); // TODO . - else + else if (keyreq_l_) { kit_p_ = new Key_item(c0_i); - kit_p_->read(*this); - announce_element(Score_elem_info(kit_p_, keyreq_l_)); + kit_p_->read(*this); + announce_element(Score_elem_info(kit_p_, keyreq_l_)); + } } void -Key_register::pre_move_processing() +Key_register::do_pre_move_processing() { - Time_description const * time_C_ = get_staff_info().time_C_; - if ( time_C_->whole_in_measure_&& default_key_b_ && ! change_key_b_ ) { - delete kit_p_ ; - kit_p_ =0; - } - if (kit_p_) { - if (change_key_b_) - typeset_breakable_item( - new Key_item(*kit_p_), kit_p_, new Key_item(*kit_p_)); - else - typeset_breakable_item(0,0,kit_p_); + typeset_breakable_item( kit_p_); kit_p_ = 0; } } @@ -104,7 +106,7 @@ Key_register::read_req(Key_change_req * r) } void -Key_register::post_move_processing() +Key_register::do_post_move_processing() { keyreq_l_ = 0; default_key_b_ = false; @@ -112,4 +114,5 @@ Key_register::post_move_processing() change_key_b_ = false; } IMPLEMENT_STATIC_NAME(Key_register); +IMPLEMENT_IS_TYPE_B1(Key_register,Request_register); ADD_THIS_REGISTER(Key_register); diff --git a/lily/lexer.l b/lily/lexer.l index 72ab455a26..31bc1674d4 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -29,7 +29,6 @@ #include "varray.hh" #include "parser.hh" #include "debug.hh" -#include "input-score.hh" #include "parseconstruct.hh" #include "main.hh" #include "identifier.hh" @@ -71,13 +70,12 @@ TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL} WORD {A}{AN}* ALPHAWORD {A}+ INT -?{N}+ -REAL {INT}?(\.{N}+)? +REAL {INT}?\.{N}* KEYWORD \\{WORD} WHITE [ \n\t\f] BLACK [^ \n\t\f] RESTNAME [rs] NOTECOMMAND \\{A}+ -DOTS \.+ LYRICS ({AA}|{NATIONAL})[^0-9 \t\n\f]* %% @@ -177,10 +175,6 @@ LYRICS ({AA}|{NATIONAL})[^0-9 \t\n\f]* return scan_escaped_word(YYText()+1); } - {DOTS} { - yylval.i = strlen(YYText()); - return DOTS; - } {INT} { yylval.i = String_convert::dec2_i( String( YYText() ) ); return INT; @@ -219,10 +213,6 @@ LYRICS ({AA}|{NATIONAL})[^0-9 \t\n\f]* \" { start_quote(); } - {DOTS} { - yylval.i = strlen(YYText()); - return DOTS; - } {INT} { yylval.i = String_convert::dec2_i( String( YYText() ) ); return INT; @@ -272,9 +262,9 @@ LYRICS ({AA}|{NATIONAL})[^0-9 \t\n\f]* return REAL; } -{INT}\. { // backup rule - cerr << "int. encountered" << endl; - exit( 1 ); +{INT} { + yylval.i = String_convert::dec2_i( String( YYText() ) ); + return INT; } [{}] { diff --git a/lily/lily-version.cc b/lily/lily-version.cc index 03f605394d..2890cd3e8a 100644 --- a/lily/lily-version.cc +++ b/lily/lily-version.cc @@ -10,7 +10,7 @@ static const int build= char const * lily_version_sz() { - static char v[1024]; + static char v[1024]; // ugh sprintf(v, s, build); return v; } diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index d53299c9e9..439f24f9fe 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -66,7 +66,7 @@ Local_key_item::brew_molecule_p()const if (accs[i].octave_i_ != lastoct) { if (octmol){ Real dy =lastoct*7*paper()->internote_f(); - octmol->translate(Offset(0, dy)); + octmol->translate_y( dy); output->add(*octmol); delete octmol; } @@ -76,20 +76,20 @@ Local_key_item::brew_molecule_p()const Symbol s =paper()->lookup_l()->accidental(accs[i].accidental_i_); Atom a(s); Real dy = (accs[i].name_i_ + c0_position) * paper()->internote_f(); - a.translate(Offset(0,dy)); + a.translate_y(dy); octmol->add_right(a); } if (octmol){ Real dy =lastoct*7*paper()->internote_f(); - octmol->translate(Offset(0, dy)); + octmol->translate_y( dy); output->add(*octmol); delete octmol; } Interval head_width=itemlist_width(support_items_); - output->translate(Offset(-output->extent().x.right + head_width.left ,0)); + output->translate_x(-output->extent().x.right + head_width.left ); return output; } @@ -105,6 +105,7 @@ Local_acc::compare(Local_acc&a, Local_acc&b) return a.accidental_i_ - b.accidental_i_; }; IMPLEMENT_STATIC_NAME(Local_key_item); +IMPLEMENT_IS_TYPE_B1(Local_key_item,Item); void Local_key_item::do_substitute_dependency(Score_elem*o,Score_elem*n) diff --git a/lily/local-key-reg.cc b/lily/local-key-reg.cc index 8ce3577f6c..268f281158 100644 --- a/lily/local-key-reg.cc +++ b/lily/local-key-reg.cc @@ -8,12 +8,12 @@ #include "command-request.hh" #include "local-key-reg.hh" #include "local-key-item.hh" -#include "complex-walker.hh" #include "key-reg.hh" #include "debug.hh" #include "key-item.hh" #include "tie.hh" #include "note-head.hh" +#include "time-description.hh" Local_key_register::Local_key_register() { @@ -21,7 +21,7 @@ Local_key_register::Local_key_register() } void -Local_key_register::pre_move_processing() +Local_key_register::do_pre_move_processing() { Local_key_item *key_item_p = 0; if (mel_l_arr_.size()) { @@ -91,16 +91,17 @@ Local_key_register::acknowledge_element(Score_elem_info info) } void -Local_key_register::process_requests() +Local_key_register::do_process_requests() { Time_description const * time_C_ = get_staff_info().time_C_; if (! time_C_->whole_in_measure_){ if (key_C_) local_key_= *key_C_; - else if( time_C_->when_ >Moment(0)) + else if(0&& time_C_->when_ >Moment(0)) warning ("Help me! can't figure out current key"); } } IMPLEMENT_STATIC_NAME(Local_key_register); +IMPLEMENT_IS_TYPE_B1(Local_key_register,Request_register); ADD_THIS_REGISTER(Local_key_register); diff --git a/lily/lyric-register.cc b/lily/lyric-register.cc index e6f4a29256..396fae38dc 100644 --- a/lily/lyric-register.cc +++ b/lily/lyric-register.cc @@ -6,7 +6,6 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "staff-walker.hh" #include "lyric-register.hh" #include "musical-request.hh" #include "text-item.hh" @@ -18,7 +17,7 @@ Lyric_register::Lyric_register() } bool -Lyric_register::try_request(Request*r) +Lyric_register::do_try_request(Request*r) { Musical_req * m =r->musical(); if (!m || ! m->lreq_l()) @@ -29,7 +28,7 @@ Lyric_register::try_request(Request*r) } void -Lyric_register::process_requests() +Lyric_register::do_process_requests() { Text_item * last_item_l =0; for (int i=0; i < lreq_arr_.size(); i++) { @@ -41,22 +40,15 @@ Lyric_register::process_requests() last_item_l = lp; typeset_element(lp); } - get_staff_info().walk_l_->allow_break(); } void -Lyric_register::post_move_processing() +Lyric_register::do_post_move_processing() { lreq_arr_.set_size(0); } -bool -Lyric_register::acceptable_request_b(Request*r) -{ - Musical_req * m =r->musical(); - return (!m || ! m->lreq_l()) ; -} - IMPLEMENT_STATIC_NAME(Lyric_register); +IMPLEMENT_IS_TYPE_B1(Lyric_register,Request_register); ADD_THIS_REGISTER(Lyric_register); diff --git a/lily/main.cc b/lily/main.cc index 19960f03de..7fbaf0c24f 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -81,6 +81,7 @@ notice() " Jan Nieuwenhuizen <jan@digicash.com>\n" "Contributors\n" " Mats Bengtsson <matsb@s3.kth.se>\n" + " Werner Lemberg <xlwy01@uxp1.hrz.uni-dortmund.de>\n" "\n" " 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" diff --git a/lily/meter-reg.cc b/lily/meter-reg.cc index 4c34c18734..e0e3829ed0 100644 --- a/lily/meter-reg.cc +++ b/lily/meter-reg.cc @@ -9,28 +9,80 @@ #include "meter-reg.hh" #include "meter.hh" #include "command-request.hh" +#include "score-reg.hh" Meter_register::Meter_register() +{ + meter_req_l_ = 0; + meter_p_ =0; + default_grouping_ = Rhythmic_grouping(MInterval(0,4),4); // ugh +} + +void +Meter_register::fill_staff_info(Staff_info&inf) { - post_move_processing(); + inf.time_C_ = &time_; + inf.rhythmic_C_ = &default_grouping_; } bool -Meter_register::try_request(Request*r_l) +Meter_register::do_try_request(Request*r) { - Command_req* creq_l= r_l->command(); - if (!creq_l || !creq_l->meterchange()) - return false; - Meter_change_req *m = creq_l->meterchange(); - if (meter_req_l_ && meter_req_l_->compare(*m)) - return false; - - meter_req_l_ = m; - return true; + bool gotcha = false; + + if (r->command() && r->command()->timing()) { + gotcha = true; + Timing_req * tr_l = r->command()->timing(); + Meter_change_req *m_l = tr_l->meterchange(); + if (m_l) { + meter_req_l_ = m_l; + + int b_i= m_l->beats_i_; + int o_i = m_l->one_beat_i_; + if (! time_.allow_meter_change_b() ) + tr_l->warning("Meter change not allowed here"); + else{ + time_.set_meter(b_i, o_i); + default_grouping_ = + Rhythmic_grouping(MInterval(0,Moment(b_i, o_i)), b_i); + } + } else if (tr_l->partial()) { + Moment m = tr_l->partial()->duration_; + String error = time_.try_set_partial_str(m); + if (error != "") { + tr_l->warning(error); + } else + time_.setpartial(m); + } else if (tr_l->barcheck()) { + if (time_.whole_in_measure_) { + tr_l ->warning( "Barcheck failed"); + + time_.whole_in_measure_ = 0; // resync + time_.error_b_ = true; + } + + } else if (tr_l->cadenza()) { + time_.set_cadenza(tr_l->cadenza()->on_b_); + + } else if (tr_l->measuregrouping()) { + default_grouping_ = parse_grouping( + tr_l->measuregrouping()->beat_i_arr_, + tr_l->measuregrouping()->elt_length_arr_); + + } + } + + return gotcha; } void -Meter_register::process_requests() +Meter_register::do_creation_processing() +{ + time_.when_ = get_staff_info().when(); +} + +void +Meter_register::do_process_requests() { if (meter_req_l_ ) { Array<Scalar> args; @@ -45,22 +97,30 @@ Meter_register::process_requests() } void -Meter_register::pre_move_processing() +Meter_register::do_pre_move_processing() { if (meter_p_) { - Meter * post_p =new Meter(*meter_p_); - Meter * pre_p =new Meter(*meter_p_); - - typeset_breakable_item(pre_p, meter_p_, post_p); + typeset_breakable_item(meter_p_); meter_p_ =0; + meter_req_l_ = 0; } + + Register_group_register * reg_l = daddy_reg_l_; + while (reg_l->daddy_reg_l_) { + reg_l = reg_l->daddy_reg_l_; + } + + assert( reg_l->name() == Score_register::static_name()); + if (!time_.cadenza_b_) + ((Score_register*)reg_l)->add_moment_to_process( time_.next_bar_moment()); } void -Meter_register::post_move_processing() +Meter_register::do_post_move_processing() { - meter_req_l_ = 0; - meter_p_ =0; + time_.add( get_staff_info().when() - time_.when_ ); } + IMPLEMENT_STATIC_NAME(Meter_register); ADD_THIS_REGISTER(Meter_register); +IMPLEMENT_IS_TYPE_B1(Meter_register,Request_register); diff --git a/lily/meter.cc b/lily/meter.cc index 4e45b61185..d56bc33869 100644 --- a/lily/meter.cc +++ b/lily/meter.cc @@ -17,3 +17,5 @@ Meter::brew_molecule_p()const } IMPLEMENT_STATIC_NAME(Meter); + +IMPLEMENT_IS_TYPE_B1(Meter,Item); diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 5a391323df..404f06b5ca 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -15,7 +15,7 @@ #include "string-convert.hh" #include "request.hh" #include "musical-request.hh" -#include "voice.hh" +#include "music-list.hh" #include "midi-item.hh" #include "midi-stream.hh" diff --git a/lily/midi-output.cc b/lily/midi-output.cc index 1f34358a9d..1a880fa58c 100644 --- a/lily/midi-output.cc +++ b/lily/midi-output.cc @@ -6,6 +6,7 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>, Jan Nieuwenhuizen <jan@digicash.com> */ +#if 0 #include "time.h" #include "main.hh" #include "source.hh" @@ -15,7 +16,6 @@ #include "string-convert.hh" #include "debug.hh" #include "score.hh" -#include "staff.hh" #include "main.hh" #include "midi-stream.hh" #include "midi-def.hh" @@ -58,7 +58,7 @@ Midi_output::do_staff(Staff*st_l,int track_i) midi_track.add( Moment( 0 ), &midi_tempo ); for (Midi_walker w (st_l, &midi_track); w.ok(); w++) - w.process_requests(); + w.do_process_requests(); *midi_stream_l_ << midi_track; } @@ -115,3 +115,4 @@ Midi_output::staffs() do_staff(i, track_i++); } +#endif diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index b6d25ea43a..3068c987dd 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -15,13 +15,11 @@ #include "command-request.hh" #include "musical-request.hh" #include "p-score.hh" -#include "staff.hh" #include "midi-walker.hh" #include "midi-item.hh" #include "midi-stream.hh" #include "debug.hh" -#include "staff-column.hh" - +#if 0 Midi_walker::Midi_walker(Staff *st_l, Midi_track* track_l) : PCursor<Staff_column*>(st_l->cols_) { @@ -86,7 +84,7 @@ Midi_walker::output_event(Midi_item &i, Moment now) } void -Midi_walker::process_requests() +Midi_walker::do_process_requests() { do_stop_notes(ptr()->when()); @@ -130,3 +128,4 @@ compare(Note_event const&e1, Note_event const&e2) { return sign(e1.key - e2.key); } +#endif diff --git a/lily/molecule.cc b/lily/molecule.cc index c39082ab92..2c946484c8 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -43,6 +43,18 @@ Molecule::translate(Offset o) } void +Molecule::translate_x(Real x) +{ + translate(Offset(x,0)); +} + +void +Molecule::translate_y(Real y) +{ + translate(Offset(0,y)); +} + +void Molecule::add(Molecule const &m) { for (iter_top(m.ats,c); c.ok(); c++) { @@ -86,7 +98,7 @@ Molecule::add_top(Molecule const &m) } Real yof=extent().y.right - m.extent().y.left; Molecule toadd(m); - toadd.translate(Offset(0,yof)); + toadd.translate_y(yof); add(toadd); } @@ -99,7 +111,7 @@ Molecule::add_bottom(Molecule const &m) } Real yof=extent().y.left- m.extent().y.right; Molecule toadd(m); - toadd.translate(Offset(0,yof)); + toadd.translate_y(yof); add(toadd); } diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc new file mode 100644 index 0000000000..e84f0525bf --- /dev/null +++ b/lily/music-iterator.cc @@ -0,0 +1,301 @@ +/* + music-iterator.cc -- implement {Music,Chord,Voice}_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "music-list.hh" +#include "music-iterator.hh" +#include "register.hh" +#include "register-group.hh" +#include "interpreter.hh" + +IMPLEMENT_STATIC_NAME(Music_iterator); +IMPLEMENT_IS_TYPE_B(Music_iterator); + +Register_group_register * +Music_iterator::get_req_acceptor_l() +{ + assert(report_to_reg_l_); + if (report_to_reg_l_->interpreter_l() ) + return report_to_reg_l_; + + report_to_reg_l_ = report_to_reg_l_->get_default_interpreter(); + return report_to_reg_l_; +} + +void +Music_iterator::construct_children() +{ + +} + +Music_iterator::~Music_iterator(){ +} + +Moment +Music_iterator::next_moment()const +{ + return 0; +} + +void +Music_iterator::next(Moment) +{ + first_b_ = false; +} + +bool +Music_iterator::ok()const +{ + return first_b_; +} + +Music_iterator* +Music_iterator::static_get_iterator_p(Music *m, + Register_group_register *report_l) +{ + Music_iterator * p =0; + if (m->is_type_b( Change_reg::static_name())) + p = new Change_iterator((Change_reg*)m); + else if (m->is_type_b( Voice_element::static_name())) + p = new Voice_element_iterator( (Voice_element*) m); + else if (m->is_type_b( Chord::static_name())) + p = new Chord_iterator( (Chord*) m); + else if (m->is_type_b( Voice::static_name())) + p = new Voice_iterator( (Voice*) m); + else if (m->is_type_b( Request::static_name() )) + p = new Request_iterator( (Request*) m ); + + if ( m->is_type_b( Music_list::static_name())) { + Music_list* ml = (Music_list*) m; + if (ml -> type_str_ != "") { + p->report_to_reg_l_ = + report_l->find_get_reg_l(ml-> type_str_, ml->id_str_); + + } + } + if (! p->report_to_reg_l_ ) + p ->report_to_reg_l_ = report_l; + + return p; +} + +Music_iterator* +Music_iterator::get_iterator_p(Music*m)const +{ + Music_iterator*p = static_get_iterator_p(m,report_to_reg_l_); + p->daddy_iter_l_ = (Music_iterator*)this; + p->construct_children(); + return p; +} + +Music_iterator::Music_iterator() +{ + daddy_iter_l_ =0; + report_to_reg_l_ = 0; + first_b_ = true; +} + +/* ************** */ + +Chord_iterator::Chord_iterator(Chord const *chord_C) +{ + chord_C_ = chord_C; +} + +void +Chord_iterator::construct_children() +{ + int j =0; + for(iter(chord_C_->music_p_list_.top(), i); i.ok(); j++, i++) { + + Music_iterator * mi = get_iterator_p( i.ptr()); + report_to_reg_l_ = mi->report_to_reg_l_->ancestor_l( chord_C_->multi_level_i_ ); + children_p_list_.bottom().add( mi ); + } +} + +void +Chord_iterator::next(Moment until) +{ + for (iter(children_p_list_.top(), i); i.ok(); ) { + if (i->next_moment() == until) { + i->next(until); + } + if (!i->ok()) + i.del(); + else + i++; + } + Music_iterator::next(until); + + assert(!ok() || next_moment() > until); +} + +IMPLEMENT_STATIC_NAME(Chord_iterator); +IMPLEMENT_IS_TYPE_B1(Chord_iterator,Music_iterator); + +Moment +Chord_iterator::next_moment()const +{ + Moment next_ = INFTY; + for (iter(children_p_list_.top(), i); i.ok(); i++) + next_ = next_ <? i->next_moment() ; + return next_; +} + + + +bool +Chord_iterator::ok()const +{ + return children_p_list_.size(); +} + +/* ************** */ + +Voice_iterator::Voice_iterator(Voice const*v) + : PCursor<Music*> ( v->music_p_list_) +{ + here_mom_ = v->offset_mom_; + voice_C_ = v; + iter_p_ =0; +} + +void +Voice_iterator::construct_children() +{ + if (ok()) { + + iter_p_ = Music_iterator::get_iterator_p( ptr() ); + report_to_reg_l_ = + iter_p_->report_to_reg_l_->ancestor_l( voice_C_ ->multi_level_i_ ); + } +} + +void +Voice_iterator::next_element() +{ + delete iter_p_ ; + iter_p_ =0; + here_mom_ += ptr()->time_int().length(); + PCursor<Music*>::next(); + construct_children(); +} + +Voice_iterator::~Voice_iterator() +{ + delete iter_p_; +} + +IMPLEMENT_STATIC_NAME(Voice_iterator); +IMPLEMENT_IS_TYPE_B1(Voice_iterator,Music_iterator); + +void +Voice_iterator::next(Moment until) +{ + while (ok()) { + Moment local_until = until - here_mom_; + while ( iter_p_ && iter_p_->ok() ) { + Moment here = iter_p_->next_moment(); + if (here != local_until) + return; + iter_p_->next(local_until); + } + if (!iter_p_) + iter_p_ = Music_iterator::get_iterator_p( ptr() ); + else if (!iter_p_->ok() ) + next_element(); + } + Music_iterator::next(until); + assert(!ok() || next_moment() > until); +} + +Moment +Voice_iterator::next_moment()const +{ + return iter_p_->next_moment() + here_mom_; +} + +bool +Voice_iterator::ok()const +{ + return PCursor<Music*>::ok(); +} + +/* ***************** */ + +Request_iterator::Request_iterator(Request const*c) +{ + req_l_ = (Request*)c; +} + +void +Request_iterator::next(Moment m) +{ + if ( !daddy_iter_l_->report_to_reg_l_-> + interpreter_l()->interpret_request_b(req_l_) ) + req_l_->warning("Junking request: " + String(req_l_->name())); + + + Music_iterator::next(m); +} + +IMPLEMENT_STATIC_NAME(Request_iterator); +IMPLEMENT_IS_TYPE_B1(Request_iterator, Music_iterator); + +/* ****************** */ + +Change_iterator::Change_iterator(Change_reg * ch) +{ + change_l_ = ch; +} + +IMPLEMENT_STATIC_NAME(Change_iterator); +IMPLEMENT_IS_TYPE_B1(Change_iterator,Music_iterator); + +/* + TODO: pop/pushgroup + */ +void +Change_iterator::next(Moment mom) +{ + Register_group_register *group_l = + report_to_reg_l_->find_get_reg_l(change_l_->type_str_, + change_l_->id_str_); + + report_to_reg_l_->daddy_reg_l_->remove_register_p(report_to_reg_l_); + group_l->add(report_to_reg_l_); + + Music_iterator::next(mom); +} + + + +/* ******************** */ + +IMPLEMENT_STATIC_NAME(Voice_element_iterator); +IMPLEMENT_IS_TYPE_B1(Voice_element_iterator,Chord_iterator); + +void +Voice_element_iterator::construct_children() +{ + if ( daddy_iter_l_ + && daddy_iter_l_->is_type_b(Voice_iterator::static_name() )) { + report_to_reg_l_ = daddy_iter_l_-> get_req_acceptor_l(); + } else if (daddy_iter_l_ + && daddy_iter_l_-> is_type_b( Chord_iterator::static_name() )) { + + get_req_acceptor_l(); + } + Chord_iterator::construct_children(); +} + +Voice_element_iterator::Voice_element_iterator(Voice_element*el_l) + : Chord_iterator(el_l) +{ + +} diff --git a/lily/music-list.cc b/lily/music-list.cc index 3d8f965b8b..9008ddc27a 100644 --- a/lily/music-list.cc +++ b/lily/music-list.cc @@ -1,5 +1,5 @@ /* - music-list.cc -- implement Music_list, + music-list.cc -- implement Music_list, Chord, Voice source file of the GNU LilyPond music typesetter @@ -9,68 +9,98 @@ #include "music.hh" #include "debug.hh" +#include "music-list.hh" Music_list::Music_list(Music_list const&s) { + multi_level_i_ = s.multi_level_i_; for (iter(s.music_p_list_.top(), i); i.ok(); i++) add(i->clone()); } - IMPLEMENT_STATIC_NAME(Music_list); +IMPLEMENT_STATIC_NAME(Chord); +IMPLEMENT_STATIC_NAME(Voice); +IMPLEMENT_IS_TYPE_B1(Music_list, Music); +IMPLEMENT_IS_TYPE_B1(Voice,Music_list); +IMPLEMENT_IS_TYPE_B1(Chord,Music_list); +MInterval +Chord::time_int()const +{ + MInterval m; + for (iter(music_p_list_.top(), i); i.ok(); i++) + m.unite(i->time_int()); + return m; +} void -Music_list::add(Music*mus_p) +Chord::translate(Moment m) { - music_p_list_.bottom().add(mus_p); + for (iter(music_p_list_.top(), i); i.ok(); i++) + i->translate(m); } -void -Music_list::transpose(Melodic_req const*m) +Chord::Chord() { - for (iter(music_p_list_.top(), i); i.ok(); i++) - i->transpose(m); + } -void -Music_list::do_print() const +Voice::Voice() { - for (iter(music_p_list_.top(), i); i.ok(); i++) - i->print(); + offset_mom_ =0; } -IMPLEMENT_STATIC_NAME(Chord); +MInterval +Voice::time_int() const +{ + Moment last=0; + for (iter(music_p_list_.top(), i); i.ok(); i++) + last += i->time_int().length(); + return offset_mom_ + MInterval(0,last); +} void -Chord::translate(Moment dt) +Voice::translate(Moment dt) { - for (iter(music_p_list_.top(), i); i.ok(); i++) - i->translate(dt); + offset_mom_ += dt; } -MInterval -Chord::time_int()const + +Music_list::Music_list() { - MInterval m; - for (iter(music_p_list_.top(), i); i.ok(); i++) - m.unite(i->time_int()); - return m; + multi_level_i_ = 0; } -MInterval -MVoice::time_int() const +void +Music_list::add(Music*m_p) { - Moment last=0; - for (iter(music_p_list_.top(), i); i.ok(); i++) - last += i->time_int().length(); - return MInterval (0,last); + if (!m_p) + return; + + m_p->parent_music_l_ = this; + music_p_list_.bottom().add(m_p); } void -MVoice::translate(Moment dt) +Music_list::transpose(Melodic_req const*rq) { - for (iter(music_p_list_.top(), i); i.ok(); i++) - i->translate(dt); + for (iter(music_p_list_.top(),i); i.ok(); i++) + i->transpose(rq); } -IMPLEMENT_STATIC_NAME(MVoice); +void +Music_list::do_print()const +{ +#ifndef NPRINT + for (iter(music_p_list_.top(),i); i.ok(); i++) + i->print(); +#endif +} + +IMPLEMENT_IS_TYPE_B1(Voice_element, Chord); +IMPLEMENT_STATIC_NAME(Voice_element); + +Voice_element::Voice_element() +{ + multi_level_i_ =0; +} diff --git a/lily/music.cc b/lily/music.cc index 155c7e31ff..ca55e559ec 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -8,6 +8,7 @@ #include "music.hh" +#include "music-list.hh" #include "debug.hh" MInterval @@ -18,12 +19,13 @@ Music::time_int() const void Music::print()const { - #ifndef NPRINT +#ifndef NPRINT mtor << name() << "{" ; do_print(); mtor << "}\n"; - #endif +#endif } + void Music::transpose(Melodic_req const*) { @@ -41,7 +43,15 @@ Music::do_print()const } IMPLEMENT_STATIC_NAME(Music); +IMPLEMENT_IS_TYPE_B(Music); + -Music::Music(){} +Music::Music() +{ + parent_music_l_ =0; +} + +IMPLEMENT_IS_TYPE_B1(Change_reg,Music) +IMPLEMENT_STATIC_NAME(Change_reg); diff --git a/lily/musical-request.cc b/lily/musical-request.cc index bee66ea327..5f9723a0a5 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -11,10 +11,10 @@ #include "debug.hh" #include "script-def.hh" #include "text-def.hh" -#include "voice.hh" -#include "voice-element.hh" +#include "music-list.hh" IMPLEMENT_STATIC_NAME(Stem_req); +IMPLEMENT_IS_TYPE_B1(Stem_req,Rhythmic_req); void Stem_req::do_print() const { @@ -31,30 +31,19 @@ Stem_req::Stem_req() /* ************** */ IMPLEMENT_STATIC_NAME(Musical_req); +IMPLEMENT_IS_TYPE_B1(Musical_req,Request); void Musical_req::do_print()const{} void Tie_req::do_print()const{} -IMPLEMENT_STATIC_NAME(Request); - -void Request::do_print() const{} /* *************** */ - -void -Request::print() const -{ -#ifndef NPRINT - mtor << name() << " {"; - do_print(); - mtor << "}\n"; -#endif -} - + IMPLEMENT_STATIC_NAME(Span_req); +IMPLEMENT_IS_TYPE_B1(Span_req,Musical_req); void Span_req::do_print() const @@ -64,16 +53,6 @@ Span_req::do_print() const #endif } -Request::Request() -{ - elt_l_ = 0; -} -Request::Request(Request const&src) - :Input(src) -{ - elt_l_ = 0; -} -/* *************** */ Spacing_req::Spacing_req() { next = 0; @@ -81,6 +60,7 @@ Spacing_req::Spacing_req() strength = 0; } IMPLEMENT_STATIC_NAME(Spacing_req); +IMPLEMENT_IS_TYPE_B1(Spacing_req,Request); void Spacing_req::do_print()const @@ -91,6 +71,7 @@ Spacing_req::do_print()const } IMPLEMENT_STATIC_NAME(Blank_req); +IMPLEMENT_IS_TYPE_B2(Blank_req,Spacing_req,Rhythmic_req); void Blank_req::do_print()const @@ -126,6 +107,7 @@ Melodic_req::transpose(Melodic_req const & delta) } IMPLEMENT_STATIC_NAME(Melodic_req); +IMPLEMENT_IS_TYPE_B1(Melodic_req,Musical_req); int Melodic_req::compare(Melodic_req const&m1, Melodic_req const&m2) @@ -182,6 +164,7 @@ Rhythmic_req::Rhythmic_req() } IMPLEMENT_STATIC_NAME(Rhythmic_req); +IMPLEMENT_IS_TYPE_B1(Rhythmic_req,Musical_req); void Rhythmic_req::do_print() const @@ -206,6 +189,7 @@ Lyric_req::Lyric_req(Text_def* def_p) } IMPLEMENT_STATIC_NAME(Lyric_req); +IMPLEMENT_IS_TYPE_B2(Lyric_req,Musical_req,Rhythmic_req); void Lyric_req::do_print() const @@ -220,6 +204,7 @@ Note_req::Note_req() forceacc_b_ = false; } IMPLEMENT_STATIC_NAME(Note_req); +IMPLEMENT_IS_TYPE_B2(Note_req,Melodic_req,Rhythmic_req); void Note_req::do_print() const @@ -234,6 +219,7 @@ Note_req::do_print() const } /* *************** */ IMPLEMENT_STATIC_NAME(Rest_req); +IMPLEMENT_IS_TYPE_B1(Rest_req,Rhythmic_req); void Rest_req::do_print() const @@ -247,10 +233,12 @@ Beam_req::Beam_req() nplet = 0; } IMPLEMENT_STATIC_NAME(Beam_req); +IMPLEMENT_IS_TYPE_B1(Beam_req,Span_req); void Beam_req::do_print()const{} /* *************** */ IMPLEMENT_STATIC_NAME(Slur_req); +IMPLEMENT_IS_TYPE_B1(Slur_req,Span_req); void Slur_req::do_print()const{} /* *************** */ @@ -286,6 +274,7 @@ Script_req::Script_req() } IMPLEMENT_STATIC_NAME(Script_req); +IMPLEMENT_IS_TYPE_B1(Script_req,Request); void Script_req::do_print() const @@ -299,6 +288,7 @@ Musical_script_req::do_print() const {} IMPLEMENT_STATIC_NAME(Musical_script_req); +IMPLEMENT_IS_TYPE_B2(Musical_script_req,Musical_req, Script_req); Script_req::~Script_req() @@ -332,6 +322,7 @@ Text_req::Text_req(int dir_i, Text_def* tdef_p) } IMPLEMENT_STATIC_NAME(Text_req); +IMPLEMENT_IS_TYPE_B1(Text_req,Musical_req); void Text_req::do_print() const @@ -345,13 +336,8 @@ Text_req::do_print() const /* *************** */ -Moment -Skip_req::duration() const -{ - return duration_; -} - IMPLEMENT_STATIC_NAME(Skip_req); +IMPLEMENT_IS_TYPE_B1(Skip_req,Musical_req); void Skip_req::do_print() const @@ -365,14 +351,15 @@ Skip_req::do_print() const Voice * Request::voice_l() { - if (!elt_l_) + if (!parent_music_l_) return 0; else - return (Voice*)elt_l_->voice_C_; + return (Voice*)parent_music_l_; } /* *************** */ IMPLEMENT_STATIC_NAME(Subtle_req); +IMPLEMENT_IS_TYPE_B1(Subtle_req,Musical_req); void Subtle_req::do_print() const @@ -383,6 +370,7 @@ Subtle_req::do_print() const } IMPLEMENT_STATIC_NAME(Dynamic_req); +IMPLEMENT_IS_TYPE_B1(Dynamic_req,Musical_req); void Dynamic_req::do_print() const @@ -391,6 +379,7 @@ Dynamic_req::do_print() const } IMPLEMENT_STATIC_NAME(Absolute_dynamic_req); +IMPLEMENT_IS_TYPE_B1(Absolute_dynamic_req,Musical_req); void Absolute_dynamic_req::do_print() const @@ -428,6 +417,7 @@ Span_dynamic_req::Span_dynamic_req() } IMPLEMENT_STATIC_NAME(Span_dynamic_req); +IMPLEMENT_IS_TYPE_B1(Span_dynamic_req,Musical_req); void Span_dynamic_req::do_print()const @@ -439,5 +429,6 @@ Span_dynamic_req::do_print()const } IMPLEMENT_STATIC_NAME(Tie_req); +IMPLEMENT_IS_TYPE_B1(Tie_req,Musical_req); diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 4a44823344..f80534ed2e 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -21,19 +21,24 @@ #include "parseconstruct.hh" static Keyword_ent the_key_tab[]={ + {"accepts", ACCEPTS}, + {"alias", ALIAS}, {"bar", BAR}, {"cadenza", CADENZA}, {"clear", CLEAR}, {"clef", CLEF}, {"cm", CM_T}, + {"consists", CONSISTS}, + {"contains", CONTAINS}, {"duration", DURATIONCOMMAND}, {"absdynamic", ABSDYNAMIC}, {"group", GROUP}, {"geometric", GEOMETRIC}, {"hshift", HSHIFT}, + {"id", ID}, {"in", IN_T}, {"init_end", INIT_END}, - {"inputregister", INPUT_REGS}, + {"requestregister", REQUESTREGISTER}, {"lyric", LYRIC}, {"key", KEY}, {"melodic" , MELODIC}, @@ -41,7 +46,7 @@ static Keyword_ent the_key_tab[]={ {"meter", METER}, {"midi", MIDI}, {"mm", MM_T}, - {"multivoice", MULTIVOICE}, + {"multi", MULTI}, {"note", NOTE}, {"notenames", NOTENAMES}, {"octave", OCTAVECOMMAND}, diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index c742946294..a4b7f13a8e 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -10,7 +10,7 @@ #include "my-lily-lexer.hh" #include "debug.hh" #include "main.hh" -#include "voice-element.hh" +#include "music-list.hh" #include "musical-request.hh" #include "command-request.hh" #include "parser.hh" @@ -109,13 +109,13 @@ void My_lily_parser::set_duration_mode(String s) { s = s.upper_str(); - last_duration_mode = (s== "LAST"); + last_duration_mode_b_ = (s== "LAST"); } void My_lily_parser::set_default_duration(Duration const *d) { - last_duration_mode = false; + last_duration_mode_b_ = false; default_duration_ = *d; } @@ -123,15 +123,15 @@ My_lily_parser::set_default_duration(Duration const *d) void My_lily_parser::set_last_duration(Duration const *d) { - if (last_duration_mode) + if (last_duration_mode_b_) default_duration_ = *d; } -Voice_element* +Chord* My_lily_parser::get_word_element(Text_def* tdef_p, Duration * duration_p) { - Voice_element* velt_p = new Voice_element; + Chord* velt_p = new Voice_element; Lyric_req* lreq_p = new Lyric_req(tdef_p); @@ -144,15 +144,16 @@ My_lily_parser::get_word_element(Text_def* tdef_p, Duration * duration_p) return velt_p; } -Voice_element * +Chord * My_lily_parser::get_rest_element(String s, Duration * duration_p ) { - Voice_element* velt_p = new Voice_element; + Chord* velt_p = new Voice_element; velt_p->set_spot( here_input()); if (s=="s") { /* Space */ Skip_req * skip_p = new Skip_req; - skip_p->duration_ = duration_p->length(); + skip_p->duration_ = *duration_p; + skip_p->set_spot( here_input()); velt_p->add(skip_p); } @@ -172,10 +173,10 @@ My_lily_parser::get_rest_element(String s, Duration * duration_p ) return velt_p; } -Voice_element * +Chord * My_lily_parser::get_note_element(Note_req *rq, Duration * duration_p ) { - Voice_element*v = new Voice_element; + Chord*v = new Voice_element; v->set_spot( here_input()); v->add(rq); @@ -264,12 +265,12 @@ My_lily_parser::My_lily_parser(Sources * source_l) default_octave_i_ = 0; textstyle_str_="roman"; // in lexer? error_level_i_ = 0; - last_duration_mode = false; + last_duration_mode_b_ = true; fatal_error_i_ = 0; } void -My_lily_parser::add_requests(Voice_element*v) +My_lily_parser::add_requests(Chord*v) { for (int i = 0; i < pre_reqs.size(); i++) { v->add(pre_reqs[i]); diff --git a/lily/note-column-reg.cc b/lily/note-column-reg.cc index 8ea7cc2d68..4dbf16f887 100644 --- a/lily/note-column-reg.cc +++ b/lily/note-column-reg.cc @@ -64,7 +64,7 @@ Note_column_register::acknowledge_element(Score_elem_info i) } void -Note_column_register::pre_move_processing() +Note_column_register::do_pre_move_processing() { Script_column *col_l = ( ncol_p_ ) ? ncol_p_ : restcol_p_; if (!col_l) @@ -92,7 +92,7 @@ Note_column_register::pre_move_processing() } void -Note_column_register::post_move_processing() +Note_column_register::do_post_move_processing() { script_l_arr_.set_size(0); stem_l_ =0; @@ -114,7 +114,8 @@ Note_column_register::Note_column_register() ncol_p_=0; restcol_p_ =0; - post_move_processing(); + do_post_move_processing(); } IMPLEMENT_STATIC_NAME(Note_column_register); +IMPLEMENT_IS_TYPE_B1(Note_column_register,Request_register); ADD_THIS_REGISTER(Note_column_register); diff --git a/lily/note-column.cc b/lily/note-column.cc index 9af2cd3fd4..09ef114684 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -13,6 +13,7 @@ #include "stem.hh" IMPLEMENT_STATIC_NAME(Note_column); +IMPLEMENT_IS_TYPE_B1(Note_column,Script_column); void Note_column::add(Stem*stem_l) diff --git a/lily/note.cc b/lily/note.cc index e0c974aa9a..2db3dd6bef 100644 --- a/lily/note.cc +++ b/lily/note.cc @@ -8,14 +8,13 @@ #include "debug.hh" #include "musical-request.hh" #include "command-request.hh" -#include "voice.hh" +#include "music-list.hh" #include "script.hh" #include "identifier.hh" #include "varray.hh" #include "text-def.hh" #include "parseconstruct.hh" -#include "input-music.hh" -#include "voice-element.hh" + String * @@ -46,7 +45,7 @@ get_scriptdef(char c) } Request* -get_script_req(int d , Script_def*def) +get_script_req(int d , General_script_def*def) { Musical_script_req* script_req_p = new Musical_script_req; script_req_p->dir_i_ =d; @@ -54,12 +53,7 @@ get_script_req(int d , Script_def*def) return script_req_p; } -Request* -get_text_req(int d , Text_def*def) -{ - Text_req* text_req_p = new Text_req(d, def); - return text_req_p; -} + Request* get_stemdir_req(int d) diff --git a/lily/notehead.cc b/lily/notehead.cc index 0e55a26a7f..fa21149a6f 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -44,6 +44,7 @@ Note_head::set_rhythmic(Rhythmic_req*r_req_l) } IMPLEMENT_STATIC_NAME(Note_head); +IMPLEMENT_IS_TYPE_B1(Note_head,Item); void Note_head::do_print()const @@ -82,10 +83,10 @@ Note_head::brew_molecule_p() const Molecule dm; dm.add(Atom(d)); if (!(position_i_ %2)) - dm.translate(Offset(0,dy)); + dm.translate_y(dy); out->add_right(dm); } - out->translate(Offset(x_dir_i_ * p->note_width(),0)); + out->translate_x(x_dir_i_ * p->note_width()); bool streepjes = (position_i_<-1)||(position_i_ > staff_size_i_+1); if (rest_b_ && balltype_i_ > 2) @@ -98,11 +99,11 @@ Note_head::brew_molecule_p() const Molecule sm; sm.add(Atom(str)); if (position_i_ % 2) - sm.translate(Offset(0,-dy* dir)); + sm.translate_y(-dy* dir); out->add(sm); } - out->translate(Offset(0,dy*position_i_)); + out->translate_y(dy*position_i_); return out; } diff --git a/lily/p-col.cc b/lily/p-col.cc index 66701e3840..f55ea2452b 100644 --- a/lily/p-col.cc +++ b/lily/p-col.cc @@ -23,6 +23,19 @@ PCol::width() const return w; } +void +PCol::clean_breakable_items() +{ + if (!line_l_) { + for(iter(its.top(), j); j.ok(); ) { + j->unlink(); + j.del(); + } + } + if (prebreak_p_) prebreak_p_->clean_breakable_items(); + if (postbreak_p_) postbreak_p_->clean_breakable_items(); +} + int PCol::rank_i() const { @@ -94,6 +107,12 @@ PCol::set_breakable() } bool +PCol::breakpoint_b() const +{ + return !line_l_; +} + +bool PCol::breakable_b() const { return prebreak_p_||postbreak_p_; diff --git a/lily/p-score.cc b/lily/p-score.cc index d6c4a63940..44acc399bd 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -23,6 +23,7 @@ PScore::typeset_element(Score_elem * elem_p) { elem_p_list_.bottom().add(elem_p); elem_p->pscore_l_ = this; + elem_p->add_processing(); } @@ -31,12 +32,12 @@ PScore::typeset_item(Item *i, PCol *c, int breakstat) { assert(c && i); - if (breakstat == 0) { + if (breakstat == -1) { typeset_item(i, c->prebreak_p_); return; } - if (breakstat == 2) { + if (breakstat == 1) { typeset_item(i, c->postbreak_p_); return; } @@ -177,6 +178,7 @@ PScore::print() const void PScore::preprocess() { + super_elem_l_->breakable_col_processing(); super_elem_l_->pre_processing(); } @@ -205,7 +207,7 @@ PScore::set_breaking(Array<Col_hpositions> const &breaking) super_elem_l_->break_processing(); - for (iter_top(spanners,i); i.ok(); ) { + for (iter(spanners.top(),i); i.ok(); ) { Spanner *span_p = i.remove_p(); if (span_p->broken_b()) { span_p->unlink(); @@ -214,6 +216,9 @@ PScore::set_breaking(Array<Col_hpositions> const &breaking) typeset_broken_spanner(span_p); } } + + for (iter_top(cols, i); i.ok(); i++) + i->clean_breakable_items(); } void @@ -235,6 +240,7 @@ PScore::process() *mlog << "\nPostprocessing elements..." << endl; postprocess(); } + /** Get all breakable columns between l and r, (not counting l and r). */ Link_array<PCol> PScore::breakable_col_range(PCol*l,PCol*r)const diff --git a/lily/paper-def.cc b/lily/paper-def.cc index eaabea2fbe..3691fabfd5 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -15,10 +15,6 @@ -// golden ratio -const Real PHI = (1+sqrt(5))/2; - -// see Roelofs, p. 57 Real Paper_def::duration_to_dist(Moment d) { diff --git a/lily/parser.y b/lily/parser.y index 532380bc10..7ccb227ccf 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -1,7 +1,7 @@ %{ // -*-Fundamental-*- #include <iostream.h> -#define MUDELA_VERSION "0.0.58" +#define MUDELA_VERSION "0.0.59" #include "script-def.hh" #include "symtable.hh" @@ -11,9 +11,6 @@ #include "paper-def.hh" #include "midi-def.hh" #include "main.hh" -#include "input-score.hh" -#include "input-staff.hh" -#include "input-music.hh" #include "keyword.hh" #include "debug.hh" #include "parseconstruct.hh" @@ -21,10 +18,11 @@ #include "identifier.hh" #include "command-request.hh" #include "musical-request.hh" -#include "voice-element.hh" #include "my-lily-parser.hh" #include "text-def.hh" #include "input-register.hh" +#include "score.hh" +#include "music-list.hh" #ifndef NDEBUG #define YYDEBUG 1 @@ -46,31 +44,28 @@ Array<String> * strvec; Array<int> *intvec; Box *box; + Chord * chord; Duration *duration; Identifier *id; Input_register * iregs; - Input_music *music; - Input_score *score; - Input_staff *staff; + Music *music; + Music_list *musiclist; + Score *score; Interval *interval; Lookup*lookup; Melodic_req * melreq; Midi_def* midi; Moment *moment; - Music_general_chord *chord; - Music_voice *mvoice; Note_req *notereq; Paper_def *paper; Real real; Request * request; - Script_def * script; + General_script_def * script; String *string; Symbol * symbol; Symtable * symtable; Symtables * symtables; Text_def * textdef; - Voice *voice; - Voice_element *el; char c; const char *consstr; int i; @@ -100,10 +95,14 @@ yylex(YYSTYPE *s, void * v_l) /* tokens which are not keywords */ %token CONCAT +%token ALIAS %token BAR %token CADENZA %token CLEAR %token CLEF +%token CONTAINS +%token CONSISTS +%token ACCEPTS %token CM_T %token DURATIONCOMMAND %token ABSDYNAMIC @@ -111,9 +110,10 @@ yylex(YYSTYPE *s, void * v_l) %token GEOMETRIC %token GROUPING %token GROUP -%token INPUT_REGS +%token REQUESTREGISTER %token HSHIFT %token IN_T +%token ID %token INIT_END %token LYRIC %token KEY @@ -122,7 +122,7 @@ yylex(YYSTYPE *s, void * v_l) %token METER %token MIDI %token MM_T -%token MULTIVOICE +%token MULTI %token NOTE %token NOTENAMES %token OCTAVECOMMAND @@ -152,18 +152,18 @@ yylex(YYSTYPE *s, void * v_l) /* escaped */ %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR -%token <i> DOTS +%type <i> dots %token <i> INT %token <melreq> NOTENAME_ID -%token <id> REGS_IDENTIFIER %token <id> IDENTIFIER %token <id> MELODIC_REQUEST_IDENTIFIER -%token <id> CHORD_IDENTIFIER +%token <id> MUSIC_IDENTIFIER %token <id> VOICE_IDENTIFIER %token <id> POST_REQUEST_IDENTIFIER %token <id> SCRIPT_IDENTIFIER %token <id> STAFF_IDENTIFIER %token <id> REAL_IDENTIFIER +%token <id> INT_IDENTIFIER %token <id> SCORE_IDENTIFIER %token <id> REQUEST_IDENTIFIER %token <real> REAL @@ -176,8 +176,7 @@ yylex(YYSTYPE *s, void * v_l) %type <box> box %type <c> open_request_parens close_request_parens %type <c> open_plet_parens close_plet_parens -%type <chord> music_chord music_chord_body init_music_chord -%type <el> voice_elt full_element lyrics_elt command_elt +%type <music> simple_element music_elt full_element lyrics_elt command_elt %type <i> int %type <i> script_dir %type <id> declaration @@ -190,31 +189,27 @@ yylex(YYSTYPE *s, void * v_l) %type <melreqvec> pitch_list %type <midi> midi_block midi_body %type <moment> duration_length -%type <music> init_music -%type <mvoice> simple_horizontal_music horizontal_music horizontal_music_body -%type <mvoice> transposed_music_voice init_lyrics_voice -%type <mvoice> music_voice_body init_music_voice +%type <music> init_melodic init_lyrics init_music +%type <music> Music transposed_music +%type <musiclist> Voice Voice_body +%type <chord> Chord Chord_body %type <paper> paper_block paper_body %type <real> dim real %type <real> unit %type <request> post_request pre_request command_req verbose_command_req abbrev_command_req -%type <request> pure_post_request pure_post_request_choice -%type <request> script_req textscript_req dynamic_req +%type <request> script_req dynamic_req %type <score> score_block score_body -%type <script> script_definition script_body mudela_script -%type <staff> staff_block staff_init staff_body +%type <script> script_definition script_body mudela_script gen_script_def +%type <textdef> text_def %type <string> declarable_identifier %type <string> script_abbreviation %type <id> old_identifier %type <symbol> symboldef %type <symtable> symtable symtable_body -%type <textdef> mudela_text -%type <iregs> input_regs input_regs_body +%type <iregs> input_register_spec input_register_spec_body %left PRIORITY -%expect 1 /* have to fix this. */ - %% mudela: /* empty */ @@ -226,6 +221,7 @@ mudela: /* empty */ | mudela check_version { } | mudela add_notenames { } | mudela init_end {} + | mudela input_register_spec { add_global_input_register($2); } ; init_end: INIT_END ';' { @@ -287,15 +283,11 @@ declarable_identifier: old_identifier: IDENTIFIER | MELODIC_REQUEST_IDENTIFIER - | CHORD_IDENTIFIER - | VOICE_IDENTIFIER | POST_REQUEST_IDENTIFIER | SCRIPT_IDENTIFIER - | STAFF_IDENTIFIER | REAL_IDENTIFIER | SCORE_IDENTIFIER | REQUEST_IDENTIFIER - | REGS_IDENTIFIER ; declaration: @@ -303,24 +295,12 @@ declaration: $$ = new Score_id(*$1, $3, SCORE_IDENTIFIER); delete $1; } - | declarable_identifier '=' staff_block { - $$ = new Staff_id(*$1, $3, STAFF_IDENTIFIER); - delete $1; - } - | declarable_identifier '=' init_music_voice { - $$ = new M_voice_id(*$1, $3, VOICE_IDENTIFIER); - delete $1; - } - | declarable_identifier '=' init_lyrics_voice { - $$ = new M_voice_id(*$1, $3, VOICE_IDENTIFIER); - delete $1; - } | declarable_identifier '=' script_definition { $$ = new Script_id(*$1, $3, SCRIPT_IDENTIFIER); delete $1; } - | declarable_identifier '=' init_music_chord { - $$ = new M_chord_id(*$1, $3, CHORD_IDENTIFIER); + | declarable_identifier '=' init_music { + $$ = new Music_id(*$1, $3, MUSIC_IDENTIFIER); delete $1; } | declarable_identifier '=' symtables { @@ -332,7 +312,7 @@ declaration: delete $1; } - | declarable_identifier '=' pure_post_request { + | declarable_identifier '=' post_request { $$ = new Request_id(*$1, $3, POST_REQUEST_IDENTIFIER); delete $1; } @@ -340,36 +320,33 @@ declaration: $$ = new Request_id(*$1, $3, MELODIC_REQUEST_IDENTIFIER); delete $1; } - | declarable_identifier '=' input_regs { - $$ = new Input_regs_id(*$1, $3, REGS_IDENTIFIER); - delete $1; - } ; -input_regs: - INPUT_REGS - { THIS->remember_spot(); } - '{' input_regs_body '}' - { - $$ = $4; - $$->set_spot(THIS->pop_spot()); - } + +input_register_spec: + REQUESTREGISTER '{' input_register_spec_body '}' + { $$ = $3; } ; -input_regs_body: - REGS_IDENTIFIER { - $$ = $1->iregs(true); +input_register_spec_body: + STRING { + $$ = new Input_register; + $$->name_str_ =*$1; + delete $1; } - |STRING { - $$ = new Input_register; - $$->name_str_ = *$1; + | input_register_spec_body ALIAS STRING ';' { + $$-> alias_str_arr_.push(*$3); + delete $3; } - | input_regs_body input_regs { - $$->add($2); + | input_register_spec_body CONSISTS STRING ';' { + $$-> consists_str_arr_.push(*$3); + delete $3; + } + | input_register_spec_body CONTAINS input_register_spec { + $$->add($3); } ; - /* SCORE */ @@ -388,14 +365,20 @@ score_block: ; score_body: { - $$ = new Input_score; + $$ = new Score; } | SCORE_IDENTIFIER { $$ = $1->score(true); } - | score_body staff_block { $$->add($2); } - | score_body paper_block { $$->set($2); } - | score_body midi_block { $$->set($2); } + | score_body init_music { + $$->music_p_ = $2; + } + | score_body paper_block { + $$->paper_p_ = $2; + } + | score_body midi_block { + $$->midi_p_ = $2; + } | score_body error { } @@ -458,180 +441,113 @@ midi_body: { } ; -/* - STAFFs -*/ -staff_block: - STAFF { THIS->remember_spot(); } -/*cont*/ '{' staff_body '}' { - $$ = $4; - $$-> set_spot(THIS->pop_spot()); - } - | { THIS->remember_spot(); } -/*cont*/ STAFF_IDENTIFIER { - $$ = $2->staff(true); - $$-> set_spot(THIS->pop_spot()); - } - ; - -staff_init: - STAFF_IDENTIFIER { - $$ = $1->staff(true); - } - | REGS_IDENTIFIER { - $$ = new Input_staff; - $$->ireg_p_ = $1->iregs(true); - } - | input_regs { - $$ = new Input_staff; - $$->ireg_p_ = $1; - } - ; - -staff_body: - staff_init - | staff_body init_music { - $$ = $1; - $2->set_default_group( "staff_music" + String($$->music_.size())); - $$->add($2); - } - | staff_body error { - } - ; - /* let the lexer switch mode. */ init_music: - init_music_voice { $$ = $1; } - | init_music_chord { $$ = $1; } - | init_lyrics_voice { $$ = $1; } - | VOICE_IDENTIFIER { - $$ = $1->mvoice(true); - } + init_melodic { $$ = $1; } + | init_lyrics { $$ = $1; } ; -init_lyrics_voice: - LYRIC { THIS->lexer_p_->push_lyric_state(); } - horizontal_music { $$ = $3; THIS->lexer_p_->pop_state(); } +init_lyrics: + LYRIC + { THIS->lexer_p_->push_lyric_state(); } + Music + { $$ = $3; THIS->lexer_p_->pop_state(); } ; -init_music_voice: - MELODIC { THIS->lexer_p_->push_note_state(); } - /* cont*/ horizontal_music +init_melodic: + MELODIC + { THIS->lexer_p_->push_note_state(); } + Music { $$=$3; THIS->lexer_p_->pop_state(); } ; -init_music_chord: - { THIS->lexer_p_->push_note_state(); } - /* cont*/ music_chord - { $$=$2; THIS->lexer_p_->pop_state(); } - ; /* MUSIC */ -horizontal_music: - '{' horizontal_music_body '}' { +Voice: + '{' Voice_body '}' { $$ = $2; } ; -horizontal_music_body: - simple_horizontal_music { - $$ = $1; +Voice_body: + /**/ { + $$ = new Voice; } - | horizontal_music_body CONCAT simple_horizontal_music { - $$->add($3);/* niet echt */ - } - ; - - -simple_horizontal_music: - TRANSPOSE '{' transposed_music_voice '}' { - $$ = $3; - } - | VOICE_IDENTIFIER { - $$ = $1->mvoice(true); + | Voice_body ID STRING STRING ';' { + $$ = new Voice; + $$->type_str_ = *$3; + $$->id_str_ = *$4; + delete $3; + delete $4; } - | music_voice_body { - $$ = $1; + | Voice_body Music { + $$->add($2); } ; +Music: + full_element { $$ = $1; } + | Voice { $$ = $1; } + | Chord { $$ = $1; } + | transposed_music { $$ = $1; } + | MUSIC_IDENTIFIER { $$ = $1->music(true); } + ; -transposed_music_voice: - steno_melodic_req horizontal_music { - $$ = $2; - $$->transpose(*$1); - delete $1; - } +Chord: + '<' Chord_body '>' { $$ = $2; } ; - -music_voice_body: - /* */ { - $$ = new Music_voice; +Chord_body: + /**/ { + $$ = new Chord; + $$-> multi_level_i_ = 1; } - | music_voice_body full_element { - $$->add_elt($2); + | Chord_body MULTI INT ';' { + $$->multi_level_i_=$3; } - | music_voice_body voice_command ';' { + | Chord_body ID STRING STRING ';' { + $$->type_str_ = *$3; + $$->id_str_ = *$4; + delete $4; + delete $3; } - | music_voice_body music_chord { + | Chord_body Music { $$->add($2); } - | music_voice_body error { - } - | music_voice_body '>' { - THIS->fatal_error_i_ = 1; - THIS->parser_error("Confused by errors: bailing out"); - } ; -music_chord: '<' music_chord_body '>' { $$ = $2; } - ; - -music_chord_body: - CHORD_IDENTIFIER { - $$=$1->mchord(true); - } - | /* */ { - $$ = new Voice_group_chord; - } - | MULTIVOICE { - $$ = new Multi_voice_chord; - } - | music_chord_body horizontal_music { - $$->add($2); - } - | music_chord_body full_element { - $$ ->add_elt($2); - } - | music_chord_body '}' { - THIS->fatal_error_i_ = 1; - THIS->parser_error("Confused by errors: bailing out"); - } - | music_chord_body error { +transposed_music: + TRANSPOSE steno_melodic_req Music { + $$ = $3; + $$ -> transpose($2); + delete $2; } ; + /* VOICE ELEMENTS */ -full_element: pre_requests voice_elt post_requests { - THIS->add_requests($2); - $$ = $2; - } - | pre_requests lyrics_elt post_requests { - THIS->add_requests($2); +full_element: + pre_requests simple_element post_requests { + THIS->add_requests((Chord*)$2);//ugh $$ = $2; - } - | command_elt + } + | voice_command ';' { $$ = 0; } ; +simple_element: + music_elt + | lyrics_elt + | command_elt + ; + command_elt: /* empty */ { $$ = new Voice_element; @@ -640,9 +556,16 @@ command_elt: /* cont: */ command_req { $2-> set_spot( THIS->here_input()); - $$->add($2); + ((Chord*)$$) ->add($2);//ugh } + | GROUP STRING ';' { // ugh ugh ugh + Change_reg *chr_p = new Change_reg; + $$ = chr_p; + chr_p-> type_str_ = "Voice_group_registers"; //ugh + chr_p-> id_str_ = *$2; + delete $2; + } ; command_req: @@ -674,7 +597,10 @@ verbose_command_req: } | SKIP duration_length { Skip_req * skip_p = new Skip_req; - skip_p->duration_ = *$2; + skip_p->duration_ = Duration(1,0); + skip_p->duration_.set_plet($2->numerator().as_long(), + $2->denominator().as_long()); + delete $2; $$ = skip_p; } @@ -704,11 +630,7 @@ verbose_command_req: | GROUPING intastint_list { $$ = get_grouping_req(*$2); delete $2; } - | GROUP STRING { - $$ = new Group_change_req; - $$ -> command()->groupchange()->newgroup_str_ = *$2; - delete $2; - } + ; post_requests: @@ -721,26 +643,15 @@ post_requests: } ; -post_request: - pure_post_request - | POST_REQUEST_IDENTIFIER { - $$ = $1->request(false)->clone(); - } - ; -pure_post_request: - pure_post_request_choice { - $$ = $1; - $$->set_spot( THIS->here_input()); +post_request: + POST_REQUEST_IDENTIFIER { + $$ = (Request*)$1->request(true); } - ; - -pure_post_request_choice: - close_request_parens { + |close_request_parens { $$ = THIS->get_parens_request($1); } | script_req - | textscript_req | dynamic_req ; @@ -816,6 +727,7 @@ close_request_parens: $$ = ']'; } | close_plet_parens { + $$ = ']'; } | E_SMALLER { $$ = '<'; @@ -824,7 +736,7 @@ close_request_parens: $$ = '>'; } ; - + open_plet_parens: '[' INT '/' INT { $$ = '['; @@ -854,30 +766,39 @@ script_definition: script_body: STRING int int int int { - $$ = new Script_def; - $$->set_from_input(*$1,$2, $3,$4,$5); + Script_def *s = new Script_def; + s->set_from_input(*$1,$2, $3,$4,$5); + $$ = s; delete $1; } ; -textscript_req: - script_dir mudela_text { $$ = get_text_req($1,$2); } +script_req: + script_dir gen_script_def { + Musical_script_req *m = new Musical_script_req; + $$ = m; + m-> scriptdef_p_ = $2; + m-> set_spot ( THIS->here_input() ); + m-> dir_i_ = $1; + } ; -mudela_text: - STRING { - $$ = new Text_def; - $$->text_str_ = *$1; - delete $1; - $$->style_str_ = THIS->textstyle_str_; - } +gen_script_def: + text_def { $$ = $1; } + | mudela_script ; -script_req: - script_dir mudela_script { - $$ = get_script_req($1, $2); +text_def: + STRING { + Text_def *t = new Text_def; + $$ = t; + t->text_str_ = *$1; + delete $1; + t->style_str_ = THIS->textstyle_str_; + $$->set_spot( THIS->here_input() ); } ; + script_abbreviation: '^' { $$ = get_scriptdef('^'); } | '+' { $$ = get_scriptdef('+'); } @@ -885,9 +806,7 @@ script_abbreviation: | '|' { $$ = get_scriptdef('|'); } | 'o' { $$ = get_scriptdef('o'); } | '>' { $$ = get_scriptdef('>'); } - | DOTS { - if ( $1 > 1 ) - THIS->here_input().warning( "too many staccato dots" ); + | '.' { $$ = get_scriptdef('.'); } ; @@ -953,7 +872,7 @@ voice_command: ; duration_length: - { + { $$ = new Moment(0,1); } | duration_length explicit_duration { @@ -961,13 +880,18 @@ duration_length: } ; +dots: + '.' { $$ = 1; } + | dots '.' { $$ ++; } + ; + notemode_duration: /* */ { $$ = new Duration(THIS->default_duration_); } - | DOTS { + | dots { $$ = new Duration(THIS->default_duration_); - $$->dots_i_ = $1; + $$->dots_i_ = $1; } | explicit_duration { THIS->set_last_duration($1); @@ -985,8 +909,8 @@ explicit_duration: $$->set_plet(THIS->default_duration_); } } - | explicit_duration DOTS { - $$->dots_i_ = $2; + | explicit_duration '.' { + $$->dots_i_ ++; } | explicit_duration '*' int { $$->plet_.iso_i_ *= $3; @@ -997,7 +921,7 @@ explicit_duration: ; -voice_elt: +music_elt: steno_note_req notemode_duration { if (!THIS->lexer_p_->note_state_b()) THIS->parser_error("have to be in Note mode for notes"); @@ -1011,7 +935,7 @@ voice_elt: ; lyrics_elt: - mudela_text notemode_duration { + text_def notemode_duration { if (!THIS->lexer_p_->lyric_state_b()) THIS->parser_error("Have to be in Lyric mode for lyrics"); $$ = THIS->get_word_element($1, $2); @@ -1030,18 +954,17 @@ pitch_list: { ; int: - real { - $$ = int($1); - if ( distance($1,Real(int($$)) ) > 1e-8) - yyerror( "integer expected" ); + INT { + $$ = $1; + } + | INT_IDENTIFIER { + $$ = * $1->intid(0); } ; + real: - INT { - $$ = Real($1); - } - | REAL { + REAL { $$ = $1; } | REAL_IDENTIFIER { diff --git a/lily/pulk-voice.cc b/lily/pulk-voice.cc deleted file mode 100644 index e54c429f42..0000000000 --- a/lily/pulk-voice.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - pulk-voices.cc -- implement Pulk_voice - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ -#include "pulk-voice.hh" -#include "voice.hh" -#include "musical-request.hh" -#include "voice-element.hh" - -Pulk_voice::Pulk_voice(Voice*voice_l, int idx) - : cur_(voice_l->elts_) -{ - elt_mom_ = voice_l->start_; - staff_idx_= idx; - set_subtle(); -} - -Array<Request*> -Pulk_voice::get_req_l_arr() -{ - Array<Request*> req_l_arr; - Moment w = when(); - do { - Moment sub = subtle_moment_priorities_[subtle_idx_]; - for (PCursor<Request*> i(cur_->req_p_list_); i.ok(); i++) { - Musical_req* m_l = i->musical(); - if (!sub) { - if (!(m_l && m_l->subtle() && m_l->subtle()->subtime_ )) - req_l_arr.push(i); - } else { - if (m_l && m_l->subtle() && m_l->subtle()->subtime_ == sub) - req_l_arr.push(i); - } - } - next(); - } while ( ok() && when () == w); - return req_l_arr; -} - -void -Pulk_voice::set_subtle() -{ - subtle_idx_ =0; - - subtle_moment_priorities_.set_size(0); - if (!cur_.ok()) - return; - for (PCursor<Request*> i(cur_->req_p_list_); i.ok(); i++) { - Musical_req* m_l = i->musical(); - if (m_l&&m_l->subtle()){ - Moment sub = m_l->subtle()->subtime_; - subtle_moment_priorities_.insert(sub); - } else { - subtle_moment_priorities_.insert(0); - } - } -} - -void -Pulk_voice::next() -{ - assert(ok()); - subtle_idx_++; - if (subtle_idx_ == subtle_moment_priorities_.size()) { - elt_mom_ += cur_->duration_; - cur_ ++; - set_subtle(); - } -} - -Moment -Pulk_voice::when()const -{ - return elt_mom_ + subtle_moment_priorities_[subtle_idx_]; -} diff --git a/lily/pulk-voices.cc b/lily/pulk-voices.cc deleted file mode 100644 index 6a480fab6a..0000000000 --- a/lily/pulk-voices.cc +++ /dev/null @@ -1,121 +0,0 @@ -/* - pulk-voices.cc -- implement Pulk_voices - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "pulk-voice.hh" -#include "pulk-voices.hh" -#include "staff.hh" -#include "voice.hh" -#include "request-column.hh" -#include "debug.hh" - -Pulk_voices::Pulk_voices(Link_list<Staff*> const& l) - : staff_l_list_(l) -{ - int staff_i = 0; - last_= 0; - Moment min_staff_last_mom=1e8; // ugh - for (iter_top(l, i); i.ok(); i++, staff_i++) { - Moment staff_last=0; - for (iter_top(i->voice_list_,j); j.ok(); j++) { - if (j->elts_.size()) { - staff_last = staff_last >? j->last(); - voice_pq_.insert(Voice_l(j, staff_i)); - } - } - min_staff_last_mom = min_staff_last_mom <? staff_last; - last_ = last_ >? staff_last; - } - next_mom_ = voice_pq_.front().l_->start_; - time_arr_.set_size(staff_i); - - if (last_ != min_staff_last_mom) - warning("Not all staffs end simultaneously"); - -} - -void -Pulk_voices::get_aligned_request(Request_column* col_l) -{ - while (voice_pq_.size() && voice_pq_.front().l_->start_ == next_mom_) { - Voice_l v = voice_pq_.get(); - pulk_p_list_.bottom().add( new Pulk_voice ( v.l_, v.staff_idx_ )); - } - - /* hairy. #i# is a cursor which points to Pulk_voice (which a - cursor, essentially) - - - At the same time bookkeeping of measures is done. - */ - - Moment new_next_mom = last_; - iter(pulk_p_list_.top() , i); - while ( i.ok() ) { - mtor << "considering staff"<< i->staff_idx_ << "at " << i->when() << "\n"; - assert (i->when() >= next_mom_); - if (i->when() == next_mom_) { - col_l->add_reqs(i->staff_idx_, i->get_req_l_arr() ); - Time_description &t_r = time_arr_[i->staff_idx_]; - col_l->update_time(i->staff_idx_, t_r); - - if (! t_r.cadenza_b_ && t_r.next_bar_moment() > next_mom_) { - mtor << "next bar at: " << t_r.next_bar_moment(); - new_next_mom = new_next_mom <? t_r.next_bar_moment(); - } - - if (!i->ok()) { - i.del(); - continue; - } - } - assert( i->when() > next_mom_); - /* no need to call i->next(), since this is done automatically */ - new_next_mom = new_next_mom <? i->when(); - - i++; - - } - - if (voice_pq_.size() ) - new_next_mom = new_next_mom <? voice_pq_.front().l_->start_; - - for (int j=0; j < time_arr_.size(); j++) - time_arr_[j].add( new_next_mom - next_mom_ ); - - if (pulk_p_list_.size()) - assert( new_next_mom > next_mom_); - next_mom_ = new_next_mom; -} - - -bool -Pulk_voices::ok() const -{ - return pulk_p_list_.size() || voice_pq_.size(); -} - -int -compare(Voice_l const& v1, Voice_l const& v2) -{ - return sign(v1.l_->start_ - v2.l_->start_); -} - -Moment -Pulk_voices::next_mom()const -{ - return next_mom_; -} - -bool -Pulk_voices::time_checks_failed_b()const -{ - bool b = false; - for (int i=0; !b && i < time_arr_.size(); i++) - b|=time_arr_[i].error_b_; - return b; -} diff --git a/lily/register-group.cc b/lily/register-group.cc index f16aeb9e61..90dccee14f 100644 --- a/lily/register-group.cc +++ b/lily/register-group.cc @@ -10,15 +10,15 @@ #include "plist.hh" #include "register-group.hh" #include "register.hh" +#include "debug.hh" +#include "p-score.hh" +#include "score-elem.hh" +#include "input-register.hh" -bool -Register_group_register::acceptable_request_b(Request* r)const + +Register_group_register::Register_group_register() { - for (iter_top(reg_list_, i); i.ok(); i++) { - if (i->acceptable_request_b(r)) - return true; - } - return false; + ireg_l_ =0; } void @@ -44,48 +44,39 @@ Register_group_register::sync_features() } void -Register_group_register::pre_move_processing() +Register_group_register::do_pre_move_processing() { iter_top(reg_list_, i); while (i.ok()) { - // this construction to ensure clean deletion + Request_register *reg_l = i++; reg_l->pre_move_processing(); } } void -Register_group_register::process_requests() +Register_group_register::do_process_requests() { iter_top(reg_list_, i); while (i.ok()) { - // this construction to ensure clean deletion + Request_register *reg_l = i++; reg_l->process_requests(); } } + void -Register_group_register::post_move_processing() +Register_group_register::do_post_move_processing() { iter_top(reg_list_, i); while (i.ok()) { - // this construction to ensure clean deletion + // this construction to ensure clean deletion Request_register *reg_l = i++; reg_l->post_move_processing(); } } -void -Register_group_register::acknowledge_element(Score_elem_info info) -{ - Request_register* origin = info.origin_reg_l_arr_[0]; - if (!contains_b(origin) && !origin->contains_b(this)) // am i sure? - return; - - for (iter_top(reg_list_, i); i.ok(); i++) - i->acknowledge_element(info); -} bool Register_group_register::contains_b(Request_register* reg_l)const @@ -103,24 +94,14 @@ Register_group_register::contains_b(Request_register* reg_l)const bool -Register_group_register::try_request(Request*req_l) -{ - iter_top(reg_list_, i); - while (i.ok()) { - - - // this construction to ensure clean deletion - Request_register *reg_l = i++; - if (reg_l->try_request( req_l )) - return true; - } - return false; -} -void -Register_group_register::add(Array<Request_register*> p_arr) +Register_group_register::do_try_request(Request*req_l) { - for (int i =0; i<p_arr.size(); i++) - add(p_arr[i]); + bool hebbes_b =false; + for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++) + hebbes_b =nongroup_l_arr_[i]->try_request(req_l); + if (!hebbes_b) + hebbes_b = daddy_reg_l_->try_request(req_l); + return hebbes_b ; } void @@ -128,28 +109,34 @@ Register_group_register::add(Request_register *reg_p) { reg_list_.bottom().add(reg_p); reg_p->daddy_reg_l_ = this; -} - -Register_group_register::~Register_group_register() -{ - + if (reg_p->is_type_b(Register_group_register::static_name())) { + group_l_arr_.push((Register_group_register*)reg_p); + } else { + nongroup_l_arr_ .push(reg_p); + } } + Request_register * -Register_group_register::get_register_p(Request_register*reg_l) +Register_group_register::remove_register_p(Request_register*reg_l) { + group_l_arr_.substitute((Register_group_register*)reg_l,0); + nongroup_l_arr_.substitute(reg_l,0); iterator(reg_list_) reg_cur= reg_list_.find(reg_l); - assert(reg_cur.ok()); + return reg_cur.remove_p(); } void Register_group_register::terminate_register(Request_register*r_l) { - delete get_register_p(r_l); + Request_register * reg_p =remove_register_p(r_l); + reg_p->do_removal_processing(); + delete reg_p; } +IMPLEMENT_IS_TYPE_B1(Register_group_register,Request_register); IMPLEMENT_STATIC_NAME(Register_group_register); ADD_THIS_REGISTER(Register_group_register); @@ -157,7 +144,121 @@ void Register_group_register::do_print()const { #ifndef NPRINT + mtor << "ID: " << id_str_ << "\n"; for (iter_top(reg_list_, i); i.ok(); i++) i->print(); #endif } + + +Register_group_register* +Register_group_register::find_register_l(String n, String id) +{ + if (name() == n && id_str_ == id) + return this; + Register_group_register * r = 0; + for (int i =0; !r && i< group_l_arr_.size(); i++) { + r = group_l_arr_[i]->find_register_l(n,id); + } + + return r; +} + +Register_group_register* +Register_group_register::find_get_reg_l(String n,String id) +{ + Register_group_register * ret=0; + if (ireg_l_-> find_ireg_l( n )) { + ret = find_register_l(n,id); + if (!ret) { + ret = ireg_l_-> find_ireg_l(n) -> get_group_register_p(); + add ( ret ); + ret ->id_str_ = id; + } + } else if (daddy_reg_l_) + ret =daddy_reg_l_->find_get_reg_l(n,id); + else { + warning("Can't find or create `" + n + "' called `" + id + "'\n"); + ret =0; + } + return ret; +} + +int +Register_group_register::depth_i()const +{ + return daddy_reg_l_->depth_i() + 1; +} + +Register_group_register* +Register_group_register::ancestor_l(int l) +{ + if (!l || !daddy_reg_l_) + return this; + + return daddy_reg_l_->ancestor_l(l-1); +} + +void +Register_group_register::announce_element(Score_elem_info info) +{ + announce_info_arr_.push(info); + Request_register::announce_element(info); +} + +void +Register_group_register::do_announces() +{ + for (int i=0; i < group_l_arr_.size(); i++) { + group_l_arr_[i]->do_announces(); + } + + Request dummy_req; + + for (int j =0; j < announce_info_arr_.size(); j++){ + Score_elem_info info = announce_info_arr_[j]; + mtor << "Announcing " << info.elem_l_->name()<<"\n"; + + if (!info.req_l_) + info.req_l_ = &dummy_req; + for (int i=0; i < nongroup_l_arr_.size(); i++) { + if (nongroup_l_arr_[i] != info.origin_reg_l_arr_[0]) + nongroup_l_arr_[i]->acknowledge_element(info); + } + } + announce_info_arr_.set_size(0); +} + + +void +Register_group_register::do_removal_processing() +{ + for (iter( reg_list_.top(), i); i.ok(); i++) + i->do_removal_processing(); +} + +Staff_info +Register_group_register::get_staff_info()const +{ + Staff_info inf = Request_register::get_staff_info(); + + for (int i=0; i < nongroup_l_arr_.size(); i++) + nongroup_l_arr_[i]->fill_staff_info(inf); + + return inf; +} + +Register_group_register* +Register_group_register::get_default_interpreter() +{ + if ( interpreter_l() ) + return daddy_reg_l_->get_default_interpreter(); + + Register_group_register *reg_p= ireg_l_-> + get_default_ireg_l()->get_group_register_p(); + add(reg_p ); + if (reg_p->interpreter_l()) + return reg_p; + else + return reg_p->get_default_interpreter(); +} diff --git a/lily/register.cc b/lily/register.cc index 7a846bd6a5..dd228e1be3 100644 --- a/lily/register.cc +++ b/lily/register.cc @@ -6,15 +6,61 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "voice.hh" +#include "music-list.hh" #include "musical-request.hh" #include "register.hh" -#include "note-head.hh" -#include "complex-walker.hh" -#include "local-key-item.hh" #include "register-group.hh" #include "debug.hh" +void +Request_register::post_move_processing() +{ + + if (status < CREATION_INITED) { + do_creation_processing(); + status = CREATION_INITED; + } + if (status >= MOVE_INITED) + return; + + do_post_move_processing(); + status = MOVE_INITED; +} + +bool +Request_register::try_request(Request * r) +{ + if (status < MOVE_INITED) + post_move_processing(); + + return do_try_request(r); +} + +void +Request_register::process_requests() +{ + if (status < PROCESSED_REQS) + post_move_processing(); + else if (status >= PROCESSED_REQS) + return; + + status = PROCESSED_REQS; + do_process_requests(); +} + +void +Request_register::pre_move_processing() +{ + do_pre_move_processing(); + status = CREATION_INITED; +} + +void +Request_register::fill_staff_info(Staff_info&) +{ + +} + Scalar Request_register::get_feature(String t) { @@ -22,13 +68,14 @@ Request_register::get_feature(String t) } bool -Request_register::try_request(Request*) +Request_register::do_try_request(Request*) { return false; } Request_register::Request_register() { + status = VIRGIN; daddy_reg_l_ = 0; } @@ -52,16 +99,9 @@ Request_register::paper()const } void -Request_register::typeset_breakable_item(Item * pre_p , Item * nobreak_p, - Item * post_p) +Request_register::typeset_breakable_item(Item * nobreak_p) { - daddy_reg_l_->typeset_breakable_item(pre_p, nobreak_p, post_p); -} - -bool -Request_register::acceptable_request_b(Request*)const -{ - return false; + daddy_reg_l_->typeset_breakable_item(nobreak_p); } bool @@ -71,7 +111,7 @@ Request_register::contains_b(Request_register *reg_l)const } Staff_info -Request_register::get_staff_info() +Request_register::get_staff_info() const { return daddy_reg_l_->get_staff_info(); } @@ -87,8 +127,11 @@ Request_register::print() const } IMPLEMENT_STATIC_NAME(Request_register); +IMPLEMENT_IS_TYPE_B(Request_register); void Request_register::do_print()const { } + + diff --git a/lily/request-column.cc b/lily/request-column.cc deleted file mode 100644 index 24ec7decec..0000000000 --- a/lily/request-column.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - request-column.cc -- implement Request_column - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ -#include "score-column.hh" -#include "request-column.hh" -#include "staff-column.hh" -#include "staff.hh" - -Moment -Request_column::when() -{ - if (command_column_l_ || musical_column_l_) - when_ = (command_column_l_)? command_column_l_->when() - : musical_column_l_->when(); - - return when_; -} - -void -Request_column::add_reqs(int idx , Array<Request*> const & req_l_arr) -{ - staff_col_l_arr_[idx]->add_reqs(req_l_arr); -} - -Request_column::Request_column(Link_list<Staff*> const& list ) -{ - musical_column_l_ = command_column_l_ =0; - iter(list.top(), j); - for (int i=0; i < list.size(); i++,j++) { - Staff_column * col_p = new Staff_column; - col_p->set_req_col(this); - staff_col_l_arr_.push(col_p); - staff_cols_.bottom().add(col_p); - j->add_col(col_p); - } - when_ = 0; -} - -void -Request_column::set_score_cols(Score_column* c1, Score_column *c2) -{ - command_column_l_ = c1; - musical_column_l_ = c2; -} -bool -Request_column::used_b() const -{ - bool b = false; - if (command_column_l_) - b |= command_column_l_->used_b(); - if (musical_column_l_) - b |= command_column_l_->used_b(); - return b; -} -void -Request_column::update_time(int idx, Time_description&t) -{ - staff_col_l_arr_[idx]->update_time(t, 0); -} diff --git a/lily/request.cc b/lily/request.cc new file mode 100644 index 0000000000..545abcef83 --- /dev/null +++ b/lily/request.cc @@ -0,0 +1,27 @@ +#include "request.hh" +#include "debug.hh" + +IMPLEMENT_STATIC_NAME(Request); +IMPLEMENT_IS_TYPE_B1(Request,Music); + +void +Request::do_print() const +{ +} + +MInterval +Request::time_int() const +{ + return MInterval(0, duration()); +} + +void +Request::print() const +{ +#ifndef NPRINT + mtor << name() << " {"; + do_print(); + mtor << "}\n"; +#endif +} + diff --git a/lily/rest-collision-reg.cc b/lily/rest-collision-reg.cc index 8fba3f418b..81b27a417a 100644 --- a/lily/rest-collision-reg.cc +++ b/lily/rest-collision-reg.cc @@ -27,7 +27,7 @@ Rest_collision_register::acknowledge_element(Score_elem_info i) } void -Rest_collision_register::pre_move_processing() +Rest_collision_register::do_pre_move_processing() { if (rest_collision_p_) { typeset_element(rest_collision_p_); @@ -41,4 +41,5 @@ Rest_collision_register::Rest_collision_register() } IMPLEMENT_STATIC_NAME(Rest_collision_register); +IMPLEMENT_IS_TYPE_B1(Rest_collision_register, Request_register); ADD_THIS_REGISTER(Rest_collision_register); diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 0a7807ce31..368d47d574 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -56,6 +56,9 @@ Rest_collision::do_post_processing() #endif } IMPLEMENT_STATIC_NAME(Rest_collision); +IMPLEMENT_IS_TYPE_B1(Rest_collision,Item); + + void Rest_collision::do_substitute_dependency(Score_elem*o,Score_elem*n) { diff --git a/lily/rest-column.cc b/lily/rest-column.cc index 8d0963482a..39cd296b85 100644 --- a/lily/rest-column.cc +++ b/lily/rest-column.cc @@ -21,10 +21,11 @@ void Rest_column::translate_y(Real dy_f) { for (int i=0; i < head_l_arr_.size(); i++) - head_l_arr_[i]->translate(Offset(0,dy_f)); + head_l_arr_[i]->translate_y(dy_f); } IMPLEMENT_STATIC_NAME(Rest_column); +IMPLEMENT_IS_TYPE_B1(Rest_column,Item); Rest_column::Rest_column() { diff --git a/lily/score-align-reg.cc b/lily/score-align-reg.cc new file mode 100644 index 0000000000..74af8c27bb --- /dev/null +++ b/lily/score-align-reg.cc @@ -0,0 +1,44 @@ +/* + score-align-reg.cc -- implement Score_align_register + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#include "elem-group-item.hh" +#include "score-align-reg.hh" +#include "item.hh" + +Score_align_register::Score_align_register(const char *nm) +{ + type_ch_C_ = nm; + priority_i_ =0; + align_p_=0; +} + +void +Score_align_register::do_pre_move_processing() +{ + if (align_p_) { + typeset_breakable_item( align_p_); + align_p_ =0; + } +} + +void +Score_align_register::acknowledge_element(Score_elem_info inf) +{ + if (inf.elem_l_->name() == type_ch_C_ ) { + if (! align_p_ ) { + align_p_ = new Horizontal_group_item; + announce_element(Score_elem_info(align_p_,0)); + } + + align_p_->add_element(inf.elem_l_); + } +} + +IMPLEMENT_STATIC_NAME(Score_align_register) +IMPLEMENT_IS_TYPE_B1(Score_align_register,Request_register); diff --git a/lily/score-align-regs.cc b/lily/score-align-regs.cc new file mode 100644 index 0000000000..526b9a711f --- /dev/null +++ b/lily/score-align-regs.cc @@ -0,0 +1,32 @@ +/* + score-align-regs.cc -- implement different alignment registers. + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "key-item.hh" +#include "clef-item.hh" +#include "meter.hh" +#include "bar.hh" +#include "score-align-reg.hh" + +#define IMPLEMENT_ALIGN_REG(C,T,p)\ +class C ## _align_register : public Score_align_register \ +{ \ +public: \ + NAME_MEMBERS(); \ + C ## _align_register() : Score_align_register(T::static_name()) {\ + priority_i_ = p;} \ +}; \ +IMPLEMENT_STATIC_NAME(C ## _align_register) ; \ +ADD_THIS_REGISTER(C ## _align_register); \ +IMPLEMENT_IS_TYPE_B1(C ## _align_register, Score_align_register) ; + + +IMPLEMENT_ALIGN_REG(Key,Key_item,3); +IMPLEMENT_ALIGN_REG(Clef,Clef_item,2); +IMPLEMENT_ALIGN_REG(Meter,Meter,4); +IMPLEMENT_ALIGN_REG(Bar, Bar,0); + diff --git a/lily/score-elem.cc b/lily/score-elem.cc index 11ce7936aa..868dc3e176 100644 --- a/lily/score-elem.cc +++ b/lily/score-elem.cc @@ -16,6 +16,8 @@ #include "dimen.hh" #include "spanner.hh" #include "scoreline.hh" +#include "item.hh" +#include "p-col.hh" Score_elem* Score_elem::dependency(int i)const @@ -46,6 +48,8 @@ String Score_elem::TeX_string() const { assert( status > POSTCALCED); + if (transparent_b_ ) + return ""; String s("\\placebox{%}{%}{%}"); Array<String> a; a.push(print_dimen(offset_.y)); @@ -57,12 +61,15 @@ Score_elem::TeX_string() const Score_elem::Score_elem(Score_elem const&s) { + transparent_b_ = s.transparent_b_; + empty_b_ = s.empty_b_; /* called from derived ctor, so most info points to the same deps as (Directed_graph_node&)s. Nobody points to us, so don't copy dependents. */ copy_edges_out(s); - group_element_i_ = 0; + x_group_element_i_ = 0; + y_group_element_i_ = 0; status = s.status; assert(!s.output); output = 0; @@ -77,20 +84,36 @@ Score_elem::~Score_elem() delete output; status = DELETED; output = 0; - assert(!group_element_i_ ); + assert(!x_group_element_i_ && !y_group_element_i_); } void +Score_elem::translate_x(Real x) +{ + offset_.x += x; +} + + + +void +Score_elem::translate_y(Real y) +{ + offset_.y += y; +} + + +void Score_elem::translate(Offset O) { - offset_ += O; + translate_y(O.y); + translate_x(O.x); } Interval Score_elem::do_width() const { Interval r; - + if (!output){ Molecule*m = brew_molecule_p(); r = m->extent().x; @@ -103,7 +126,7 @@ Score_elem::do_width() const Interval Score_elem::width() const { - Interval r=do_width(); + Interval r=(empty_b_)?Interval(0,0):do_width(); if (!r.empty_b()) // float exception on DEC Alpha r+=offset_.x; @@ -127,7 +150,7 @@ Score_elem::do_height() const Interval Score_elem::height() const { - Interval r=do_height(); + Interval r=(empty_b_)?Interval(0,0): do_height(); if (!r.empty_b()) r+=offset_.y; @@ -141,7 +164,7 @@ Score_elem::print()const { #ifndef NPRINT mtor << name() << "{\n"; - mtor << "deps: " << dependent_size() << "depts: \n" << + mtor << "dets: " << dependent_size() << "dependencies: " << dependency_size() << "\n"; do_print(); if (output) @@ -155,7 +178,9 @@ Score_elem::print()const Score_elem::Score_elem() { - group_element_i_ = 0; + transparent_b_ = empty_b_ = false; + x_group_element_i_ = 0; + y_group_element_i_ =0; pscore_l_=0; offset_ = Offset(0,0); output = 0; @@ -197,6 +222,23 @@ Score_elem::pre_processing() } void +Score_elem::breakable_col_processing() +{ + if (status >= PREBROKEN ) + return; + + assert(status != PREBREAKING); // cyclic dependency + status = PREBREAKING; + + for (int i=0; i < dependency_size(); i++) + dependency(i)->breakable_col_processing(); + + + do_breakable_col_processing(); + status = PREBROKEN; +} + +void Score_elem::break_processing() { if (status >= BROKEN ) @@ -245,6 +287,8 @@ Score_elem::molecule_processing() for (int i=0; i < dependency_size(); i++) dependency(i)->molecule_processing(); + if (transparent_b_) + return ; output= brew_molecule_p(); } @@ -254,6 +298,12 @@ Score_elem::do_post_processing() } void +Score_elem::do_breakable_col_processing() +{ + handle_prebroken_dependencies(); +} + +void Score_elem::do_pre_processing() { } @@ -271,6 +321,7 @@ Score_elem::do_substitute_dependency(Score_elem*,Score_elem*) IMPLEMENT_STATIC_NAME(Score_elem); +IMPLEMENT_IS_TYPE_B(Score_elem); Molecule* Score_elem::brew_molecule_p()const @@ -307,11 +358,6 @@ Score_elem::add_dependency(Score_elem*e) Directed_graph_node::add(e); } -bool -Score_elem::is_type_b(char const *s) -{ - return s == static_name(); -} void Score_elem::handle_broken_dependencies() @@ -329,7 +375,12 @@ Score_elem::handle_broken_dependencies() Spanner * broken = sp->find_broken_piece(line); do_substitute_dependency(sp, broken); add_dependency(broken); - remove_us_arr.push(sp); + } else if (elt->item() && elt->item()->pcol_l_->breakpoint_b() + && elt->item()->break_status_i() == 0) { + Item * my_item = elt->item()->find_prebroken_piece(line); + do_substitute_dependency( elt, my_item); + if (my_item) + add_dependency( my_item); } remove_us_arr.push(elt); } @@ -341,10 +392,61 @@ Score_elem::handle_broken_dependencies() for (int i=0; i <remove_us_arr.size(); i++) remove_dependency(remove_us_arr[i]); + /* Reset this. If we are a (broken) copy of a spanner, then + break_processing() was not called on us (and we are not breaking). */ if (status < BROKEN) status = BROKEN; } +/* + This sux. + + unlike with spanners, the number of items can increase + + span: item1 + + becomes + + span: item1 item2 item3 + + How to let span (a derived class) know that this happened? + */ +void +Score_elem::handle_prebroken_dependencies() +{ + Link_array<Score_elem> remove_us_arr; + for (int i=0; i < dependency_size(); i++) { + Score_elem * elt = dependency(i); + Item *it_l = elt->item(); + if (it_l && it_l->pcol_l_->breakable_b()) + if (item()) { + Score_elem *new_l = it_l->find_prebroken_piece(item()->pcol_l_); + if (new_l != elt ) { + do_substitute_dependency( elt, new_l); + remove_us_arr.push(elt); + + add_dependency(new_l); + } + }else { + add_dependency(it_l->broken_to_a_[0]); + add_dependency(it_l->broken_to_a_[1]); + } + + } + + remove_us_arr.default_sort(); + remove_us_arr.uniq(); + for (int i=0; i <remove_us_arr.size(); i++) + remove_dependency(remove_us_arr[i]); + + /* + see comment at handle_broken_dependencies() + */ + if (status < PREBROKEN) + status = PREBROKEN; +} + + void Score_elem::unlink_all() @@ -352,7 +454,8 @@ Score_elem::unlink_all() for (int i=0; i < dependency_size(); i++) dependency(i)->unlink_all(); junk_links(); - group_element_i_ = 0; + y_group_element_i_ = 0; + x_group_element_i_ = 0; } void diff --git a/lily/score-halign-reg.cc b/lily/score-halign-reg.cc new file mode 100644 index 0000000000..f2423f9461 --- /dev/null +++ b/lily/score-halign-reg.cc @@ -0,0 +1,46 @@ +/* + score-halign-reg.cc -- implement Score_horizontal_align_register + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#include "break-align-item.hh" +#include "score-halign-reg.hh" +#include "score-align-reg.hh" + +Score_horizontal_align_register::Score_horizontal_align_register() +{ + halign_p_ =0; +} + +void +Score_horizontal_align_register::do_pre_move_processing() +{ + if (halign_p_) { + typeset_breakable_item(halign_p_); + halign_p_ =0; + } + +} + +void +Score_horizontal_align_register::acknowledge_element(Score_elem_info i) +{ + Request_register* reg = i.origin_reg_l_arr_[0]; + if (reg->is_type_b( + Score_align_register::static_name()) ) + { + if (!halign_p_) { + halign_p_ = new Break_align_item; + announce_element(Score_elem_info(halign_p_,0)); + } + halign_p_->add(i.elem_l_->item(), + ((Score_align_register*)reg)->priority_i_ ); + } +} +IMPLEMENT_STATIC_NAME(Score_horizontal_align_register); +IMPLEMENT_IS_TYPE_B1(Score_horizontal_align_register,Request_register); +ADD_THIS_REGISTER(Score_horizontal_align_register); diff --git a/lily/score-reg.cc b/lily/score-reg.cc new file mode 100644 index 0000000000..47d5a70f2d --- /dev/null +++ b/lily/score-reg.cc @@ -0,0 +1,204 @@ +/* + score-reg.cc -- implement Score_register + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ +#include "super-elem.hh" +#include "scoreline.hh" +#include "debug.hh" +#include "score-elem.hh" +#include "bar.hh" // needed for Bar::static_name +#include "staffline.hh" +#include "score-reg.hh" +#include "p-col.hh" +#include "p-score.hh" +#include "score.hh" +#include "musical-request.hh" +#include "score-column.hh" + +int +Score_register::depth_i()const +{ + return 0; +} + +void +Score_register::set_score(Score *s) +{ + score_l_ = s; + scoreline_l_ = s->pscore_p_->super_elem_l_->line_of_score_l_; + last_mom_ = score_l_->music_p_->time_int().max(); + extra_mom_pq_.insert(last_mom_); +} + +Score_register::Score_register() +{ + score_l_ = 0; + scoreline_l_ =0; + command_column_l_ =0; + musical_column_l_ =0; +} + + + +void +Score_register::do_creation_processing() +{ + scoreline_l_->left_col_l_ = get_staff_info().command_pcol_l(); + scoreline_l_->left_col_l_ ->set_breakable(); + Register_group_register::do_creation_processing(); +} + +void +Score_register::set_cols(Score_column*c1,Score_column*c2) +{ + command_column_l_ = c1; + musical_column_l_ = c2; +} + +void +Score_register::do_removal_processing() +{ + Register_group_register::do_removal_processing(); + scoreline_l_->right_col_l_ = get_staff_info().command_pcol_l(); + scoreline_l_->right_col_l_ ->set_breakable(); + typeset_all(); +} + + +void +Score_register::announce_element(Score_elem_info info) +{ + info.origin_reg_l_arr_.push(this); + if (info.elem_l_->name() == Bar::static_name()) { + get_staff_info().command_pcol_l()->set_breakable(); + } else if ( info.elem_l_->is_type_b( Line_of_staff::static_name() ) && + !scoreline_l_->contains_b( info.elem_l_) ) + + scoreline_l_->add(info.elem_l_); + + announce_info_arr_.push(info); +} +void +Score_register::do_announces() +{ + /* All elements are propagated to the top upon announcement. If + something was created during one run of + Register_group_register::do_announces, then + announce_info_arr_.size() will be nonzero again + + */ + while (announce_info_arr_.size()) { + for (int i=0; i <announce_info_arr_.size(); i++) + /* + TODO + + More subtle spacing + */ + if (announce_info_arr_[i].req_l_) { + Musical_req *m = announce_info_arr_[i].req_l_->musical(); + if (m&&m->rhythmic()) { + musical_column_l_->add_duration( m->duration()); + } + } + Register_group_register::do_announces(); + } +} + + +void +Score_register::typeset_element(Score_elem *elem_p) +{ + musical_item_p_arr_.push(elem_p); +} + +void +Score_register::typeset_breakable_item(Item * nobreak_p) +{ + if (nobreak_p) { + nobreak_item_p_arr_.push(nobreak_p); + } +} +void +Score_register::typeset_all() +{ + PCol * c= get_staff_info().command_pcol_l(); + PScore *ps_l = score_l_->pscore_p_; + + for (int i =0; i < nobreak_item_p_arr_.size(); i++) { + ps_l->typeset_item(nobreak_item_p_arr_[i], c, 0); + scoreline_l_->add(nobreak_item_p_arr_[i]); + } + nobreak_item_p_arr_.set_size(0); + + for (int i=0; i < musical_item_p_arr_.size(); i++) { + PCol* m = get_staff_info().musical_pcol_l(); + Score_elem *elem_p = musical_item_p_arr_[i]; + + scoreline_l_->add(elem_p); + if (elem_p->spanner()) { + ps_l->typeset_unbroken_spanner(elem_p->spanner()); + } else if (elem_p->item()) { + ps_l->typeset_item(elem_p->item(), m, 0); + } else + assert(false); + } + musical_item_p_arr_.set_size(0); +} + + +void +Score_register::do_pre_move_processing() +{ + // this generates all items. + Register_group_register::do_pre_move_processing(); + + typeset_all(); +} + + +Staff_info +Score_register::get_staff_info()const +{ + Staff_info inf; + + inf.command_l_ = command_column_l_; + inf.musical_l_ = musical_column_l_; + return inf; +} + +Paper_def* +Score_register::paper()const +{ + return score_l_->paper_p_; +} + + + +bool +Score_register::do_try_request(Request*r) +{ + bool gotcha = false; + for (int i =0; !gotcha && i < nongroup_l_arr_.size() ; i++) + gotcha = nongroup_l_arr_[i]->try_request(r); + + return gotcha; +} + +IMPLEMENT_IS_TYPE_B1(Score_register,Register_group_register); +IMPLEMENT_STATIC_NAME(Score_register); +ADD_THIS_REGISTER(Score_register); + +void +Score_register::add_moment_to_process(Moment m) +{ + if (m > last_mom_) + return; + + for (int i=0; i < extra_mom_pq_.size(); i++) + if (extra_mom_pq_[i] == m) + return; + extra_mom_pq_.insert(m); +} diff --git a/lily/score-walker.cc b/lily/score-walker.cc deleted file mode 100644 index 78041613f0..0000000000 --- a/lily/score-walker.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* - score-walker.cc -- implement Score_walker - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ -#include "proto.hh" -#include "plist.hh" -#include "debug.hh" -#include "score-walker.hh" -#include "score.hh" -#include "staff-walker.hh" -#include "staff.hh" -#include "score-column.hh" - -Score_walker::Score_walker(Score *s) - :PCursor<Score_column *> (s->cols_) -{ - score_l_ = s; - for (iter_top(s->staffs_,i); i.ok(); i++) { - Staff_walker* w_p=i->get_walker_p(); - w_p->score_walk_l_ =this; - walker_p_arr_.push(w_p); - } - - reinit(); - breaks_i_=0; -} - - -void -Score_walker::reinit() -{ - disallow_break_walk_l_arr = walker_p_arr_; - disallow_break_count_ = disallow_break_walk_l_arr.size(); -} - - -/** Advance the cursor, and all Staff_walkers contained in this. Reset - runtime fields */ -void -Score_walker::operator ++(int ) -{ - Moment last = ptr()->when(); - - PCursor<Score_column *>::operator++(0); - if (ok() && ptr()->when() == last) - PCursor<Score_column *>::operator++(0); - reinit(); - bool last_b = (!ok()); // ughh - for (int i=0; i< walker_p_arr_.size(); i++) { - if (walker_p_arr_[i]->ok() && - (last_b || walker_p_arr_[i]->when() < when())) { - - walker_p_arr_[i]->operator++(0); - } - } -} - -/** Allow the command_column to be breakable for one staff. If all - staffs allow, then allow a break here. */ -void -Score_walker::allow_break(Staff_walker*w) -{ - for (int i=0; i < disallow_break_walk_l_arr.size(); i++) { - if (w == disallow_break_walk_l_arr[i]) { - disallow_break_count_ --; - disallow_break_walk_l_arr[i] =0; - - if (!disallow_break_count_) { - PCursor<Score_column*> col_cursor = *this; - if (ptr()->musical_b()) - col_cursor --; - col_cursor->set_breakable(); - } - } - } -} - -bool -Score_walker::break_allowed_b() -{ - return !disallow_break_count_; -} - -Moment -Score_walker::when() -{ - return ptr()->when(); -} - -void -Score_walker::process() -{ - for (int i=0; i < walker_p_arr_.size(); i++) { - Staff_walker *w = walker_p_arr_[i]; - if ( w->ok() && w->when() == when() ) { - walker_p_arr_[i]->process(); - } - } - if (break_allowed_b()){ - breaks_i_ ++; - if (! (breaks_i_ % 8)) - *mlog << "[" <<breaks_i_<<"]"<<flush; - } -} - -Score_walker::~Score_walker() -{ - *mlog << "[" <<breaks_i_<<"]"<<flush; - for (int i=0; i < walker_p_arr_.size(); i++) - delete walker_p_arr_[i]; -} - - diff --git a/lily/score.cc b/lily/score.cc index 92a08351ff..5463e82938 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -9,77 +9,81 @@ #include "score.hh" #include "score-column.hh" #include "p-score.hh" -#include "staff.hh" #include "debug.hh" #include "paper-def.hh" #include "main.hh" #include "source.hh" #include "source-file.hh" -#include "score-walker.hh" #include "midi-output.hh" #include "midi-def.hh" -#include "pulk-voices.hh" -#include "request-column.hh" #include "p-col.hh" +#include "score-reg.hh" +#include "music-iterator.hh" +#include "music.hh" +#include "music-list.hh" +#include "input-register.hh" extern String default_out_fn; +Score::Score(Score const &s) +{ + assert(!pscore_p_); + music_p_ = s.music_p_->clone(); + midi_p_ = new Midi_def(*s.midi_p_); + paper_p_ = new Paper_def(*s.paper_p_); +} + void Score::setup_music() { *mlog << "\nSetting up requests..." << flush; - Pulk_voices pulk(staffs_); - - Moment l_mom = pulk.last_; - if (l_mom == Moment(0)) { - errorlevel_i_ |= 1; - input_.error("Need to have music in a score."); - } - - Moment previous_mom = -1; - while (pulk.ok()) { + Score_register * score_reg = + (Score_register*)lookup_reg("Score_register")->get_group_register_p(); + + score_reg->set_score (this); + Music_iterator * iter = Music_iterator::static_get_iterator_p(music_p_, + score_reg); + iter->construct_children(); + + while ( iter->ok() || score_reg->extra_mom_pq_.size() ) { + Moment w = INFTY; + if (iter->ok() ) + w = iter->next_moment(); + + if (score_reg->extra_mom_pq_.size() && + score_reg->extra_mom_pq_.front() <= w) + + w = score_reg->extra_mom_pq_.get(); - Moment w= pulk.next_mom(); - assert(w > previous_mom); - Request_column* rcol_p = new Request_column( staffs_ ); + mtor << "processing moment " << w << "\n"; Score_column* c1 = new Score_column(w); Score_column* c2 = new Score_column(w); - if (w == Moment(0) || w == l_mom) { - c1->set_breakable(); - } - + c1->musical_b_ = false; c2->musical_b_ = true; cols_.bottom().add(c1); cols_.bottom().add(c2); - rcol_p->set_score_cols(c1, c2); - rcols_.bottom().add(rcol_p); - pulk.get_aligned_request( rcol_p ); - previous_mom =w; + score_reg->set_cols(c1,c2); + + score_reg->post_move_processing(); + iter->next( w ); + + score_reg->process_requests(); + score_reg->do_announces(); + score_reg->pre_move_processing(); } - - errorlevel_i_ |= pulk.time_checks_failed_b(); -} - -void -Score::process_music() -{ - *mlog << "Processing requests ..." << flush; - for (Score_walker w(this); w.ok(); w++) { - w.process(); - } + delete iter; + score_reg->do_removal_processing(); + delete score_reg; } void Score::process() { - setup_music(); - paper(); - midi(); } void @@ -87,19 +91,16 @@ Score::paper() { if (!paper_p_) return; + if( errorlevel_i_){ // should we? hampers debugging. warning("Errors found, /*not processing score*/"); // return; } pscore_p_ = new PScore(paper_p_); + setup_music(); do_cols(); - for (iter_top(staffs_,i); i.ok(); i++) - i->set_output(pscore_p_); - - - process_music(); clean_cols(); // can't move clean_cols() farther up. print(); calc_idealspacing(); @@ -121,18 +122,6 @@ void Score::clean_cols() { #if 1 - for (iter_top(staffs_,i); i.ok(); i++) - i->clean_cols(); - - for (iter_top(rcols_,i); i.ok(); i++) { - i->when(); // update cache, ugh - if (!i->command_column_l_->used_b()) { - i->command_column_l_ = 0; - } - if (!i->musical_column_l_->used_b()) - i->musical_column_l_ = 0; - } - for (iter_top(cols_,c); c.ok(); ) { if (!c->pcol_l_->used_b()) { delete c.remove_p(); @@ -172,9 +161,7 @@ Moment Score::last() const { Moment l = 0; - for (iter_top(staffs_,i); i.ok(); i++) { - l = l>? i->last(); - } + // TODO return l; } @@ -196,11 +183,6 @@ void Score::OK() const { #ifndef NDEBUG - for (iter_top(staffs_,i); i.ok(); i++) { - i->OK(); - assert(i->score_l_ == this); - } - staffs_.OK(); cols_.OK(); for (iter_top(cols_,cc); cc.ok() && (cc+1).ok(); cc++) { assert(cc->when() <= (cc+1)->when()); @@ -214,9 +196,7 @@ Score::print() const { #ifndef NPRINT mtor << "score {\n"; - for (iter_top(staffs_,i); i.ok(); i++) { - i->print(); - } + music_p_->print(); for (iter_top(cols_,i); i.ok(); i++) { i->print(); } @@ -239,6 +219,7 @@ Score::Score() Score::~Score() { + delete music_p_; delete pscore_p_; delete paper_p_; delete midi_p_; @@ -261,7 +242,7 @@ Score::paper_output() Tex_stream the_output(paper_p_->outfile); the_output << "% outputting Score, defined at: " << - input_.location_str() << "\n"; + location_str() << "\n"; pscore_p_->output(the_output); } @@ -269,6 +250,7 @@ Score::paper_output() void Score::midi() { +#if 0 if (!midi_p_) return; @@ -277,11 +259,6 @@ Score::midi() *mlog << "midi output to " << midi_p_->outfile_str_ << " ...\n"; Midi_output(this, midi_p_); +#endif } -void -Score::add(Staff*s) -{ - s->score_l_ = this; - staffs_.bottom().add(s); -} diff --git a/lily/scoreline.cc b/lily/scoreline.cc index c3edbdcc14..5449b32b1c 100644 --- a/lily/scoreline.cc +++ b/lily/scoreline.cc @@ -67,41 +67,21 @@ Line_of_score::Line_of_score() } -void -Line_of_score::do_substitute_dependency(Score_elem*o, Score_elem*n) -{ - Spanner_elem_group::do_substitute_dependency(o,n); - - int i; - while ((i =line_arr_.find_i((Spanner_elem_group*)o->spanner())) >=0) - if (n) - line_arr_[i] = (Spanner_elem_group*)n->spanner(); - else - line_arr_.del(i); -} - -void -Line_of_score::do_post_processing() -{ - Real y_pos=0; - for (int i=line_arr_.size(); i--; ) { - Interval y = line_arr_[i]->height() ; - if (y.empty_b()) - continue; - line_arr_[i]->translate(Offset(0, -y[-1] + y_pos)); - y_pos += y.length(); - } - translate(Offset(0, -y_pos)); -} IMPLEMENT_STATIC_NAME(Line_of_score); +IMPLEMENT_IS_TYPE_B2(Line_of_score,Spanner,Vertical_align_elem); void -Line_of_score::add_line(Spanner_elem_group*e) +Line_of_score::add(Score_elem*e) { - add_element(e); - line_arr_.push(e); + if (e->is_type_b( Line_of_staff::static_name()) + && ! Vertical_align_elem::contains_b( e) ) + + Vertical_align_elem::add(e); + else { + add_dependency(e); + } } bool @@ -111,17 +91,6 @@ Line_of_score::contains_b(PCol const* c)const } void -Line_of_score::do_pre_processing() -{ - left_col_l_ = pscore_l_->cols.top(); - right_col_l_ = pscore_l_->cols.bottom(); - for (int i=0; i < line_arr_.size(); i++){ - line_arr_[i]->left_col_l_ = left_col_l_; - line_arr_[i]->right_col_l_ = right_col_l_; - } -} - -void Line_of_score::set_breaking(Array<Col_hpositions> const &breaking) { for (int j=0; j < breaking.size(); j++) { @@ -132,32 +101,66 @@ Line_of_score::set_breaking(Array<Col_hpositions> const &breaking) for (int i=0; i < errors.size(); i++) errors[i]->error_mark_b_ = true; - Line_of_score *line_p = (Line_of_score*)clone(); + Line_of_score *line_l=0; + Line_of_score *line_p =0; + + if (breaking.size() >1) { + line_p = (Line_of_score*)clone()->spanner(); + line_l = line_p; + } else + line_l = this; + + ((Array<PCol*> &)line_l->cols) = curline; + line_l->left_col_l_ = curline[0]; + line_l->right_col_l_= curline.top(); + + if (line_p) { + pscore_l_->typeset_broken_spanner(line_p); + broken_into_l_arr_.push(line_p); + } + for (int i=0; i < curline.size(); i++){ curline[i]->hpos = config[i]; - curline[i]->line_l_ = (Line_of_score*)line_p; + curline[i]->line_l_ = (Line_of_score*)line_l; } - ((Array<PCol*> &)line_p->cols) = curline; - line_p->left_col_l_ = curline[0]; - line_p->right_col_l_= curline.top(); - pscore_l_->typeset_broken_spanner(line_p); - broken_into_l_arr_.push(line_p); } } void Line_of_score::break_into_pieces() { - } Link_array<Line_of_score> Line_of_score::get_lines()const { Link_array<Line_of_score> ret; - assert(broken_into_l_arr_.size()); - for (int i=0; i < broken_into_l_arr_.size(); i++) { - ret.push((Line_of_score*)broken_into_l_arr_[i]); - } + + if(broken_into_l_arr_.size()) + for (int i=0; i < broken_into_l_arr_.size(); i++) { + ret.push((Line_of_score*)broken_into_l_arr_[i]); + } + else + ret.push((Line_of_score*)this); // ugh + return ret; } + +void +Line_of_score::do_print()const +{ + Spanner::do_print(); +} + +Interval +Line_of_score::do_width()const +{ + return Spanner::do_width(); +} + +void +Line_of_score::do_substitute_dependency(Score_elem*o,Score_elem*n) +{ + Spanner::do_substitute_dependency(o,n); + Vertical_align_elem::do_substitute_dependency(o,n); +} diff --git a/lily/scores.cc b/lily/scores.cc index 22526b42bd..be558b29c1 100644 --- a/lily/scores.cc +++ b/lily/scores.cc @@ -1,40 +1,48 @@ +/* + scores.cc -- implement some globals + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include "main.hh" -#include "input-score.hh" #include "score.hh" #include "string.hh" #include "paper-def.hh" #include "debug.hh" -static Array<Input_score*> score_array_global; +static Array<Score*> score_array_global; String default_out_fn = "lelie"; void do_scores() { for (int i=0; i < score_array_global.size(); i++) { - Input_score* &is_p = score_array_global[i]; - if (is_p->errorlevel_i_) { - is_p->warning("Score contains errors. Will not process it. "); - delete is_p; - continue; - } + Score *&is_p = score_array_global[i]; if (only_midi) { delete is_p->paper_p_; is_p->paper_p_ = 0; } - - Score * s_p = is_p->parse(); + + if (is_p->errorlevel_i_) { + is_p->warning("Score contains errors. Will not process it. "); + + } else { + + is_p->print (); + is_p->process(); + } delete is_p; - s_p->print (); - s_p->process(); - delete s_p; + is_p =0; + } score_array_global.set_size(0); } void -add_score(Input_score * s) +add_score(Score * s) { score_array_global.push(s); } diff --git a/lily/script-column.cc b/lily/script-column.cc index f2e21bd2fb..ef676502b0 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -13,6 +13,7 @@ #include "stem.hh" IMPLEMENT_STATIC_NAME(Script_column); +IMPLEMENT_IS_TYPE_B1(Script_column,Horizontal_vertical_group_item); void @@ -29,12 +30,12 @@ Script_column::do_print()const mtor << "scripts: " << script_l_arr_.size() << '\n'; } - void Script_column::do_pre_processing() { if (!script_l_arr_.size()) return; + /* up+outside, up+inside, down+outside, down+inside */ Array<Script*> placed_l_arr_a[4]; for (int i=0; i < script_l_arr_.size(); i++) { @@ -86,7 +87,7 @@ Script_column::add_support(Item*i_l) void Script_column::do_substitute_dependency(Score_elem*o,Score_elem*n) { - Element_group::do_substitute_dependency(o,n); + Horizontal_vertical_group::do_substitute_dependency(o,n); if (o->item()) { script_l_arr_.substitute((Script*)o->item(),(Script*) (n?n->item():0)); support_l_arr_.substitute(o->item(), (n?n->item():0)); diff --git a/lily/script-def.cc b/lily/script-def.cc index 7d1b09d4af..b07bbc71a8 100644 --- a/lily/script-def.cc +++ b/lily/script-def.cc @@ -80,6 +80,7 @@ Script_def::get_atom(Paper_def *p , int d)const } IMPLEMENT_STATIC_NAME(Script_def); +IMPLEMENT_IS_TYPE_B1(Script_def,General_script_def); int Script_def::priority_i()const diff --git a/lily/script-reg.cc b/lily/script-reg.cc index b73a6a5fe2..9eed43434e 100644 --- a/lily/script-reg.cc +++ b/lily/script-reg.cc @@ -7,17 +7,16 @@ #include "script-reg.hh" #include "script.hh" #include "musical-request.hh" -#include "complex-walker.hh" #include "stem.hh" #include "staff-sym.hh" Script_register::Script_register() { - post_move_processing(); + do_post_move_processing(); } bool -Script_register::try_request(Request *r_l) +Script_register::do_try_request(Request *r_l) { if (!r_l->musical() || ! r_l->musical()->musicalscript()) return false ; @@ -33,7 +32,7 @@ Script_register::try_request(Request *r_l) } void -Script_register::process_requests() +Script_register::do_process_requests() { for (int i=0; i < script_req_l_arr_.size(); i++){ Script_req* l=script_req_l_arr_[i]; @@ -65,7 +64,7 @@ Script_register::acknowledge_element(Score_elem_info info) } void -Script_register::pre_move_processing() +Script_register::do_pre_move_processing() { Staff_symbol* s_l = get_staff_info().staff_sym_l_; for (int i=0; i < script_p_arr_.size(); i++) { @@ -78,10 +77,11 @@ Script_register::pre_move_processing() } void -Script_register::post_move_processing() +Script_register::do_post_move_processing() { script_req_l_arr_.set_size(0); } IMPLEMENT_STATIC_NAME(Script_register); +IMPLEMENT_IS_TYPE_B1(Script_register,Request_register); ADD_THIS_REGISTER(Script_register); diff --git a/lily/script.cc b/lily/script.cc index 578a885320..2a39c57a0d 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -74,11 +74,12 @@ Script::brew_molecule_p() const Real dy = paper()->internote_f(); Molecule*out = new Molecule(specs_l_->get_atom(paper(), dir_i_)); - out->translate(Offset(0,dy * pos_i_)); + out->translate_y(dy * pos_i_); return out; } IMPLEMENT_STATIC_NAME(Script); +IMPLEMENT_IS_TYPE_B2(Script,Item,Staff_side); int Script::compare(Script *const&l1, Script *const&l2) diff --git a/lily/slur-reg.cc b/lily/slur-reg.cc index 992889d94e..2a4963c18a 100644 --- a/lily/slur-reg.cc +++ b/lily/slur-reg.cc @@ -7,22 +7,13 @@ #include "proto.hh" #include "plist.hh" #include "musical-request.hh" -#include "complex-walker.hh" #include "slur-reg.hh" #include "slur.hh" #include "debug.hh" #include "note-column.hh" bool -Slur_register::acceptable_request_b(Request*req_l) -{ - Musical_req *mus_l = req_l->musical(); - - return mus_l && mus_l->slur(); -} - -bool -Slur_register::try_request(Request *req_l) +Slur_register::do_try_request(Request *req_l) { Musical_req *mus_l = req_l->musical(); if(!mus_l || !mus_l->slur()) @@ -59,7 +50,7 @@ Slur_register::Slur_register() dir_i_ =0; } void -Slur_register::process_requests() +Slur_register::do_process_requests() { Array<Slur*> start_slur_l_arr_; for (int i=0; i< new_slur_req_l_arr_.size(); i++) { @@ -87,7 +78,7 @@ Slur_register::process_requests() } void -Slur_register::pre_move_processing() +Slur_register::do_pre_move_processing() { for (int i = 0; i < end_slur_l_arr_.size(); i++) { if (dir_i_) @@ -98,7 +89,7 @@ Slur_register::pre_move_processing() } void -Slur_register::post_move_processing() +Slur_register::do_post_move_processing() { new_slur_req_l_arr_.set_size(0); } @@ -109,4 +100,5 @@ Slur_register::~Slur_register() } } IMPLEMENT_STATIC_NAME(Slur_register); +IMPLEMENT_IS_TYPE_B1(Slur_register,Request_register); ADD_THIS_REGISTER(Slur_register); diff --git a/lily/slur.cc b/lily/slur.cc index 3250dc26c9..098bdc3fe4 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -95,3 +95,4 @@ Slur::do_post_processing() right_pos_i_ += dir_i_; } IMPLEMENT_STATIC_NAME(Slur); +IMPLEMENT_IS_TYPE_B1(Slur,Spanner); diff --git a/lily/spanner-elem-group.cc b/lily/spanner-elem-group.cc index 26b5f9fd33..9ec544e52d 100644 --- a/lily/spanner-elem-group.cc +++ b/lily/spanner-elem-group.cc @@ -1,5 +1,5 @@ /* - spanner-elem-group.cc -- implement + spanner-elem-group.cc -- implement Spanner_elem_group source file of the GNU LilyPond music typesetter @@ -11,6 +11,7 @@ IMPLEMENT_STATIC_NAME(Spanner_elem_group); +IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group); Interval Spanner_elem_group::do_width() const @@ -21,6 +22,6 @@ Spanner_elem_group::do_width() const void Spanner_elem_group::do_print() const { - Element_group::do_print(); + Horizontal_vertical_group::do_print(); } diff --git a/lily/spanner.cc b/lily/spanner.cc index 10ee753e19..2d071cb8ad 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -12,6 +12,7 @@ #include "p-score.hh" IMPLEMENT_STATIC_NAME(Spanner); +IMPLEMENT_IS_TYPE_B1(Spanner,Score_elem); void Spanner::do_print()const @@ -36,7 +37,7 @@ Spanner::break_into_pieces() break_cols.push(right); for (int i=1; i < break_cols.size(); i++) { - Spanner* span_p = clone(); + Spanner* span_p = clone()->spanner(); left = break_cols[i-1]; right = break_cols[i]; if (!right->line_l_) diff --git a/lily/staff-column.cc b/lily/staff-column.cc deleted file mode 100644 index 55871e0761..0000000000 --- a/lily/staff-column.cc +++ /dev/null @@ -1,239 +0,0 @@ -/* - staff-column.cc -- implement Staff_column - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ -#include "proto.hh" -#include "plist.hh" -#include "staff.hh" -#include "voice.hh" -#include "time-description.hh" -#include "score-column.hh" -#include "staff-column.hh" -#include "command-request.hh" -#include "musical-request.hh" -#include "interval.hh" -#include "p-score.hh" -#include "item.hh" -#include "p-col.hh" -#include "request-column.hh" -#include "grouping.hh" - -void -Staff_column::OK() const -{ -#ifndef NDEBUG - -#endif -} - -Moment -Staff_column::when() const -{ - return req_col_l_->when(); -} - -void -Staff_column::add_reqs(Array<Request*> req_l_arr) -{ - for (int i=0; i < req_l_arr.size(); i++) { - Request * j = req_l_arr[i]; - if (j->command()) { - Command_req * c_l = j->command(); - if (c_l->timing()) { - timing_req_l_arr_.push(j->command()->timing()); - } - if (c_l->groupchange()) - creationreq_l_arr_.push(c_l); - else if (!c_l->barcheck() && !c_l->partial() && - !c_l->measuregrouping()) - setup_one_request(j); - } else { - if (j->musical()) { - - Musical_req*m = j->musical(); - if (m->rhythmic()) { - req_col_l_->musical_column_l_->add_duration(m->rhythmic()->duration()); - } - if(m->skip()) - continue; - } - setup_one_request(j); - } - } -} - -Staff_column::Staff_column() -{ - staff_l_ = 0; -} - - - - -Staff_column::~Staff_column() -{ -} - -void -Staff_column::set_req_col(Request_column *col_l) -{ - req_col_l_ = col_l; -} - -void -Staff_column::setup_one_request(Request * j) -{ - if (j->command()) // ugh - commandreq_l_arr_.push(j); - else if (j->musical()) - musicalreq_l_arr_.push(j); -} - -void -Staff_column::typeset_musical_item(Item*i) -{ - assert(i); - Score_column * scorecolumn_l = req_col_l_->musical_column_l_; - scorecolumn_l->pcol_l_->pscore_l_->typeset_item(i, scorecolumn_l->pcol_l_); -} - -/** - align items in #item_l_arr#, - - @return the width of the items after aligning. - */ -Interval -align_items(Array<Item*> item_l_arr) -{ - Interval wid(0,0); - for (int i =0; i < item_l_arr.size(); i++) { - Interval item_width= item_l_arr[i]->width(); - if (item_width.empty_b()) { - item_width = Interval(0,0); - } - Real dx =wid.right - item_width.left; - item_width += dx; - item_l_arr[i]->translate(Offset(dx ,0)); - wid.unite(item_width); - } - return wid; -} - -void -translate_items(Real x, Array<Item*> item_l_arr) -{ - for (int i =0; i < item_l_arr.size(); i++) - item_l_arr[i]->translate(Offset(x, 0)); -} -/** - TODO: - Write a "horizontal align" item, which aligns the pres, nobreaks, posts, etc. - - */ -void -Staff_column::typeset_breakable_items(Array<Item *> &pre_p_arr, - Array<Item *> &nobreak_p_arr, - Array<Item *> &post_p_arr) -{ - Score_column * scol_l= req_col_l_->command_column_l_; - PCol * c= scol_l->pcol_l_; - PScore *ps_l=scol_l->pcol_l_->pscore_l_; - - if (!c->breakable_b()) { - for (int i =0; i < pre_p_arr.size(); i++) { - pre_p_arr[i]->unlink(); - delete pre_p_arr[i]; - } - pre_p_arr.set_size(0); - for (int i =0; i < post_p_arr.size(); i++) { - post_p_arr[i]->unlink(); - delete post_p_arr[i]; - } - post_p_arr.set_size(0); - } - - - for (int i =0; i < pre_p_arr.size(); i++) { - ps_l->typeset_item(pre_p_arr[i], c,0); - } - for (int i =0; i < nobreak_p_arr.size(); i++) { - ps_l->typeset_item(nobreak_p_arr[i], c, 1); - } - for (int i =0; i < post_p_arr.size(); i++) { - ps_l->typeset_item(post_p_arr[i], c, 2); - } - - Interval pre_wid= align_items(pre_p_arr); - translate_items( -pre_wid.right, pre_p_arr); - align_items(nobreak_p_arr); - Interval post_wid =align_items(post_p_arr); - translate_items (-post_wid.left , post_p_arr); - - pre_p_arr.set_size(0); - post_p_arr.set_size(0); - nobreak_p_arr.set_size(0); -} - -Score_column* -Staff_column::command_column_l() -{ - return req_col_l_->command_column_l_; -} - -Score_column* -Staff_column::musical_column_l() -{ - return req_col_l_->musical_column_l_; -} - -void -Staff_column::update_time(Time_description &time_, - Rhythmic_grouping *default_grouping) -{ - // first all meter changes - for (int i=0; i < timing_req_l_arr_.size(); i++) { - Timing_req * tr_l = timing_req_l_arr_[i]; - if (tr_l->meterchange()) { - int b_i=tr_l->meterchange()->beats_i_; - int o_i = tr_l->meterchange()->one_beat_i_; - if (! time_.allow_meter_change_b() ) - tr_l->warning("Meter change not allowed here"); - else{ - time_.set_meter(b_i, o_i); - if (default_grouping) - *default_grouping = - Rhythmic_grouping(MInterval(0,Moment(b_i, o_i)), b_i); - } - } - } - - // then do the rest - for (int i=0; i < timing_req_l_arr_.size(); i++) { - Timing_req * tr_l = timing_req_l_arr_[i]; - if (tr_l->partial()) { - Moment m = tr_l->partial()->duration_; - String error = time_.try_set_partial_str(m); - if (error != "") { - tr_l->warning(error); - } else - time_.setpartial(m); - } else if (tr_l->barcheck() && time_.whole_in_measure_) { - tr_l ->warning( "Barcheck failed"); - - time_.whole_in_measure_ = 0; // resync - time_.error_b_ = true; - } else if (tr_l->cadenza()) { - time_.set_cadenza(tr_l->cadenza()->on_b_); - } else if (tr_l->measuregrouping()) { - if (default_grouping) - *default_grouping = parse_grouping( - tr_l->measuregrouping()->beat_i_arr_, - tr_l->measuregrouping()->elt_length_arr_); - } - } - time_.OK(); -} - diff --git a/lily/staff-info.cc b/lily/staff-info.cc index 5e4ce77c05..250d3273d6 100644 --- a/lily/staff-info.cc +++ b/lily/staff-info.cc @@ -2,62 +2,54 @@ staff-info.cc -- implement Staff_info source file of the GNU LilyPond music typesetter + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ + #include "proto.hh" #include "plist.hh" -#include "staff.hh" #include "staff-info.hh" #include "score-column.hh" -#include "complex-walker.hh" -#include "staff-column.hh" - -Staff* -Staff_info::staff_l() -{ - return walk_l_->staff_l_; -} Score* Staff_info::score_l() { - return staff_l()->score_l_; + return score_l_; } Staff_info::Staff_info() { + score_l_ =0; c0_position_i_l_ = 0; - walk_l_ = 0; time_C_ = 0; rhythmic_C_ =0; break_allowed_b_ = 0; } -Staff_column* -Staff_info::column_l() -{ - return walk_l_->ptr(); -} - Score_column* Staff_info::musical_l() { - return column_l() -> musical_column_l(); + return musical_l_; } Score_column* Staff_info::command_l() { - return column_l() -> command_column_l(); + return command_l_; } PCol* Staff_info::command_pcol_l() { return command_l()->pcol_l_; } +PCol* +Staff_info::musical_pcol_l() +{ + return musical_l()->pcol_l_; +} Moment Staff_info::when() { - return walk_l_->when(); + return command_l()->when(); } diff --git a/lily/staff-regs.cc b/lily/staff-regs.cc index 19129a02ca..cd595e51b9 100644 --- a/lily/staff-regs.cc +++ b/lily/staff-regs.cc @@ -5,6 +5,7 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ + #include "staff-sym.hh" #include "voice-group-regs.hh" #include "voice-regs.hh" @@ -13,117 +14,69 @@ #include "bar.hh" #include "debug.hh" #include "input-register.hh" +#include "meter-reg.hh" +#include "staffline.hh" -Staff_info -Staff_registers::get_staff_info() -{ - Staff_info inf; - inf = Request_register::get_staff_info(); - inf.staff_sym_l_=staff_sym_l_; - inf.c0_position_i_l_ = &c0_position_i_; - return inf; -} -Staff_registers::Staff_registers(Input_register const*ireg_C) +Staff_registers::Staff_registers() { - staff_sym_l_ =0; - c0_position_i_ = 0; - base_position_i_ =0; - add( ireg_C->get_nongroup_p_arr()); - ireg_C_ =ireg_C; + staffline_p_ =0; } -/** Magic function which takes a Voice_registers out of one of its own - children, and puts it in another. This also handles the push and - popgroup feature. */ void -Staff_registers::change_group(Group_change_req * greq_l, - Voice_registers *voice_regs_l, - Voice_group_registers * old_group) +Staff_registers::typeset_element(Score_elem *elem_p) { - - Voice_registers *regs_p = (old_group) - ? (Voice_registers*) old_group->get_register_p( - voice_regs_l) - : new Voice_registers( - greq_l->voice_l(), ireg_C_->get_ireg_l("Voice_group_registers") - ->get_ireg_l("Voice_registers")); - - String new_str = greq_l->newgroup_str_; - String old_str; - if (old_group) - old_str = old_group->group_id_str_; - if ( new_str[0] == '+') { - new_str = old_str + new_str; - } else if (new_str[0] == '-') { - int idx = old_str.index_last_i('+'); - if (idx >=0) - new_str = old_str.left_str ( idx ); - } - Voice_group_registers * new_group_l = get_group(new_str); - new_group_l->add(regs_p); - regs_p->sync_features(); - mtor << "processed change_group " << get_staff_info().when()<<"\n"; - print(); + staff_elem_l_arr_.push(elem_p); + Register_group_register::typeset_element(elem_p); } -Voice_group_registers * -Staff_registers::get_group(String id) +void +Staff_registers::typeset_breakable_item( Item * nobreak_p) { - for (int i=0; i < group_l_arr_.size(); i++) { - if (group_l_arr_[i]->group_id_str_ == id) - return group_l_arr_[i]; - } - Voice_group_registers *group_p = - new Voice_group_registers(id, ireg_C_->get_ireg_l("Voice_group_registers")); - group_l_arr_.push(group_p); - add(group_p); - return group_p; + staff_elem_l_arr_.push(nobreak_p); + Register_group_register::typeset_breakable_item(nobreak_p); } - void -Staff_registers::terminate_register(Request_register * reg) +Staff_registers::do_pre_move_processing() { - for (int i=0; i < group_l_arr_.size(); i++) { - if (group_l_arr_[i] == reg) { - group_l_arr_.del(i); - Register_group_register::terminate_register(reg); - return; - } - } - assert(false); + Register_group_register::do_pre_move_processing(); + group_staff_elems(); } -bool -Staff_registers::try_request(Request * r) +void +Staff_registers::group_staff_elems() { - bool b = Register_group_register::try_request(r); - if (!b) { - Command_req * cr_l = r->command() ; - - if (cr_l && cr_l->groupchange()) { - change_group(cr_l->groupchange(), 0, 0); - b = true; - } else - b= false; - } - return b; + for (int i=0; i <staff_elem_l_arr_.size(); i++) + staffline_p_->add_element(staff_elem_l_arr_[i]); + staff_elem_l_arr_.set_size(0); } -IMPLEMENT_STATIC_NAME(Staff_registers); - -bool -Staff_registers::acceptable_request_b(Request*r)const +void +Staff_registers::do_removal_processing() { - return Register_group_register::acceptable_request_b(r) || - (r->command() && r->command()->groupchange()); + /* this is a "destructor type function", first do children, then self. */ + Register_group_register::do_removal_processing(); + group_staff_elems(); + + staffline_p_->right_col_l_ = get_staff_info().command_pcol_l(); + Request_register::typeset_element(staffline_p_); + staffline_p_ = 0; } void -Staff_registers::acknowledge_element(Score_elem_info i) +Staff_registers::do_creation_processing() { - Register_group_register::acknowledge_element(i); - if ( i.elem_l_->name() == Staff_symbol::static_name()) - staff_sym_l_ = (Staff_symbol*)i.elem_l_->item(); + staffline_p_ = new Line_of_staff; + staffline_p_->left_col_l_ = get_staff_info().command_pcol_l(); + + // don't broadcast to self. + Request_register::announce_element(Score_elem_info(staffline_p_,0)); + Register_group_register::do_creation_processing(); } + + +IMPLEMENT_STATIC_NAME(Staff_registers); +IMPLEMENT_IS_TYPE_B1(Staff_registers,Register_group_register); +ADD_THIS_REGISTER(Staff_registers); + diff --git a/lily/staff-side.cc b/lily/staff-side.cc index 3491b2f20d..2c5e1848c8 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -106,3 +106,6 @@ Staff_side::do_substitute_dependency(Score_elem*o, Score_elem*n ) if (staff_sym_l_ == o) staff_sym_l_ = n ? (Staff_symbol*) n->spanner():0; } + +IMPLEMENT_STATIC_NAME(Staff_side); +IMPLEMENT_IS_TYPE_B1(Staff_side, Score_elem); diff --git a/lily/staff-sym-reg.cc b/lily/staff-sym-reg.cc index f0683f0d44..c309351a81 100644 --- a/lily/staff-sym-reg.cc +++ b/lily/staff-sym-reg.cc @@ -12,47 +12,39 @@ #include "p-col.hh" const NO_LINES = 5; +void +Staff_sym_register::fill_staff_info(Staff_info&i) +{ + i.staff_sym_l_ = span_p_; +} Staff_sym_register::Staff_sym_register() { span_p_ = 0; - last_mom_ =0; } void -Staff_sym_register::post_move_processing() +Staff_sym_register::do_creation_processing() { - if (!span_p_ && !last_mom_) { - span_p_= new Staff_symbol(NO_LINES); - span_p_->left_col_l_ = - get_staff_info().command_pcol_l()->postbreak_p_; // ugh - } - if (!last_mom_) { - last_mom_ = get_staff_info().score_l()->last(); - } + span_p_ = new Staff_symbol(NO_LINES); + span_p_->left_col_l_ = get_staff_info().command_pcol_l(); // ugh } void -Staff_sym_register::process_requests() +Staff_sym_register::do_removal_processing() { - announce_element(Score_elem_info(span_p_, 0)); + span_p_->right_col_l_ = get_staff_info().command_pcol_l(); + typeset_element(span_p_); + span_p_ =0; } void -Staff_sym_register::pre_move_processing() +Staff_sym_register::do_process_requests() { - Staff_info i=get_staff_info(); - if ( span_p_ && i.when() == last_mom_) { - span_p_->right_col_l_ = i.command_pcol_l()->prebreak_p_; - typeset_element(span_p_); - span_p_ =0; - } + announce_element(Score_elem_info(span_p_, 0)); } + IMPLEMENT_STATIC_NAME(Staff_sym_register); +IMPLEMENT_IS_TYPE_B1(Staff_sym_register,Request_register); ADD_THIS_REGISTER(Staff_sym_register); -Staff_sym_register::~Staff_sym_register() -{ - assert(!span_p_); - delete span_p_; -} diff --git a/lily/staff-sym.cc b/lily/staff-sym.cc index 8624878496..b83406c3a9 100644 --- a/lily/staff-sym.cc +++ b/lily/staff-sym.cc @@ -19,6 +19,7 @@ Staff_symbol::Staff_symbol(int l) } IMPLEMENT_STATIC_NAME(Staff_symbol); +IMPLEMENT_IS_TYPE_B1(Staff_symbol,Spanner); void Staff_symbol::do_print()const diff --git a/lily/staff-walker.cc b/lily/staff-walker.cc deleted file mode 100644 index b83c527168..0000000000 --- a/lily/staff-walker.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* - staff-walker.cc -- implement Staff_walker - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "proto.hh" -#include "plist.hh" -#include "grouping.hh" -#include "staff.hh" -#include "musical-request.hh" -#include "staff-walker.hh" -#include "staff-column.hh" -#include "score-column.hh" -#include "debug.hh" -#include "time-description.hh" -#include "command-request.hh" -#include "grouping.hh" -#include "score-walker.hh" - -Staff_walker::~Staff_walker() -{ - do_pre_move(); -} - -Staff_walker::Staff_walker(Staff_walker const &s) - :PCursor<Staff_column*> (s) -{ - assert(false); -} - -Staff_walker::Staff_walker(Staff * s, PScore*ps ) - : PCursor<Staff_column*> (s->cols_) -{ - staff_l_ = s; - pscore_l_ = ps; - - // should be in tdes. TODO - default_grouping = new Rhythmic_grouping(MInterval(0, 1), 4); - score_walk_l_ = 0; -} - -Moment -Staff_walker::when() const -{ - return ptr()->when(); -} - -void -Staff_walker::process_timing_reqs() -{ - ptr()->update_time(time_, default_grouping); -} - -void -Staff_walker::operator++(int i) -{ - Moment last = when(); - - do_pre_move(); - PCursor<Staff_column*>::operator++(i); - if (ok() ) { - Moment delta_t = when() - last; - assert(delta_t >Moment(0)); - time_.add( delta_t ); - } - do_post_move(); -} - -void -Staff_walker::process() -{ - process_timing_reqs(); - process_requests(); -} - -void -Staff_walker::allow_break() -{ - score_walk_l_->allow_break(this); -} - diff --git a/lily/staff.cc b/lily/staff.cc deleted file mode 100644 index 76e6d995ca..0000000000 --- a/lily/staff.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - staff.cc -- implement Staff - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "proto.hh" -#include "plist.hh" -#include "input-register.hh" -#include "staff.hh" -#include "score.hh" -#include "voice.hh" -#include "staff-column.hh" -#include "score-column.hh" -#include "voice-element.hh" -#include "debug.hh" -#include "musical-request.hh" -#include "command-request.hh" // todo -#include "staffline.hh" -#include "complex-walker.hh" -#include "super-elem.hh" -#include "p-score.hh" -#include "scoreline.hh" - -void -Staff::add(Link_list<Voice*> const &l) -{ - for (iter_top(l,i); i.ok(); i++) - voice_list_.bottom().add(i); -} - -Paper_def * -Staff::paper() const -{ - return score_l_->paper_p_; -} - -void -Staff::clean_cols() -{ -#if 0 // TODO - iter_top(cols_,i); - for(; i.ok(); ){ - if (!i->musical_column_l_->used_b()) - i->musical_column_l_ = 0; - if (!i->command_column_l_->used_b()) - i->command_column_l_ =0; - - if (!i->command_column_l_&& !i->musical_column_l_) - delete i.remove_p(); - else - i++; - } -#endif -} - - -void -Staff::OK() const -{ -#ifndef NDEBUG - cols_.OK(); - voice_list_.OK(); - assert(score_l_); -#endif -} - - -Moment -Staff::last() const -{ - Moment l = 0; - for (iter_top(voice_list_,i); i.ok(); i++) { - l = l >? i->last(); - } - return l; -} - -void -Staff::print() const -{ -#ifndef NPRINT - mtor << "Staff {\n"; - for (iter_top(voice_list_,i); i.ok(); i++) { - i->print(); - } - ireg_p_->print(); - mtor <<"}\n"; -#endif -} - -Staff::~Staff() -{ - delete ireg_p_; -} - -Staff::Staff() -{ - ireg_p_ =0; - score_l_ =0; - pscore_l_ =0; -} - -void -Staff::add_col(Staff_column*c_l) -{ - cols_.bottom().add(c_l); - c_l->staff_l_ = this; -} - -void -Staff::set_output(PScore* pscore_l ) -{ - pscore_l_ = pscore_l; - staff_line_l_ = new Line_of_staff; - pscore_l_->typeset_unbroken_spanner(staff_line_l_); - pscore_l_->super_elem_l_->line_of_score_l_->add_line(staff_line_l_); -} - - -Staff_walker * -Staff::get_walker_p() -{ - return new Complex_walker(this); -} diff --git a/lily/staffline.cc b/lily/staffline.cc index 533d512645..359d719f0b 100644 --- a/lily/staffline.cc +++ b/lily/staffline.cc @@ -1,3 +1,11 @@ +/* + staffline.cc -- implement Line_of_staff + + source file of the GNU LilyPond music typesetter + + (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include "staffline.hh" #include "scoreline.hh" #include "dimen.hh" @@ -10,10 +18,11 @@ IMPLEMENT_STATIC_NAME(Line_of_staff); +IMPLEMENT_IS_TYPE_B2(Line_of_staff,Spanner,Horizontal_vertical_group); void Line_of_staff::add_element(Score_elem*elem_l) { - if (!elem_l->group_element_i_) - Element_group::add_element(elem_l); + if (!elem_l->y_group_element_i_) + Horizontal_vertical_group::add_element(elem_l); } diff --git a/lily/stem-beam-reg.cc b/lily/stem-beam-reg.cc index 8f85238abf..1630f4b79d 100644 --- a/lily/stem-beam-reg.cc +++ b/lily/stem-beam-reg.cc @@ -10,14 +10,14 @@ #include "stem.hh" #include "grouping.hh" #include "text-spanner.hh" -#include "complex-walker.hh" #include "debug.hh" #include "grouping.hh" #include "note-head.hh" +#include "time-description.hh" Stem_beam_register::Stem_beam_register() { - post_move_processing(); + do_post_move_processing(); current_grouping = 0; beam_p_ = 0; @@ -26,7 +26,7 @@ Stem_beam_register::Stem_beam_register() } bool -Stem_beam_register::try_request(Request*req_l) +Stem_beam_register::do_try_request(Request*req_l) { Musical_req* mus_l = req_l->musical(); @@ -65,7 +65,7 @@ Stem_beam_register::try_request(Request*req_l) } void -Stem_beam_register::process_requests() +Stem_beam_register::do_process_requests() { if (beam_req_l_) { if (beam_req_l_->spantype == Span_req::STOP) { @@ -74,7 +74,7 @@ Stem_beam_register::process_requests() } else { beam_p_ = new Beam; start_req_l_ = beam_req_l_; - + beam_p_->left_col_l_ = get_staff_info().musical_pcol_l(); current_grouping = new Rhythmic_grouping; if (beam_req_l_->nplet) { Text_spanner* t = new Text_spanner(); @@ -127,7 +127,7 @@ Stem_beam_register::acknowledge_element(Score_elem_info info) } } void -Stem_beam_register::pre_move_processing() +Stem_beam_register::do_pre_move_processing() { if (stem_p_) { if (default_dir_i_) @@ -140,6 +140,7 @@ Stem_beam_register::pre_move_processing() Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_; rg_C->extend(current_grouping->interval()); beam_p_->set_grouping(*rg_C, *current_grouping); + beam_p_->right_col_l_ = get_staff_info().musical_pcol_l(); typeset_element(beam_p_); delete current_grouping; current_grouping = 0; @@ -148,7 +149,7 @@ Stem_beam_register::pre_move_processing() end_beam_b_ = false; } void -Stem_beam_register::post_move_processing() +Stem_beam_register::do_post_move_processing() { stem_p_ = 0; beam_req_l_ = 0; @@ -170,4 +171,5 @@ Stem_beam_register::set_feature(Feature i) } IMPLEMENT_STATIC_NAME(Stem_beam_register); +IMPLEMENT_IS_TYPE_B1(Stem_beam_register,Request_register); ADD_THIS_REGISTER(Stem_beam_register); diff --git a/lily/stem.cc b/lily/stem.cc index 3cd58198b3..d41d96f9c3 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -1,3 +1,11 @@ +/* + stem.cc -- implement Stem + + source file of the GNU LilyPond music typesetter + + (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include "stem.hh" #include "dimen.hh" #include "debug.hh" @@ -41,10 +49,10 @@ Stem::Stem(int c) print_flag_b_=true; stem_xoffset_f_ =0; - } IMPLEMENT_STATIC_NAME(Stem); +IMPLEMENT_IS_TYPE_B1(Stem,Item); void Stem::do_print() const @@ -105,31 +113,39 @@ Stem::invisible_b()const { return !head_l_arr_.size(); } -bool -Stem::chord_b() const + +// if dir_i_ is set we return fake values. + +int +Stem::get_center_distance_from_top() { - return head_l_arr_.size() > 1; + if (dir_i_) + return (dir_i_ > 0) ? 0 : 1; + + int staff_center = staff_size_i_ / 2; + int max = max_head_i() - staff_center; + return max >? 0; } -// if dir_i_ is set we return a fake value. +// if dir_i_ is set we return fake values. int -Stem::get_center_distance() +Stem::get_center_distance_from_bottom() { if (dir_i_) - return -dir_i_; + return (dir_i_ > 0) ? 1 : 0; int staff_center = staff_size_i_ / 2; - int min = min_head_i() - staff_center; - int max = max_head_i() - staff_center; - return (abs(max) > abs(min)) ? max : min; + int min = staff_center - min_head_i(); + return min >? 0; } int Stem::get_default_dir() { if (dir_i_) - return dir_i_; - return -sign(get_center_distance()); + return dir_i_; + return (get_center_distance_from_top() >= + get_center_distance_from_bottom()) ? -1 : 1; } @@ -211,6 +227,8 @@ Stem::do_pre_processing() set_default_extents(); set_noteheads(); flag_i_ = dir_i_*abs(flag_i_); + transparent_b_ = invisible_b(); + empty_b_ = invisible_b(); } @@ -229,9 +247,7 @@ Molecule* Stem::brew_molecule_p()const { Molecule *out =0; - if ( invisible_b() ) - return Score_elem::brew_molecule_p(); - + Real bot = stem_bottom_f_; Real top = stem_top_f_; @@ -255,7 +271,7 @@ Stem::brew_molecule_p()const assert(false); } - out->translate(Offset(stem_xoffset_f_,0)); + out->translate_x(stem_xoffset_f_); return out; } diff --git a/lily/super-elem.cc b/lily/super-elem.cc index 792f97f503..c2554516fe 100644 --- a/lily/super-elem.cc +++ b/lily/super-elem.cc @@ -54,3 +54,4 @@ Super_elem::do_add_processing() IMPLEMENT_STATIC_NAME(Super_elem); +IMPLEMENT_IS_TYPE_B1(Super_elem,Score_elem); diff --git a/lily/swallow-reg.cc b/lily/swallow-reg.cc index a84d9054d7..6f182fbd98 100644 --- a/lily/swallow-reg.cc +++ b/lily/swallow-reg.cc @@ -8,16 +8,12 @@ #include "swallow-reg.hh" IMPLEMENT_STATIC_NAME(Swallow_register); +IMPLEMENT_IS_TYPE_B1(Swallow_register,Request_register); ADD_THIS_REGISTER(Swallow_register); -bool -Swallow_register::acceptable_request_b(Request*) const -{ - return true; -} bool -Swallow_register::try_request(Request*) +Swallow_register::do_try_request(Request*) { return true; } diff --git a/lily/template1.cc b/lily/template1.cc index 676fb4b7fb..0a765f3110 100644 --- a/lily/template1.cc +++ b/lily/template1.cc @@ -13,8 +13,6 @@ #include "item.hh" #include "musical-request.hh" #include "spanner.hh" -#include "scoreline.hh" -#include "staffline.hh" #include "pcursor.tcc" #include "plist.tcc" @@ -22,8 +20,6 @@ #define IPLC_instantiate(a) IPL_instantiate(a); PL_instantiate(const a) -IPLC_instantiate(Line_of_score); -IPLC_instantiate(Line_of_staff); IPLC_instantiate(Score_elem); IPLC_instantiate(Spanner); IPLC_instantiate(Idealspacing); diff --git a/lily/template2.cc b/lily/template2.cc index 1115253ce5..385fc14160 100644 --- a/lily/template2.cc +++ b/lily/template2.cc @@ -6,24 +6,8 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "music.hh" -#include "symbol.hh" -#include "voice.hh" -#include "voice-element.hh" -#include "musical-request.hh" -#include "staff.hh" #include "score-column.hh" -#include "staff-column.hh" -#include "spanner.hh" #include "plist.tcc" #include "pcursor.tcc" -IPL_instantiate(Request); IPL_instantiate(Score_column); -IPL_instantiate(Staff_column); -IPL_instantiate(Staff); -IPL_instantiate(Voice_element); -IPL_instantiate(Voice); - - -IPL_instantiate(Music); diff --git a/lily/template3.cc b/lily/template3.cc index 42a48125f0..54ce792744 100644 --- a/lily/template3.cc +++ b/lily/template3.cc @@ -8,16 +8,10 @@ #include "symbol.hh" #include "request.hh" -#include "input-score.hh" -#include "input-staff.hh" -#include "input-music.hh" #include "input-register.hh" #include "molecule.hh" -#include "voice-element.hh" #include "plist.tcc" #include "pcursor.tcc" IPL_instantiate(Atom); -IPL_instantiate(Input_staff); -IPL_instantiate(Input_music); IPL_instantiate(Input_register); diff --git a/lily/template6.cc b/lily/template6.cc index 0401c8cd93..d543208d8d 100644 --- a/lily/template6.cc +++ b/lily/template6.cc @@ -1,10 +1,5 @@ #include "proto.hh" #include "plist.tcc" #include "register.hh" -#include "voice-group-regs.hh" -#include "voice-regs.hh" - -IPL_instantiate(Voice_registers); -IPL_instantiate(Voice_group_registers); IPL_instantiate(Request_register); diff --git a/lily/template7.cc b/lily/template7.cc index ef2969b784..602fdeb2b6 100644 --- a/lily/template7.cc +++ b/lily/template7.cc @@ -6,9 +6,11 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "staff-column.hh" -#include "request-column.hh" #include "plist.tcc" #include "pcursor.tcc" -IPL_instantiate(Request_column); +#include "music-list.hh" +#include "music-iterator.hh" + +IPL_instantiate(Music); +IPL_instantiate(Music_iterator); diff --git a/lily/template8.cc b/lily/template8.cc index 09da3b6ec7..db1531f0a9 100644 --- a/lily/template8.cc +++ b/lily/template8.cc @@ -1,6 +1,3 @@ -#include "pulk-voice.hh" #include "plist.tcc" #include "pcursor.tcc" - -IPL_instantiate(Pulk_voice); diff --git a/lily/tex-slur.cc b/lily/tex-slur.cc index d44b346929..76d1de2060 100644 --- a/lily/tex-slur.cc +++ b/lily/tex-slur.cc @@ -55,7 +55,7 @@ Lookup::half_slur_middlepart(Real &dx, int dir) const f+=String( "{" ) + String( idx ) + "}"; s.tex = f; Atom a(s); - a.translate(Offset(dx/2,0)); + a.translate_x(dx/2); s.tex = a.TeX_string(); return s; @@ -169,7 +169,7 @@ Lookup::slur (int dy , Real &dx, int dir) const s.tex = f; Atom a(s); - a.translate(Offset(dx/2,0)); + a.translate_x(dx/2); s.dim = a.extent(); s.tex = a.TeX_string(); return s; @@ -195,10 +195,10 @@ Lookup::big_slur(int dy , Real &dx, int dir) const Molecule mol; mol.add(l); Atom a(m); - a.translate(Offset(0,slur_extra * internote_f())); + a.translate_y(slur_extra * internote_f()); mol.add_right(m); mol.add_right(r); - mol.translate(Offset(0, l_dy * internote_f())); + mol.translate_y( l_dy * internote_f()); Symbol s; s.tex = mol.TeX_string(); s.dim = mol.extent(); diff --git a/lily/text-def.cc b/lily/text-def.cc index a9e95ef68d..dc7ed6f58a 100644 --- a/lily/text-def.cc +++ b/lily/text-def.cc @@ -18,7 +18,7 @@ Text_def::width(Paper_def * p) const { Atom a = get_atom(p,0); - Real guess_width_f = text_str_.length_i() * a.sym.dim.x.length(); // ugh + Real guess_width_f = text_str_.length_i() * a.sym_.dim.x.length(); // ugh Interval i(0, guess_width_f); i += - (align_i_ + 1)* i.center(); return i; @@ -50,3 +50,4 @@ Text_def::print() const style_str_ << "align " << align_i_ << '\n'; } IMPLEMENT_STATIC_NAME(Text_def); +IMPLEMENT_IS_TYPE_B1(Text_def,General_script_def); diff --git a/lily/text-item.cc b/lily/text-item.cc index 9d661f405f..42ae3994c4 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -60,10 +60,11 @@ Text_item::brew_molecule_p() const Molecule* mol_p = new Molecule(a); if(dir_i_<0 ) // should do something better anyway. - mol_p->translate(Offset(0, -mol_p->extent().y.left )); - mol_p->translate(Offset(0, pos_i_ * paper()->internote_f())); + mol_p->translate_y( -mol_p->extent().y.left ); + mol_p->translate_y( pos_i_ * paper()->internote_f()); return mol_p; } IMPLEMENT_STATIC_NAME(Text_item); +IMPLEMENT_IS_TYPE_B1(Text_item,Item); diff --git a/lily/text-reg.cc b/lily/text-reg.cc index afbf035d22..99c35d276b 100644 --- a/lily/text-reg.cc +++ b/lily/text-reg.cc @@ -12,20 +12,21 @@ Text_register::Text_register() { text_p_ = 0; dir_i_ =0; - post_move_processing(); + do_post_move_processing(); } bool -Text_register::try_request(Request*req_l) +Text_register::do_try_request(Request*req_l) { - if (!req_l->text()) + Musical_req *m = req_l->musical(); + if (!m || ! m->text()) return false; if (text_req_l_ && - Text_req::compare(*req_l->text(), *text_req_l_)) + Text_req::compare(*m->text(), *text_req_l_)) return false; - text_req_l_ = req_l->text(); + text_req_l_ = m->text(); return true; } void @@ -36,7 +37,7 @@ Text_register::acknowledge_element(Score_elem_info i) } } void -Text_register::process_requests() +Text_register::do_process_requests() { if (text_req_l_) { text_p_ = new Text_item(text_req_l_->tdef_p_, text_req_l_->dir_i_); // ugh @@ -44,7 +45,7 @@ Text_register::process_requests() } } void -Text_register::pre_move_processing() +Text_register::do_pre_move_processing() { if (text_p_) { if (dir_i_ && !text_p_->dir_i_) @@ -63,9 +64,10 @@ Text_register::set_feature(Feature i) dir_i_ = i.value_; } void -Text_register::post_move_processing() +Text_register::do_post_move_processing() { text_req_l_ = 0; } IMPLEMENT_STATIC_NAME(Text_register); +IMPLEMENT_IS_TYPE_B1(Text_register,Request_register); ADD_THIS_REGISTER(Text_register); diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index ceaacd8793..2b40f00e8e 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -32,6 +32,7 @@ Text_spanner::Text_spanner() } IMPLEMENT_STATIC_NAME(Text_spanner); +IMPLEMENT_IS_TYPE_B1(Text_spanner,Spanner); void Text_spanner::do_print() const diff --git a/lily/tie-reg.cc b/lily/tie-reg.cc index 2b8fe5d642..5541888b3c 100644 --- a/lily/tie-reg.cc +++ b/lily/tie-reg.cc @@ -10,7 +10,7 @@ #include "tie.hh" #include "note-head.hh" #include "musical-request.hh" -#include "voice-element.hh" +#include "music-list.hh" Tie_register::Tie_register() { @@ -31,7 +31,7 @@ Tie_register::sync_features() void -Tie_register::post_move_processing() +Tie_register::do_post_move_processing() { if (tie_p_ && get_staff_info().when() == end_mom_) { end_tie_p_ = tie_p_; @@ -50,7 +50,7 @@ Tie_register::acceptable_request_b(Request*r) } bool -Tie_register::try_request(Request*r) +Tie_register::do_try_request(Request*r) { if(!acceptable_request_b(r)) return false; @@ -58,12 +58,13 @@ Tie_register::try_request(Request*r) return false; } req_l_ = r->musical()->tie(); - end_mom_ = r->elt_l_->duration_ + get_staff_info().when(); + end_mom_ = r->parent_music_l_->time_int().length() + + get_staff_info().when(); return true; } void -Tie_register::process_requests() +Tie_register::do_process_requests() { if (req_l_ && ! tie_p_) { tie_p_ = new Tie; @@ -89,7 +90,7 @@ Tie_register::acknowledge_element(Score_elem_info i) } void -Tie_register::pre_move_processing() +Tie_register::do_pre_move_processing() { if (end_tie_p_) { if (dir_i_) @@ -118,4 +119,5 @@ Tie_register::set_feature(Feature f) } IMPLEMENT_STATIC_NAME(Tie_register); +IMPLEMENT_IS_TYPE_B1(Tie_register,Request_register); ADD_THIS_REGISTER(Tie_register); diff --git a/lily/tie.cc b/lily/tie.cc index 80170cf0b3..7ce834946c 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -92,3 +92,4 @@ Tie::do_substitute_dependency(Score_elem*o, Score_elem*n) IMPLEMENT_STATIC_NAME(Tie); +IMPLEMENT_IS_TYPE_B1(Tie,Bow); diff --git a/lily/vertical-align-elem.cc b/lily/vertical-align-elem.cc new file mode 100644 index 0000000000..4ff58eef6f --- /dev/null +++ b/lily/vertical-align-elem.cc @@ -0,0 +1,63 @@ +/* + vertical-align-item.cc -- implement Vertical_align_elem + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "vertical-align-elem.hh" +#include "interval.hh" + +void +Vertical_align_elem::add(Score_elem*el_l) +{ + assert( ! contains_b(el_l)); + elem_l_arr_.push(el_l); + add_dependency(el_l); +} + +void +Vertical_align_elem::do_substitute_dependency(Score_elem*o,Score_elem*n) +{ + int i; + while((i = elem_l_arr_.find_i(o))>=0) + if (n) + elem_l_arr_[i] = n; + else + elem_l_arr_.del(i); +} +void +Vertical_align_elem::do_post_processing() +{ + Array<Interval> dims; + for (int i=elem_l_arr_.size(); i--; ) { + Interval y = elem_l_arr_[i]->height() ; + if (y.empty_b()) + y = Interval(0,0); + + dims.push(y); + } + + Real where_f=0; + for ( int i=0 ; i < elem_l_arr_.size(); i++) { + elem_l_arr_[i]->translate_y( - dims[i][1] - where_f); + where_f += dims[i].length(); + } +} + +bool +Vertical_align_elem::contains_b(Score_elem const *e)const +{ + return elem_l_arr_.find_l(e); +} + +Vertical_align_elem::Vertical_align_elem() +{ + transparent_b_ = true; + empty_b_ =true; +} + +IMPLEMENT_STATIC_NAME(Vertical_align_elem); +IMPLEMENT_IS_TYPE_B1(Vertical_align_elem, Score_elem); + diff --git a/lily/voice-element.cc b/lily/voice-element.cc deleted file mode 100644 index f08aa773ef..0000000000 --- a/lily/voice-element.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* - voice-elt.cc -- implement Voice_element - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "proto.hh" -#include "plist.hh" -#include "debug.hh" -#include "voice.hh" -#include "voice-element.hh" -#include "musical-request.hh" -#include "command-request.hh" - - -void -Voice_element::transpose(Melodic_req const&d)const -{ - for (iter_top(req_p_list_,i); i.ok(); i++) { - i->transpose(d); - } -} - -void -Voice_element::print() const -{ -#ifndef NPRINT - mtor << "voice_element { dur :"<< duration_ <<"\n"; - mtor << "principal: " << principal_req_l_->name() << "\n"; - for (iter_top(req_p_list_,rc); rc.ok(); rc++) { - rc->print(); - } - - mtor << "}\n"; -#endif -} - -void -Voice_element::add(Request*r) -{ - if (! principal_req_l_ ) - principal_req_l_ = r; - - if (r->duration()) { - assert (!duration_ || duration_ == r->duration()); - duration_ = r->duration(); - } - - r->elt_l_ = this; - req_p_list_.bottom().add(r); -} - - -Voice_element::Voice_element() -{ - principal_req_l_ = 0; - voice_C_ = 0; - duration_ = 0; -} - -Voice_element::Voice_element(Voice_element const&src) - : Input(src) -{ - principal_req_l_ = 0; - voice_C_=0; - for (iter_top(src.req_p_list_, i); i.ok(); i++) - add(i->clone()); - -} - -void -Voice_element::set_default_group(String s) -{ - for (iter_top(req_p_list_, i); i.ok(); i++) - if (i->command() &&i->command()->groupchange()) - return ; - Group_change_req *greq = new Group_change_req; - greq->newgroup_str_ = s; - add(greq); -} - diff --git a/lily/voice-group-regs.cc b/lily/voice-group-regs.cc index 72f3c9426c..06757b7b74 100644 --- a/lily/voice-group-regs.cc +++ b/lily/voice-group-regs.cc @@ -5,41 +5,28 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "voice.hh" +#include "music-list.hh" #include "proto.hh" #include "plist.hh" #include "musical-request.hh" #include "voice-regs.hh" #include "voice-group-regs.hh" #include "register.hh" -#include "complex-walker.hh" #include "command-request.hh" #include "debug.hh" #include "input-register.hh" +#include "time-description.hh" -static int temp_id_count; -Voice_group_registers::Voice_group_registers(String id, - Input_register const *ireg_C) +Voice_group_registers::Voice_group_registers() { dir_i_ =0; - ireg_C_ =ireg_C; - Register_group_register::add(ireg_C->get_nongroup_p_arr()); - if (id=="") // ugh - id = __FUNCTION__ + String(temp_id_count++); - group_id_str_ = id; - termination_mom_ = 0; + termination_mom_ = INFTY; } bool -Voice_group_registers::try_request(Request*r_l) +Voice_group_registers::do_try_request(Request*r_l) { - for (int i=0; i < voice_reg_l_arr_.size(); i++) { - if (voice_reg_l_arr_[i]->voice_l_ == r_l->voice_l()) - goto gotcha; // yeah, yeah, I know - } - return false; -gotcha: Command_req* c_l = r_l->command(); if (c_l&& c_l->groupfeature()) { Feature f; @@ -48,79 +35,33 @@ gotcha: set_feature(f); return true; } - return Register_group_register::try_request(r_l); + return Register_group_register::do_try_request(r_l); } IMPLEMENT_STATIC_NAME(Voice_group_registers); +IMPLEMENT_IS_TYPE_B1(Voice_group_registers,Register_group_register); void Voice_group_registers::do_print() const { #ifndef NPRINT - mtor << "ID: " << group_id_str_<<"\n"; - mtor << "stopping at " << termination_mom_ << "\n"; Register_group_register::do_print(); #endif } -void -Voice_group_registers::add(Request_register*r_l) -{ - Register_group_register::add(r_l); - if (r_l->name() == Voice_registers::static_name()) { - Voice_registers * vregs_l = (Voice_registers*)r_l; - voice_reg_l_arr_.push( vregs_l ); - Voice *v_l = vregs_l->voice_l_; - termination_mom_ = termination_mom_ >? v_l -> last(); - mtor << "adding Voice_registers, now terminating at " << - termination_mom_<< "\n"; - } - OK(); -} void -Voice_group_registers::post_move_processing() +Voice_group_registers::do_post_move_processing() { if ( get_staff_info().time_C_ ->when_ > termination_mom_ ){ mtor << "Terminating voice_group\n"; daddy_reg_l_->terminate_register(this); return ; } - Register_group_register::post_move_processing(); + Register_group_register::do_post_move_processing(); } -Request_register * -Voice_group_registers::get_register_p(Request_register *reg_l) -{ - if (reg_l->name() == Voice_registers::static_name()) { - for (int i=0; i <voice_reg_l_arr_.size(); i++) { - if (reg_l == voice_reg_l_arr_[i]) - voice_reg_l_arr_.del(i); - } - } - Request_register*reg_p =Register_group_register::get_register_p(reg_l); - OK(); - - return reg_p; -} -void -Voice_group_registers::OK() const -{ - for (int i=0; i < voice_reg_l_arr_.size(); i++) { - iter(reg_list_.find(voice_reg_l_arr_[i]), j); - assert(j.ok()); - } -} - - -void -Voice_group_registers::set_feature(Feature f) -{ - if (f.type_ == "vdir") - dir_i_ = f.value_; - Register_group_register::set_feature(f); -} Scalar Voice_group_registers::get_feature(String f) @@ -129,3 +70,5 @@ Voice_group_registers::get_feature(String f) return dir_i_; Register_group_register::get_feature(f); } + +ADD_THIS_REGISTER(Voice_group_registers); diff --git a/lily/voice-regs.cc b/lily/voice-regs.cc index 43daf70815..641e8d6da1 100644 --- a/lily/voice-regs.cc +++ b/lily/voice-regs.cc @@ -5,81 +5,34 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ + #include "proto.hh" #include "plist.hh" #include "command-request.hh" #include "musical-request.hh" #include "voice-regs.hh" #include "register.hh" -#include "staff-regs.hh" // needed because somebody has to delete us. #include "debug.hh" -#include "input-register.hh" -#include "voice-group-regs.hh" -Voice_registers::Voice_registers(Voice *v_p, Input_register const*ireg_C) +Voice_registers::Voice_registers() { - terminate_b_ = false; - ireg_C_ = ireg_C; - voice_l_ = v_p; - add(ireg_C->get_nongroup_p_arr()); } void -Voice_registers::acknowledge_element(Score_elem_info i) -{ - if (i.voice_l_ != voice_l_) - return; - Register_group_register::acknowledge_element(i); -} - -bool -Voice_registers::try_request(Request*r_l) -{ - if (r_l->voice_l() !=voice_l_) - return false; - - Command_req *c=r_l->command(); - if (c&&c->terminate()) { - terminate_b_ = true; - return true; // scary. We're deleted now.. - } else if (c&&c->groupchange()) { - /* this is scary as well. The groupchange has to be handled by - the Staff_registers, which are two levels up in the hierarchy - */ - - assert(daddy_reg_l_->name() == Voice_group_registers::static_name()); - ((Staff_registers*)daddy_reg_l_->daddy_reg_l_)-> // scary. - change_group(c->groupchange(), this, - (Voice_group_registers*)daddy_reg_l_); // ugh! - return true; - } - - return Register_group_register::try_request(r_l); -} - -bool -Voice_registers::acceptable_request_b(Request*r) -{ - Command_req * c_l = r->command(); - return (c_l&&(c_l->terminate()||c_l->groupchange())) - || Register_group_register::acceptable_request_b(r); -} -IMPLEMENT_STATIC_NAME(Voice_registers); - -void Voice_registers::do_print() const { #ifndef NPRINT - mtor << "Voice= " << voice_l_<<'\n'; Register_group_register::do_print(); #endif } -void -Voice_registers::pre_move_processing() +ADD_THIS_REGISTER(Voice_registers); +IMPLEMENT_IS_TYPE_B1(Voice_registers, Register_group_register); +IMPLEMENT_STATIC_NAME(Voice_registers); + +bool +Voice_registers::interpret_request_b(Request*r) { - if (terminate_b_) - daddy_reg_l_->terminate_register(this); - else - Register_group_register::pre_move_processing(); + return try_request(r); } + diff --git a/lily/voice.cc b/lily/voice.cc deleted file mode 100644 index f248f3aa0e..0000000000 --- a/lily/voice.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - voice.cc -- implement Voice - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "proto.hh" -#include "plist.hh" -#include "debug.hh" -#include "voice.hh" -#include "musical-request.hh" -#include "command-request.hh" -#include "midi-item.hh" -#include "midi-stream.hh" -#include "voice-element.hh" - -void -Voice::transpose(Melodic_req const & d)const -{ - for (iter_bot(elts_, i); i.ok(); i--) - i->transpose(d); -} - -void -Voice::set_default_group(String s) -{ - elts_.top()->set_default_group(s); -} - -Voice::Voice(Voice const&src) -{ - for (iter_top(src.elts_, i); i.ok(); i++) - add(new Voice_element(**i)); - - start_ = src.start_; -} - -Voice::Voice() -{ - start_ = 0; -} - -void -Voice::add(Voice_element*v) -{ - v->voice_C_ = this; - elts_.bottom().add(v); -} - -void -Voice::print() const -{ -#ifndef NPRINT - mtor << "Voice { start_: "<< start_<<eol; - for (iter_top(elts_,i); i.ok(); i++) - i->print(); - mtor << "}\n"; -#endif -} - -/** - @return The moment at which last element stops. - */ -Moment -Voice::last() const -{ - Moment l =0; - if (elts_.size()) - l = start_; - - for (iter_top(elts_,i); i.ok(); i++) - l += i->duration_; - return l; -} - diff --git a/lily/walk-regs.cc b/lily/walk-regs.cc deleted file mode 100644 index 328fa177cd..0000000000 --- a/lily/walk-regs.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* - walkregs.cc -- implement Walker_registers - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ -#include "debug.hh" -#include "walk-regs.hh" -#include "staff-regs.hh" -#include "score-elem.hh" -#include "staff.hh" -#include "complex-walker.hh" -#include "staff-column.hh" -#include "score-walker.hh" -#include "bar.hh" // needed for Bar::static_name -#include "input-register.hh" -#include "staffline.hh" - -Walker_registers::Walker_registers(Complex_walker *w) -{ - walk_l_ = w; - Input_register * ireg_l = w->staff_l_->ireg_p_; - if (ireg_l->name_str_ == "Staff_registers") - add(new Staff_registers(ireg_l)); - else { - add(ireg_l->get_nongroup_p_arr()); - } -} - -void -Walker_registers::announce_element(Score_elem_info info) -{ - if (info.elem_l_->name() == Bar::static_name()) { - walk_l_->allow_break(); - } - announce_info_arr_.push(info); -} - -void -Walker_registers::acknowledge_element(Score_elem_info ) -{ - assert(false); -} - -void -Walker_registers::do_announces() -{ - Request dummy_req; - for (int i = 0; i < announce_info_arr_.size(); i++){ - Score_elem_info info = announce_info_arr_[i]; - mtor << "Announcing " << info.elem_l_->name()<<"\n"; - - if (!info.req_l_) - info.req_l_ = &dummy_req; - Register_group_register::acknowledge_element(info); - } - announce_info_arr_.set_size(0); -} - -void -Walker_registers::typeset_element(Score_elem *elem_p) -{ - musical_item_p_arr_.push(elem_p); -} - -void -Walker_registers::typeset_breakable_item(Item * pre_p , Item * nobreak_p, - Item * post_p) -{ - if (pre_p) { - prebreak_item_p_arr_.push(pre_p); - walk_l_->staff_l_->staff_line_l_->add_element(pre_p); - } - if (nobreak_p) { - nobreak_item_p_arr_.push(nobreak_p); - walk_l_->staff_l_->staff_line_l_->add_element(nobreak_p); - } - if (post_p) { - postbreak_item_p_arr_.push(post_p); - walk_l_->staff_l_->staff_line_l_->add_element(post_p); - } -} - -void -Walker_registers::pre_move_processing() -{ - // this generates all items. - Register_group_register::pre_move_processing(); - walk_l_->ptr()->typeset_breakable_items(prebreak_item_p_arr_, - nobreak_item_p_arr_, - postbreak_item_p_arr_); - for (int i=0; i < musical_item_p_arr_.size(); i++) - walk_l_->typeset_element(musical_item_p_arr_[i]); - musical_item_p_arr_.set_size(0); -} -void -Walker_registers::post_move_processing() -{ - Register_group_register::post_move_processing(); -} - - -Staff_info -Walker_registers::get_staff_info() -{ - Staff_info inf; - if (walk_l_->score_walk_l_) // we get called ctors - inf.break_allowed_b_ = walk_l_->score_walk_l_->break_allowed_b(); - inf.walk_l_ = walk_l_; - inf.time_C_ = &walk_l_->time_; - inf.rhythmic_C_ = walk_l_->default_grouping; - return inf; -} - -Paper_def* -Walker_registers::paper()const -{ - return walk_l_->staff_l_->paper(); -} diff --git a/make/Configure_variables.make.in b/make/Configure_variables.make.in index 3a4b0fe668..d162fe2f70 100644 --- a/make/Configure_variables.make.in +++ b/make/Configure_variables.make.in @@ -3,7 +3,7 @@ # @configure_input@ INSTALL = @INSTALL@ -USER_CXXFLAGS = +USER_CXXFLAGS = @CXXFLAGS@ @CPPFLAGS@ USER_LDFLAGS = CXX = @CXX@ diff --git a/make/Targets.make b/make/Targets.make index d196e1679f..a93ae1e1b2 100644 --- a/make/Targets.make +++ b/make/Targets.make @@ -30,7 +30,7 @@ include ./$(depth)/make/out/Site.make # dependency list of executable: # -$(EXECUTABLE): $(build) $(OFILES) +$(EXECUTABLE): $(build) $(OFILES) $(outdir)/version.hh $(MAKE) $(MODULE_LIBDEPS) $(INCREASE_BUILD) $(MAKE) -S $(OFILES) $(SILENT_LOG) @@ -223,12 +223,15 @@ $(LIBLILY): dummy # RedHat rpm package: # -rpm: $(doc-dir)/$(outdir)/lelie_icon.xpm +rpm: check-rpm-doc-deps -cp $(depth)/lilypond-$(TOPLEVEL_VERSION).tar.gz $(rpm-sources) -cp $< $(rpm-sources) $(MAKE) -C $(make-dir) spec rpm -ba $(makeout)/lilypond.spec # +check-rpm-doc-deps: + $(MAKE) -C $(depth)/Documentation/ xpms + installexe: $(INSTALL) -d $(bindir) diff --git a/make/lilypond.lsm b/make/lilypond.lsm index be27647870..2ba9980153 100644 --- a/make/lilypond.lsm +++ b/make/lilypond.lsm @@ -2,8 +2,8 @@ Begin3 Title: LilyPond -Version: 0.0.67 -Entered-date: 05/29/97 +Version: 0.0.68pre +Entered-date: 06/26/97 Description: LilyPond is a program which converts a music-script (mudela) into TeX output, or MIDI to produce multi-staff scores. Features include multiple meters, clefs, keys, lyrics, versatile input-language, cadenzas @@ -13,7 +13,7 @@ Author: hanwen@stack.nl (Han-Wen Nienhuys) jan@digicash.com (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: pcnov095.win.tue.nl /pub/lilypond/ - 300k lilypond-0.0.67.tar.gz + 300k lilypond-0.0.68pre.tar.gz Alternate-site: Original-site: Platform: unix/win32, GNU C++ diff --git a/make/lilypond.spec b/make/lilypond.spec index 1c1010ca7f..85123c76eb 100644 --- a/make/lilypond.spec +++ b/make/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 0.0.67 +Version: 0.0.68pre Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.0.67.tar.gz +Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.0.68pre.tar.gz Summary: A preprocessor to make TeX typeset music. URL: http://www.stack.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys <hanwen@stack.nl> @@ -27,7 +27,7 @@ rm -rf $RPM_BUILD_ROOT strip lily/out/lilypond mi2mu/out/mi2mu make prefix="$RPM_BUILD_ROOT/usr" install %files -%doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/error.text Documentation/out/faq.text Documentation/out/gnu-music.text Documentation/out/index.text Documentation/out/language.text Documentation/out/lilygut.text Documentation/out/lilyliterature.text Documentation/out/lilypond.text Documentation/out/mi2mu.text Documentation/out/mudela.text input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/error.ly input/header.ly input/keys.ly input/kortjakje.ly input/pedal.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen.ly input/standchen.tex input/toccata-fuga-E.ly input/twinkle.ly input/wohltemperirt.ly Documentation/lelie_logo.gif +%doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/error.text Documentation/out/faq.text Documentation/out/gnu-music.text Documentation/out/index.text Documentation/out/language.text Documentation/out/lilygut.text Documentation/out/lilyliterature.text Documentation/out/lilypond.text Documentation/out/mi2mu.text Documentation/out/mudela.text Documentation/out/other-packages.text input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/error.ly input/header.ly input/keys.ly input/kortjakje.ly input/multi.ly input/pedal.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen.ly input/standchen.tex input/toccata-fuga-E.ly input/twinkle.ly input/wohltemperirt.ly Documentation/lelie_logo.gif /usr/bin/convert-mudela /usr/bin/lilypond /usr/lib/libflower.so diff --git a/mf/Makefile b/mf/Makefile index ff0937ad8c..48682ab497 100644 --- a/mf/Makefile +++ b/mf/Makefile @@ -55,7 +55,7 @@ lily-mfdir = $(MFDIR)/lilypond localinstall: $(INSTALL) -d $(lily-mfdir) - $(INSTALL) -m 755 $(MFFILES) $(lily-mfdir) + $(INSTALL) -m 644 $(MFFILES) $(lily-mfdir) localuninstall: for i in $(MFFILES); do rm -f $(lily-mfdir)/$$i; done diff --git a/tex/Makefile b/tex/Makefile index 2c16ef242b..0e7e387650 100644 --- a/tex/Makefile +++ b/tex/Makefile @@ -16,7 +16,7 @@ DISTFILES = Makefile $(TEXFILES) localinstall: $(INSTALL) -d $(TEXDIR)/lilypond - $(INSTALL) -m 755 $(TEXFILES) $(TEXDIR)/lilypond/ + $(INSTALL) -m 644 $(TEXFILES) $(TEXDIR)/lilypond/ localuninstall: for i in $(TEXFILES) ; do rm -f $(TEXDIR)/lilypond/$$i; done diff --git a/tex/dimen.tex b/tex/dimen.tex index 093956cca9..e09ced2737 100644 --- a/tex/dimen.tex +++ b/tex/dimen.tex @@ -1,7 +1,7 @@ % % A tex file to help determine dims. % -\font\musicfont=musix20 +\font\musicfont=opus20 \font\slurfont=xslu16 \def\thefont{\musicfont} diff --git a/tex/eglerdefs.tex b/tex/eglerdefs.tex new file mode 100644 index 0000000000..ad2bf20aae --- /dev/null +++ b/tex/eglerdefs.tex @@ -0,0 +1,118 @@ +% +% Has to be fixed. Exercise for the reader. +% + + +\def\musixtwentyfonts{ + \font\textfont=cmr10 + \font\meterfont=cmbx12 + \font\slurufont=oslu20 + \font\slurdfont=osld20 + \font\slurhfont=oslz20 + \font\hslurufont=oslhu20 + \font\hslurdfont=oslhd20 + \font\hslurhfont=oslhz20 + \font\musicfnt=opus20 + \font\musicdraw=opussps + \font\italicfont=cmti10 + \font\dynfont=cmbxti10 scaled \magstep1 + \font\mathfont=cmsy10 +} + + +\def\musixsixteenfonts{ + \font\textfont=cmr8 + \font\meterfont=cmbx12 + \font\italicfont=cmti8 + \font\slurufont=oslu16 + \font\slurdfont=osld16 + \font\slurhfont=oslz20 % sigh + \font\hslurufont=oslhu16 + \font\hslurdfont=oslhd16 + \font\hslurhfont=oslhz20 + \font\musicfnt=opus16 + \font\dynfont=cmbxti12 + \font\musicdraw=opussps + \font\mathfont=cmsy8 +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% provide interface to musixtex fonts +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\mdef\quartball{26} +\mdef\halfball{27} +\mdef\wholeball{28} +\mdef\halfrest{13} +\mdef\wholerest{12} +\mdef\quartrest{14} +\mdef\eighthrest{15} +\mdef\sixteenthrest{16} +\mdef\thirtysecondrest{17} +\mdef\sixtyfourthrest{18} +%\mdef\hundredtwentyeighthrest{67} +\mdef\sharp{93} +\mdef\flat{91} +\mdef\natural{95} +\mdef\sharpsharp{94} +\mdef\flatflat{92} + +\mdef\singledot{'00} +\mdef\doubledot{'01} +\mdef\tripledot{'02} +\mdef\mussepline{155} + +\mdef\violinclef{65} +\mdef\bassclef{67} +\mdef\altoclef{69} +\mdef\cviolinclef{66} +\mdef\cbassclef{68} +\mdef\caltoclef{70} + +\mdef\deighthflag{32} +\mdef\dsixteenthflag{46} +\mdef\dthirtysecondflag{47} +\mdef\dsixtyfourthflag{48} +\mdef\dhundredtwentyeighthflag{49} + +% pointing up +\mdef\ueighthflag{40} +\mdef\usixteenthflag{41} +\mdef\uthirtysecondflag{42} +\mdef\usixtyfourthflag{43} +\mdef\uhundredtwentyeighthflag{44} + +\maccentdef\repeatcolon{55}{2/1} +\def\eighthflag{\topalign{\ueighthflag}} +\def\sixteenthflag{\topalign{\usixteenthflag}} +\def\thirtysecondflag{\topalign{\uthirtysecondflag}} +\def\sixtyfourthflag{\topalign{\usixtyfourthflag}} +\def\hundredtwentyeighthflag{\topalign{\uhundredtwentyeighthflag}} + +\def\cquartrest{\vertcenter\quartrest} +\def\ceighthrest{\vertcenter\eighthrest} +\def\csixteenthrest{\vertcenter\sixteenthrest} +\def\cthirtysecondrest{\vertcenter\thirtysecondrest} +\def\csixtyfourthrest{\vertcenter\sixtyfourthrest} +\def\chundredtwentyeighthrest{\vertcenter\hundredtwentyeighthrest} + +\def\lsingledot{\kern-\notewidth\singledot} +\def\ldoubledot{\kern-\notewidth\doubledot} +\def\ltripledot{\kern-\notewidth\tripledot} + +\maccentdef\sforzato{30}{-3/2} +\maccentdef\marcato{20}{-1/1} +\maccentdef\imarcato{21}{1/1} +\maccentdef\staccato{24}{-1/3} +\maccentdef\istaccato{25}{1/3} +\maccentdef\staccatissimo{28}{-5/5} +\maccentdef\istaccatissimo{29}{2/5} +\maccentdef\portato{18}{-6/5} +\maccentdef\iportato{19}{3/5} +\maccentdef\tenuto{26}{-1/1} +\maccentdef\itenuto{27}{1/1} +\maccentdef\fermata{80}{-1/1} +\maccentdef\ifermata{81}{1/1} + +\mdef\spicato{28} +\mdef\ispicato{29} +\mdef\upbow{23} +\mdef\downbow{22} diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index 30d2d34c1a..9e71e8ddda 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -53,45 +53,20 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % set fonts and primary dimensions \def\musixtwentydefs{ - \font\textfont=cmr10 - \font\meterfont=cmbx12 - \font\slurufont=xslu20 - \font\slurdfont=xsld20 - \font\slurhfont=xslz20 - \font\hslurufont=xslhu20 - \font\hslurdfont=xslhd20 - \font\hslurhfont=xslhz20 - \font\musicfnt=musix20 - \font\musicdraw=musixsps - \font\italicfont=cmti10 - \font\dynfont=cmbxti10 scaled \magstep1 - \font\mathfont=cmsy10 \balkheight=20pt \notewidth=6pt \noteheight=5pt \staffrulethickness=0.4pt + \musixtwentyfonts \musixcalc } - \def\musixsixteendefs{ - \font\textfont=cmr8 - \font\meterfont=cmbx12 - \font\italicfont=cmti8 - \font\slurufont=xslu16 - \font\slurdfont=xsld16 - \font\slurhfont=xslz20 % sigh - \font\hslurufont=xslhu16 - \font\hslurdfont=xslhd16 - \font\hslurhfont=xslhz20 - \font\musicfnt=musix16 - \font\dynfont=cmbxti12 - \font\musicdraw=musixsps - \font\mathfont=cmsy8 \balkheight=16pt \staffrulethickness=0.4pt \notewidth=5pt \noteheight=4pt + \musixsixteenfonts \musixcalc } @@ -244,3 +219,4 @@ % big fat marks, if errors are detected. \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}} \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}} +\def\unknown{{\bf u}} diff --git a/tex/taupindefs.tex b/tex/taupindefs.tex index f1cda10fcb..91eb34260a 100644 --- a/tex/taupindefs.tex +++ b/tex/taupindefs.tex @@ -1,4 +1,36 @@ +\def\musixtwentyfonts{ + \font\textfont=cmr10 + \font\meterfont=cmbx12 + \font\slurufont=xslu20 + \font\slurdfont=xsld20 + \font\slurhfont=xslz20 + \font\hslurufont=xslhu20 + \font\hslurdfont=xslhd20 + \font\hslurhfont=xslhz20 + \font\musicfnt=musix20 + \font\musicdraw=musixsps + \font\italicfont=cmti10 + \font\dynfont=cmbxti10 scaled \magstep1 + \font\mathfont=cmsy10 +} + + +\def\musixsixteenfonts{ + \font\textfont=cmr8 + \font\meterfont=cmbx12 + \font\italicfont=cmti8 + \font\slurufont=xslu16 + \font\slurdfont=xsld16 + \font\slurhfont=xslz20 % sigh + \font\hslurufont=xslhu16 + \font\hslurdfont=xslhd16 + \font\hslurhfont=xslhz20 + \font\musicfnt=musix16 + \font\dynfont=cmbxti12 + \font\musicdraw=musixsps + \font\mathfont=cmsy8 +} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % provide interface to musixtex fonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |