From: Han-Wen Nienhuys Date: Thu, 26 Jun 1997 16:22:36 +0000 (+0200) Subject: release: 0.0.68pre X-Git-Tag: release/0.0.68pre X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=036af34aa44a151b9e67c18e0acccaafdfae9de8;p=lilypond.git release: 0.0.68pre --- 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 diff --git a/.version b/.version index 7d6ac5a0ec..f39dbaa0d9 100644 --- a/.version +++ b/.version @@ -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 diff --git a/ANNOUNCE b/ANNOUNCE index 09c2e51cc1..003b4845c9 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -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 ? @@ -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 anyway + +A: C 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 @@ -63,6 +63,13 @@ resources on music typesetting +=item * + +Other packages for printing music. + + =item * 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 ] - -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 - -... 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 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). +[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 and F): 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 . + +=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 diff --git a/NEWS b/NEWS index d514afe7b5..fe3edf293f 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/TODO b/TODO index 8d3e7c344f..f7a191fe75 100644 --- a/TODO +++ b/TODO @@ -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 + + * 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 < 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 diff --git a/configure b/configure index c333bafab2..50aaf0d634 100755 --- a/configure +++ b/configure @@ -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 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 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 op) const; Cursor operator -=(int); Cursor operator +=(int); - + /// move one down + void next(); + /// move one up. + void previous(); /// return current and move one down Cursor 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::ok()const { return ( pointer_ != 0 ); } - +template +inline void +Cursor::next() +{ + assert( pointer_ ); + pointer_ = pointer_->next(); +} template inline Cursor Cursor::operator ++( int ) { Cursor r (*this); - assert( pointer_ ); - pointer_ = pointer_->next(); + next(); return r; } +template +inline void +Cursor::previous() +{ + assert( pointer_ ); + pointer_ = pointer_->previous(); +} + template inline Cursor Cursor::operator --( int ) { Cursor 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::ok; Cursor::del; Cursor::backspace; + Cursor::next; + Cursor::previous; + T remove_p() { T p = ptr(); Cursor::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 << "]"< +*/ + #include #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: " < 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 + +#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 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 sinfo; - for (int j=0; j 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 +*/ +#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 , Mats Bengtsson */ + #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 -*/ -#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 +*/ + + +#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 +*/ + +#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 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 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 +#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/atom.hh deleted file mode 100644 index 5e9f2601ff..0000000000 --- a/lily/include/atom.hh +++ /dev/null @@ -1,17 +0,0 @@ -/* - atom.hh -- declare - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef ATOM_HH -#define ATOM_HH - -#include "symbol.hh" -#error - - -#endif // ATOM_HH diff --git a/lily/include/bar-align-reg.hh b/lily/include/bar-align-reg.hh new file mode 100644 index 0000000000..7219cf4bac --- /dev/null +++ b/lily/include/bar-align-reg.hh @@ -0,0 +1,13 @@ +/* + bar-align-reg.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef BAR_ALIGN_REG_HH +#define BAR_ALIGN_REG_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 +*/ + + +#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 +*/ + + +#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 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 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 +*/ + + +#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_l_arr_; + Array 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 { - 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 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 ireg_list_; + Pointer_list contains_ireg_p_list_; + Array consists_str_arr_; + Array 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 get_nongroups_str_arr() const; + bool accept_req_b(); + bool accepts_b(String); void print() const; - /** - Construct the registers. - */ - Array 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 -*/ - - -#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 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 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 +*/ + + +#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 +*/ + + +#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 forced_l_arr_; Link_array 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 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 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 { bool ignore_b_; @@ -42,10 +45,10 @@ class Midi_walker : public PCursor 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 +*/ + + +#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 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, 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 +*/ + + +#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_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_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 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 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 -*/ - - -#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 cur_; - Moment elt_mom_; - Priorities 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 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 - - 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_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 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 reg_list_; + Link_array group_l_arr_; + Link_array nongroup_l_arr_; + String id_str_; + + Array 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 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 -*/ - - -#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_cols_; - Array staff_col_l_arr_; - Moment when_; - -public: - Score_column *musical_column_l_, *command_column_l_; - Request_column(Link_list const& ); - bool used_b()const; - Moment when(); - void add_reqs(int staff_idx, Array 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 +*/ + + +#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 */ -#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 +*/ + + +#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 +*/ + + +#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 nobreak_item_p_arr_; + Link_array 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 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 - - -*/ - - -#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* score_l_; - /// walkers for the individual staves. - Array walker_p_arr_; - Array 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 staffs_; + Music * music_p_; - /// "runtime" fields for setting up spacing - Pointer_list rcols_; Pointer_list 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 create_cols(Moment, PCursor &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 line_arr_; - Link_array cols; + Link_array 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 get_lines()const; void set_breaking(Array 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 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 creationreq_l_arr_; - Array musicalreq_l_arr_; - Array commandreq_l_arr_; - Staff * staff_l_; - Request_column * req_col_l_; - /// fields to collect timing data vertically. - Array 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 req_l_arr); - void OK() const; - ~Staff_column(); - void update_time(Time_description&, Rhythmic_grouping*); - void typeset_breakable_items(Array &pre_p_arr, - Array &nobreak_p_arr, - Array &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 group_l_arr_; - Staff_symbol * staff_sym_l_; + Line_of_staff *staffline_p_; + Link_array 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 * 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 -*/ - -#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_list_; - /// runtime field - Link_list cols_; - Line_of_staff * staff_line_l_; - - Score *score_l_; - PScore *pscore_l_; - - /* *************************************************************** */ - - void add(Link_list 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 -*/ - - -#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 +*/ + + +#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 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 -*/ - - -#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 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_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 -*/ - -#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 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 -*/ - - -#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 prebreak_item_p_arr_; - Array nobreak_item_p_arr_; - Array postbreak_item_p_arr_; - Link_array musical_item_p_arr_; - - Array 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 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 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 */ + #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 iregs_p_arr; + +void +add_global_input_register(Input_register *reg_p) { - return ireg_list_.size(); + iregs_p_arr.push(reg_p); } -Array -Input_register::get_nongroups_str_arr()const +Input_register * +lookup_reg(String nm) { - Array 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 -Input_register::get_nongroup_p_arr() const + + +Register_group_register * +Input_register::get_group_register_p() { - Array a; - Array 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 -*/ - -#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 -*/ - -#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 */ - +#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 */ -#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 \n" "Contributors\n" " Mats Bengtsson \n" + " Werner Lemberg \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 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 , Jan Nieuwenhuizen */ +#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(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 @@ -42,6 +42,18 @@ Molecule::translate(Offset o) c->translate(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) { @@ -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 +*/ + +#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_ next_moment() ; + return next_; +} + + + +bool +Chord_iterator::ok()const +{ + return children_p_list_.size(); +} + +/* ************** */ + +Voice_iterator::Voice_iterator(Voice const*v) + : PCursor ( 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::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::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 { @@ -93,6 +106,12 @@ PCol::set_breakable() postbreak_p_->pscore_l_ = pscore_l_; } +bool +PCol::breakpoint_b() const +{ + return !line_l_; +} + bool PCol::breakable_b() const { 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 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 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 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 -#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 * strvec; Array *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 DOTS +%type dots %token INT %token NOTENAME_ID -%token REGS_IDENTIFIER %token IDENTIFIER %token MELODIC_REQUEST_IDENTIFIER -%token CHORD_IDENTIFIER +%token MUSIC_IDENTIFIER %token VOICE_IDENTIFIER %token POST_REQUEST_IDENTIFIER %token SCRIPT_IDENTIFIER %token STAFF_IDENTIFIER %token REAL_IDENTIFIER +%token INT_IDENTIFIER %token SCORE_IDENTIFIER %token REQUEST_IDENTIFIER %token REAL @@ -176,8 +176,7 @@ yylex(YYSTYPE *s, void * v_l) %type box %type open_request_parens close_request_parens %type open_plet_parens close_plet_parens -%type music_chord music_chord_body init_music_chord -%type voice_elt full_element lyrics_elt command_elt +%type simple_element music_elt full_element lyrics_elt command_elt %type int %type script_dir %type declaration @@ -190,31 +189,27 @@ yylex(YYSTYPE *s, void * v_l) %type pitch_list %type midi_block midi_body %type duration_length -%type init_music -%type simple_horizontal_music horizontal_music horizontal_music_body -%type transposed_music_voice init_lyrics_voice -%type music_voice_body init_music_voice +%type init_melodic init_lyrics init_music +%type Music transposed_music +%type Voice Voice_body +%type Chord Chord_body %type paper_block paper_body %type dim real %type unit %type post_request pre_request command_req verbose_command_req abbrev_command_req -%type pure_post_request pure_post_request_choice -%type script_req textscript_req dynamic_req +%type script_req dynamic_req %type score_block score_body -%type