From: Han-Wen Nienhuys Date: Sat, 13 Sep 1997 22:22:31 +0000 (+0200) Subject: release: 0.1.14 X-Git-Tag: release/0.1.14 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2181534bd94587fcac8f1769f2dda7bece693649;p=lilypond.git release: 0.1.14 --- diff --git a/AUTHORS.text b/AUTHORS.text index 3c7e95d0a0..7de007d522 100644 --- a/AUTHORS.text +++ b/AUTHORS.text @@ -37,6 +37,9 @@ CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSS +o Werner Lemberg , misc bugfixes, some Beam and Stem code. + +o Donald Ervin Knuth, mf/ital-*.mf (these were taken + from the CM fonts) + +o Alexandre Oliva , testing +o Anthony Fok , debian @@ -58,9 +61,6 @@ CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSS - - - -11/Sep/97 LilyPond 0.1.13 1 +11/Sep/97 LilyPond 0.1.14 1 diff --git a/Documentation/AUTHORS.pod b/Documentation/AUTHORS.pod index c910644bfa..313befdca0 100644 --- a/Documentation/AUTHORS.pod +++ b/Documentation/AUTHORS.pod @@ -47,6 +47,10 @@ Beam and Stem code. =item * +Donald Ervin Knuth, mf/ital-*.mf (these were taken from the CM fonts) + +=item * + Alexandre Oliva , testing =item * diff --git a/Documentation/index.pod b/Documentation/index.pod index 9a36c9f3fb..767db76fe2 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -11,9 +11,9 @@ TeX file and and (mechanical) performances to MIDI files. This is not a Fanmail/Hype page. These pages were entirely created from the LilyPond package-sources. -B. You can look at the bottom if you want to -know which version this was. +Note: These pages are created from the latest B +of LilyPond. You can look at the bottom if you want to know which +version this was. =head2 Examples diff --git a/Documentation/mudela-course.doc b/Documentation/mudela-course.doc index 196ea9d1b0..3b0d0f8dcd 100644 --- a/Documentation/mudela-course.doc +++ b/Documentation/mudela-course.doc @@ -184,19 +184,19 @@ etc. \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; + \multi 1 < { c2 c2 } { c'2 c'2 } > + \multi 2 < { \stemdown c2 c2 } { \stemup c'2 c'2 } > + \multi 3 < { \clef "bass"; c2 c2 } { \meter 2/4;\bar "||"; \key fis cis gis; c'2 c'2 } > c2 c1 c1 c1 - < \multi 1; < \multi 3; - { \meter 2/4; \clef "violin"; c2 c2 } + \multi 1< \multi 3 < + { \meter 2/4; \clef "violin"; c2 c2 } { \meter 2/4; \clef "bass"; c2 c2 } > - < \multi 3; + \multi 3 < { \meter 2/4; \clef "violin"; c2 c2 } { \meter 2/4; \clef "bass"; c2 c2 } > @@ -215,50 +215,52 @@ handled graciously (well, somewhat). If the noteheads of different voices collide, they are moved horizontally. Rests are moved vertically. -\begin[verbatim]{mudela} +[FIXME] +\def\bla{ +\begin[verbatim]{mudelaXX} two_voice = \melodic - < \multi 2; - { \octave c'; \stem -1; + \multi 2 < + { \octave c'; \stemdown c4 d e f g2~ g4 a [c8 d e f] c2| } - { \stem 1; + { \stemup g4 f e g ~ g2 g2 c4 g4 g2 } > two_voice_steminvert = \melodic - < \multi 2; - { \octave c'; \stem 1; + \multi 2 < + { \octave c'; \stemup % the f and g on 4th beat are exceptionally ugh. c4 d e f g2 g4 a | } - { \stem -1; + { \stemdown g4 f e g g2 g2 } > three_voice = \melodic - < \multi 2; - { \stem 1; + \multi 2 < + { \stemup g4 f e f g a g2 } - { \hshift 1; \stem 1; + { \property Voice.hshift = 1 \stemup e2 e2 e2 e2 } - { \stem -1; + { \stemdown c4 d e d c d es } > restsII = \melodic { \octave c'; - < \multi2; - { \stem 1; g'8 f' e' d' c' b a g f e d c } - { \stem -1; r r r r r r r r r r r r } + \multi2 < + { \stemup g'8 f' e' d' c' b a g f e d c } + { \stemdown r r r r r r r r r r r r } > r8 r4 - < \multi2; r8 r8 > - < \multi2; r8 r8 r8 > - < \multi2; r8 r8 r8 r8 > - < \multi2; r r > - < \multi2; r r r > - \stem 1; + \multi 2 < r8 r8 > + \multi 2 < r8 r8 r8 > + \multi 2 < r8 r8 r8 r8 > + \multi 2 < r r > + \multi 2 < r r r > + \stemup [c''8 r8 c''8 c''8] [c8 r8 c8 c8] } @@ -268,6 +270,5 @@ restsII = \melodic { \$three_voice \restsII } } -\end{mudela} - +} \end{document} diff --git a/INSTALL.text b/INSTALL.text index 2a831c9966..88723a48bb 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG -8/Aug/97 LilyPond 0.1.13 1 +8/Aug/97 LilyPond 0.1.14 1 @@ -127,7 +127,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -8/Aug/97 LilyPond 0.1.13 2 +8/Aug/97 LilyPond 0.1.14 2 @@ -193,7 +193,7 @@ INSTALL(1) LilyPond documentation INSTALL(1) -8/Aug/97 LilyPond 0.1.13 3 +8/Aug/97 LilyPond 0.1.14 3 @@ -259,7 +259,7 @@ IIIINNNNSSSSTTTTAAAALLLLLLLLIIIINNNNGGGG -8/Aug/97 LilyPond 0.1.13 4 +8/Aug/97 LilyPond 0.1.14 4 @@ -325,7 +325,7 @@ RRRREEEEDDDDHHHHAAAATTTT LLLLIIIINNNNUUUUXXXX -8/Aug/97 LilyPond 0.1.13 5 +8/Aug/97 LilyPond 0.1.14 5 @@ -391,6 +391,6 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS -8/Aug/97 LilyPond 0.1.13 6 +8/Aug/97 LilyPond 0.1.14 6 diff --git a/NEWS b/NEWS index 739797cd39..34ebe729b2 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,32 @@ -pl 13.jcn2 +pl 14 + - Simple but nifty mudela-mode.el for Emacs + - slightly better syntax for single-note-repeat, now default kept in +Stem_engraver + - bf: Abbrev_beams are not the only beams (see: jcn4, stem-info, thanks, Jan) + - a CPU timer for Interpreting and Breaking + - Separate Score_elem: + * invoke-once stuff in Super_elem (using function pointers; much cleaner now) + * geometrical stuff into Graphical_element + * Axis_group_* accept Graphical_elements iso. Score_elems + * A dimension cache, hopefully this makes lily a bit faster + * TeX output moved out of Score_elem, separate interface Outputter + + - < \multi 2; bla > -> \multi 2 < bla > (mudela 0.1.6) + - bf: don't do \multi if \type specified + - Translator switching: Change_translator, Change_iterator + + +pl 12.jcn4 + - fixed dynamic f, magstep bug - gaps on abbrev-beams - bf: stem-info - bf: last abbrev - bf: stem: do_width - bf: removed rest-column.hh +******* +sep 11 + pl 13 - big Rest/notehead rewrite: * separated Rest, Note_head and Dots @@ -36,8 +58,6 @@ by the parser (mudela 0.1.4) - Molecule::add_XXXX -> Molecule::add_at_edge () - doco updeet: why no midi FAQ, index, CodingStyle hungarian -pl 12.jcn4 - - fixed dynamic f, magstep bug pl 12.jcn3 - try at better dynamic font, copied from cmbxti10: mf/* diff --git a/README b/README index 331108b90f..6b8828bc88 100644 --- a/README +++ b/README @@ -24,7 +24,7 @@ MusixTeX-fonts. Please refer to the installation instructions on how to obtain and install them. -3. INSTALLATINON +3. INSTALLATION For your convenience, a formatted copy of the INSTALL instructions are in the toplevel directory, as INSTALL.text diff --git a/TODO b/TODO index ac8a74e7d6..47cd313b81 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,8 @@ 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 + - bf: abbrevs over whole note + * use properties for: - Text_style - default_octave @@ -49,8 +51,7 @@ PROJECTS * \header - revise lexer mode - write perl script for handling it into databases - - * emacs-mode for mudela + - write TeX macros to generate titles * Makefile stuff: - have make dist produce tarball in out/ directory. @@ -100,7 +101,7 @@ languages: ****************** \score { < - \melodic { \id "Staff" ""; c'4 g'4 } + \melodic \type Staff { c'4 g'4 } \lyric { \id "Lyric" ""; hello4 bye4 < a chord > } \lyric { \id "Lyric" ""; bye4 hello4 } \melodic { \id "Staff" ""; c'4 g'4 } @@ -337,9 +338,6 @@ SMALLISH PROJECTS IDEAS - * scoping in Lexer: do general id- assignments in mudela. - - ID '=' EXPR; * create libmudela, or liblily_frontend @@ -395,7 +393,6 @@ IDEAS * lyrics in chords still fuck up. - * - rewire acknowledge_element() logic with a process_acknowledged() * pushgroup/popgroup @@ -405,3 +402,7 @@ IDEAS * multi threading? - 1 thread per element/ 1 thread per line - 1 thread per Translator + + * Use hooks/dependency graphs for properties + + * Make general "spanning"-elements and "placer"-elements diff --git a/VERSION b/VERSION index 1ac534dd99..b32b21946e 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 1 -TOPLEVEL_PATCH_LEVEL = 13 +TOPLEVEL_PATCH_LEVEL = 14 # use to send patches, always empty for released version: -TOPLEVEL_MY_PATCH_LEVEL = .jcn2 +TOPLEVEL_MY_PATCH_LEVEL = diff --git a/bin/convert-mudela.in b/bin/convert-mudela.in index 530e7818f2..1efde362a5 100644 --- a/bin/convert-mudela.in +++ b/bin/convert-mudela.in @@ -125,6 +125,12 @@ sub convert_0_1_4_to_0_1_5 s/([<{]) *\\id (.+) (.+);/\\type $2 = $3 $1/; } + +sub convert_0_1_5_to_0_1_6 +{ + s/< *\\multi (.*);/\\multi $1 \&no_conv, "0.1.2" => \&no_conv, "0.1.3" => \&convert_0_1_2_to_0_1_3, "0.1.4" => \&no_conv, - "0.1.5" => \&convert_0_1_4_to_0_1_5 + "0.1.5" => \&convert_0_1_4_to_0_1_5, + "0.1.6" => \&convert_0_1_5_to_0_1_6 ); diff --git a/bin/make-website.in b/bin/make-website.in index aa1eda0b1d..98b49fd31d 100644 --- a/bin/make-website.in +++ b/bin/make-website.in @@ -84,7 +84,7 @@ local @examples=("twinkle-pop", "twinkle", "multi", "wtk1-fugue2", "toccata-fuga-E", "scsii-menuetto", "cadenza", "scales", - #"rhythm", + "rhythm", "gallina"); @@ -146,7 +146,7 @@ files have been scaled to eliminate aliasing."; $name=$a; print HTMLLIST "

example file: $name

\n\n"; open IF, "$depth/input/$a.ly"; - input_record_separator IF "%}"; + input_record_separator IF "\n}"; $desc = <IF>; close IF; diff --git a/flower/NEWS b/flower/NEWS index a53c1a4751..7d080f2cd1 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,3 +1,5 @@ +pl 30 + - Cpu_timer pl 29 - Dictionary_iter, Dictionary diff --git a/flower/VERSION b/flower/VERSION index da049c7e3c..ab5a2361a9 100644 --- a/flower/VERSION +++ b/flower/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 28 +PATCH_LEVEL = 30 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/cpu-timer.cc b/flower/cpu-timer.cc new file mode 100644 index 0000000000..e10985eee9 --- /dev/null +++ b/flower/cpu-timer.cc @@ -0,0 +1,26 @@ +/* + cpu-timer.cc -- implement Cpu_timer + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "cpu-timer.hh" + +Cpu_timer::Cpu_timer () +{ + restart (); +} +void +Cpu_timer::restart () +{ + start_clock_ = clock (); +} + +Real +Cpu_timer::read () +{ + clock_t stop = clock (); + return (stop-start_clock_)/Real(CLOCKS_PER_SEC); +} diff --git a/flower/include/cpu-timer.hh b/flower/include/cpu-timer.hh new file mode 100644 index 0000000000..3205c42b35 --- /dev/null +++ b/flower/include/cpu-timer.hh @@ -0,0 +1,24 @@ +/* + cpu-timer.hh -- declare Cpu_timer + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef CPU_TIMER_HH +#define CPU_TIMER_HH + +#include <time.h> +#include "real.hh" + +class Cpu_timer { + clock_t start_clock_; +public: + Cpu_timer (); + void restart (); + Real read (); +}; + +#endif // CPU_TIMER_HH diff --git a/flower/include/timer.hh b/flower/include/timer.hh new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/flower/include/timer.hh @@ -0,0 +1 @@ + diff --git a/flower/lgetopt.cc b/flower/lgetopt.cc index d8f18fd5ab..8e9fd408dd 100644 --- a/flower/lgetopt.cc +++ b/flower/lgetopt.cc @@ -13,8 +13,8 @@ Getopt_long::argument_to_i() { long l; if (!optional_argument_ch_C_ - || sscanf (optional_argument_ch_C_, "%ld", &l) != 1) - report (E_ILLEGALARG); + || sscanf (optional_argument_ch_C_, "%ld", &l) != 1) + report (E_ILLEGALARG); return l; } @@ -31,19 +31,19 @@ Getopt_long::parselong() found_option_l_=0; for (int i=0; i< table_len_i_; i++) { - char const *ln = option_a_[i].longname; + char const *ln = option_a_[i].longname; - if (ln && !strncmp (ln, optnm, searchlen)) - { - found_option_l_ = option_a_+i; - break; - } - } + if (ln && !strncmp (ln, optnm, searchlen)) + { + found_option_l_ = option_a_+i; + break; + } + } if (!found_option_l_) { - report (E_UNKNOWNOPTION); - return 0; + report (E_UNKNOWNOPTION); + return 0; } array_index_i_++; argument_index_i_ = 0; @@ -51,22 +51,22 @@ Getopt_long::parselong() if (found_option_l_->take_arg) { - if (endopt) - optional_argument_ch_C_ = endopt +1; // a '=' - else - { - optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_]; - array_index_i_++; - } - if (!optional_argument_ch_C_) - report (E_ARGEXPECT); + if (endopt) + optional_argument_ch_C_ = endopt +1; // a '=' + else + { + optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_]; + array_index_i_++; + } + if (!optional_argument_ch_C_) + report (E_ARGEXPECT); } else { - optional_argument_ch_C_ = 0; - if (endopt) - report (E_NOARGEXPECT); + optional_argument_ch_C_ = 0; + if (endopt) + report (E_NOARGEXPECT); } return found_option_l_; @@ -77,11 +77,11 @@ void Long_option_init::printon (ostream &errorout) const { if (shortname) - errorout <<"-" << shortname; + errorout <<"-" << shortname; if (shortname && longname) - errorout << ", "; + errorout << ", "; if (longname) - errorout << "`--" << longname << "'"; + errorout << "`--" << longname << "'"; } // report an error, GNU style. @@ -90,35 +90,35 @@ Getopt_long::report (Errorcod c) { error_ = c; if (!error_ostream_l_) - return; + return; *error_ostream_l_ << arg_value_ch_a_a_[0] << ": "; switch (c) { - case E_ARGEXPECT: - *error_ostream_l_<< "option "; - found_option_l_->printon (*error_ostream_l_); - *error_ostream_l_ << "requires an argument"<<endl; - break; - case E_NOARGEXPECT: - *error_ostream_l_ << "option `--" << - found_option_l_->longname << "' does not allow an argument"<<endl; - break; + case E_ARGEXPECT: + *error_ostream_l_<< "option "; + found_option_l_->printon (*error_ostream_l_); + *error_ostream_l_ << "requires an argument"<<endl; + break; + case E_NOARGEXPECT: + *error_ostream_l_ << "option `--" << + found_option_l_->longname << "' does not allow an argument"<<endl; + break; - case E_UNKNOWNOPTION: - *error_ostream_l_ << "unrecognized option "; - if (argument_index_i_) - *error_ostream_l_ << "-" << arg_value_ch_a_a_[array_index_i_][argument_index_i_] << endl; - else - *error_ostream_l_ << arg_value_ch_a_a_[array_index_i_] << endl; + case E_UNKNOWNOPTION: + *error_ostream_l_ << "unrecognized option "; + if (argument_index_i_) + *error_ostream_l_ << "-" << arg_value_ch_a_a_[array_index_i_][argument_index_i_] << endl; + else + *error_ostream_l_ << arg_value_ch_a_a_[array_index_i_] << endl; - break; - case E_ILLEGALARG: - *error_ostream_l_ << "illegal argument `" << optional_argument_ch_C_ << "\'to option "; - found_option_l_->printon (*error_ostream_l_); - *error_ostream_l_ << '\n'; - default: - assert (false); + break; + case E_ILLEGALARG: + *error_ostream_l_ << "illegal argument `" << optional_argument_ch_C_ << "\'to option "; + found_option_l_->printon (*error_ostream_l_); + *error_ostream_l_ << '\n'; + default: + assert (false); } exit (2); } @@ -131,23 +131,23 @@ Getopt_long::parseshort() assert (c); for (int i=0; i < table_len_i_; i++) - if (option_a_[i].shortname == c) - { - found_option_l_ = option_a_+i; - break; - } + if (option_a_[i].shortname == c) + { + found_option_l_ = option_a_+i; + break; + } if (!found_option_l_) { - report (E_UNKNOWNOPTION); - return 0; + report (E_UNKNOWNOPTION); + return 0; } argument_index_i_++; if (!found_option_l_->take_arg) { - optional_argument_ch_C_ = 0; - return found_option_l_; + optional_argument_ch_C_ = 0; + return found_option_l_; } optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_] + argument_index_i_; @@ -156,12 +156,12 @@ Getopt_long::parseshort() if (!optional_argument_ch_C_[0]) { - optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_]; - array_index_i_ ++; + optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_]; + array_index_i_ ++; } if (!optional_argument_ch_C_) { - report (E_ARGEXPECT); + report (E_ARGEXPECT); } return found_option_l_; @@ -171,35 +171,37 @@ const Long_option_init * Getopt_long::operator()() { if (!ok()) - return 0; + return 0; next(); + if (!ok ()) + return 0; if (argument_index_i_) - return parseshort(); + return parseshort(); const char * argument_C = arg_value_ch_a_a_[array_index_i_]; if (argument_C[0] != '-') - return 0; + return 0; if (argument_C[1] == '-') {// what to do with "command -- bla" - if (argument_C[2]) - return parselong(); - else - return 0; - } + if (argument_C[2]) + return parselong(); + else + return 0; + } else { - if (argument_C[ 1 ]) - { - argument_index_i_ = 1; - return parseshort(); - } - else - { - return 0; - } + if (argument_C[ 1 ]) + { + argument_index_i_ = 1; + return parseshort(); + } + else + { + return 0; + } } } @@ -215,7 +217,7 @@ Getopt_long::Getopt_long (int c, char **v, Long_option_init *lo) // reached end of option table? table_len_i_ =0; for (int i = 0; option_a_[i].longname ||option_a_[i].shortname; i++) - table_len_i_ ++; + table_len_i_ ++; } bool @@ -229,10 +231,10 @@ Getopt_long::next() { error_ = E_NOERROR; while (array_index_i_ < argument_count_i_ - && !arg_value_ch_a_a_[array_index_i_][argument_index_i_]) - { - array_index_i_++; - argument_index_i_ = 0; + && !arg_value_ch_a_a_[array_index_i_][argument_index_i_]) + { + array_index_i_++; + argument_index_i_ = 0; } } @@ -240,7 +242,7 @@ char const * Getopt_long::current_arg() { if (array_index_i_ >= argument_count_i_) - return 0; + return 0; char const * a = arg_value_ch_a_a_[array_index_i_]; return a + argument_index_i_; } @@ -251,8 +253,8 @@ Getopt_long::get_next_arg() char const * a = current_arg(); if (a) { - array_index_i_ ++; - argument_index_i_= 0; + array_index_i_ ++; + argument_index_i_= 0; } return a; } diff --git a/init/performer.ly b/init/performer.ly index a45e0ce271..90b3688412 100644 --- a/init/performer.ly +++ b/init/performer.ly @@ -9,7 +9,6 @@ Staff = \translator { \consists "Meter_performer"; } - Thread =\translator { \type "Performer_group_performer"; @@ -40,12 +39,19 @@ Lyrics = \translator { \consists "Meter_performer"; } +Staff_group = \translator +{ + \type Performer_group_performer; + \accepts Staff; +} + Score = \translator { \type "Score_performer"; instrument = piano; \accepts Staff; \accepts Grandstaff; \accepts Lyrics; + \accepts Staff_group; \consists "Swallow_performer"; } diff --git a/init/symbol.ly b/init/symbol.ly index 445a8a7a64..2ca0c7f7d9 100644 --- a/init/symbol.ly +++ b/init/symbol.ly @@ -1,6 +1,6 @@ % symbol.ly -\version "0.1.5"; +\version "0.1.6"; breve = \duration { -1 0 } longa = \duration { -2 0 } diff --git a/init/table16.ly b/init/table16.ly index 0642176070..265098ce17 100644 --- a/init/table16.ly +++ b/init/table16.ly @@ -7,9 +7,7 @@ table_sixteen= \symboltables { - \texid "\input lilyponddefs \musixsixteendefs" - % index TeXstring, xmin xmax ymin ymax "scripts" = \table { @@ -156,16 +154,16 @@ table_sixteen= } "flags" = \table { - "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 + "u3" "\eighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "u4" "\sixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "u5" "\thirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "u6" "\sixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "u7" "\hundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "d3" "\deighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "d4" "\dsixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "d5" "\dthirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "d6" "\dsixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "d7" "\dhundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt } "beamslopes" = \table { diff --git a/input/abbrev.ly b/input/abbrev.ly index 4c91009e0e..2ea0b483ce 100644 --- a/input/abbrev.ly +++ b/input/abbrev.ly @@ -1,22 +1,17 @@ -%{MudelaHeader - - filename: abbrev.ly - title: - description: - composer(s): - entered-by: jcn - copyright: PD - - Tested Features: simple abbreviations -EndMudelaHeader -%} +\header{ +enteredby jcn +copyright PD +TestedFeatures simple abbreviations +} -\version "0.1.5"; +\version "0.1.6"; \score{ \melodic{ \octave c''; \meter 4/4; + % default abbreviations + c4 c4: c4:32 c4: c4 c2. 'a1 'a1:32 'c4:8 c' 'c4:16 c' diff --git a/input/beams.ly b/input/beams.ly index 2b815e3b47..8dffc79edb 100644 --- a/input/beams.ly +++ b/input/beams.ly @@ -10,10 +10,10 @@ Tested Features: beams and beamflags EndMudelaHeader %} -\version "0.1.5" +\version "0.1.6" \score{ - \melodic <\multi 3; + \melodic \multi 3 < { \octave c'; \meter 8/4; \duration8; diff --git a/input/cadenza.ly b/input/cadenza.ly index fc143d0287..7127940dd4 100644 --- a/input/cadenza.ly +++ b/input/cadenza.ly @@ -11,7 +11,7 @@ copyright public domain Tested Features: cadenza mode %} -\version "0.1.5"; +\version "0.1.6"; cad = \melodic { diff --git a/input/collisions.ly b/input/collisions.ly index c65800b961..15f5b3969e 100644 --- a/input/collisions.ly +++ b/input/collisions.ly @@ -10,12 +10,12 @@ Tested Features:test the Collision resolution EndMudelaHeader %} -\version "0.1.5"; +\version "0.1.6"; two_voice = \melodic - < \multi 2; + \multi 2 < { \stemdown \octave c'; c4 d e f g2~ g4 a [c8 d e f] c2| } { \stemup @@ -24,7 +24,7 @@ two_voice = \melodic > two_voice_steminvert = \melodic - < \multi 2; + \multi 2 < { \octave c'; \stemup % the f and g on 4th beat are exceptionally ugh. @@ -35,7 +35,7 @@ two_voice_steminvert = \melodic > three_voice = \melodic - < \multi 2; + \multi 2 < { \stemup g4 f e f g a g2 } { \stemup \property Voice.hshift = 1 @@ -46,7 +46,7 @@ three_voice = \melodic rests = \melodic - < \multi 2; + \multi 2 < { \stemup | r8 r r r r r r r [c' b a g] [f e d c] @@ -59,20 +59,20 @@ rests = \melodic restsII = \melodic { \octave c'; - < \multi2; + \multi 2 < { \stemup g' f' e' d' c' b a g f e d c } { \stemdown r r r r r r r r r r r r } > - < \multi2; + \multi 2 < { \stemup r r r r r r r r r r r r } { \stemdown c d e f g a b c' d' e' f' g' } > r8 r4 - < \multi2; r8 r8 > - < \multi2; r8 r8 r8 > - < \multi2; r8 r8 r8 r8 > - < \multi2; r r > - < \multi2; r r r > + \multi 2 < r8 r8 > + \multi 2 < r8 r8 r8 > + \multi 2 < r8 r8 r8 r8 > + \multi 2 < r r > + \multi 2 < r r r > \stemup [c''8 r8 c''8 c''8] [c8 r8 c8 c8] diff --git a/input/coriolan-alto.ly b/input/coriolan-alto.ly index 62d21690ba..8fd27dd47e 100644 --- a/input/coriolan-alto.ly +++ b/input/coriolan-alto.ly @@ -17,7 +17,7 @@ EndMudelaHeader % (maybe even sooner :-) % -\version "0.1.5"; +\version "0.1.6"; alto = \melodic{ diff --git a/input/gallina.ly b/input/gallina.ly index 9c0498c412..c13e9fdbf6 100644 --- a/input/gallina.ly +++ b/input/gallina.ly @@ -39,7 +39,7 @@ part of the basso continuo %} -\version "0.1.5"; +\version "0.1.6"; vi1=\melodic{ \meter 4/4; @@ -221,7 +221,7 @@ bc=\melodic{ } \score{ - < \multi 3; + \type Staff_group < \vi1 \vi2 \bc diff --git a/input/keys.ly b/input/keys.ly index 1c3b99bd6d..da9286456c 100644 --- a/input/keys.ly +++ b/input/keys.ly @@ -10,7 +10,7 @@ Tested Features: local key, key, forced accidentals EndMudelaHeader %} -\version "0.1.5"; +\version "0.1.6"; blah = \melodic{ diff --git a/input/kortjakje.ly b/input/kortjakje.ly index 924c84a979..fb1eec4e06 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -11,7 +11,7 @@ copyright public domain Tested Features: example file with comments %} -\version "0.1.5"; +\version "0.1.6"; % the % is a comment. diff --git a/input/multi.ly b/input/multi.ly index 8270bfd809..0ee5fb1405 100644 --- a/input/multi.ly +++ b/input/multi.ly @@ -10,21 +10,24 @@ Tested Features: \multi %} -\version "0.1.5"; +\version "0.1.6"; \score{ \melodic { \octave c'; c4 c4 - < \multi 1; { c2 c2 } { c'2 c'2 } > - < \multi 2; { \stemdown c2 c2 } { \stemup c'2 c'2 } > - < \multi 3; { \clef "bass"; c2 c2 } { \meter 2/4;\bar "||"; \key fis cis gis; c'2 c'2 } > + \multi 1 < { c2 c2 } { c'2 c'2 } > + \multi 2 < { \stemdown c2 c2 } { \stemup c'2 c'2 } > + \multi 3 < { \clef "bass"; c2 c2 } + { \meter 2/4;\bar "||"; + \key fis cis gis; c'2 c'2 } +> c2 c1 c1 c1 - < \multi 1; < \multi 3; + \multi 1 < \multi 3 < { \meter 2/4; \clef "violin"; c2 c2 } { \meter 2/4; \clef "bass"; c2 c2 } > - < \multi 3; + \multi 3 < { \meter 2/4; \clef "violin"; c2 c2 } { \meter 2/4; \clef "bass"; c2 c2 } > diff --git a/input/pedal.ly b/input/pedal.ly index 2827ed2bed..cb22bd22d9 100644 --- a/input/pedal.ly +++ b/input/pedal.ly @@ -24,7 +24,7 @@ % \lbheel \lbheel \lfheel \lftoe % \rbheel \rbtoe \rfheel \rftoe -\version "0.1.5"; +\version "0.1.6"; \score{ \melodic { diff --git a/input/rhythm.ly b/input/rhythm.ly index ef4481d1f8..cc1511bf16 100644 --- a/input/rhythm.ly +++ b/input/rhythm.ly @@ -7,7 +7,7 @@ TestedFeatures multiple meters, beaming, unsynced bars, userdefd engravers -\version "0.1.5"; +\version "0.1.6"; ritme = \melodic{ %\octave ; \partial 8; @@ -49,7 +49,7 @@ yanother = \score{ - < \multi 3; + \type Staff_group < \ritme \another \yanother @@ -79,6 +79,7 @@ yanother = %% add Timing_engraver to the staff Staff = \translator { \type "Engraver_group_engraver"; + defaultclef= violin; \consists "Timing_engraver"; \consists "Bar_engraver"; diff --git a/input/scales.ly b/input/scales.ly index 64acc42bea..e1736b9f77 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -12,7 +12,7 @@ EndMudelaHeader % scales with accents. % -\version "0.1.5"; +\version "0.1.6"; blah = \melodic { \meter 6/8; \octave 'c ; diff --git a/input/scripts.ly b/input/scripts.ly index b4e95203c4..1209028127 100644 --- a/input/scripts.ly +++ b/input/scripts.ly @@ -10,7 +10,7 @@ Tested Features: scripts, text. EndMudelaHeader %} -\version "0.1.5"; +\version "0.1.6"; blah = \melodic { diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly index 247cf7901b..4e3590437c 100644 --- a/input/scsii-menuetto.ly +++ b/input/scsii-menuetto.ly @@ -13,7 +13,7 @@ copyright public domain Tested Features:breaking algorithm, chords, multivoice, accents %} -\version "0.1.5"; +\version "0.1.6"; %% Stuff from MPP version % \lefttitle{Menuetto} @@ -60,14 +60,14 @@ IImenuetto = \melodic{ %%10 < [ e'8 g8 > d' cis'_"2" e' a~ g8 ] | %%11 - < \multi 2; + \multi 2 < {\stemup a4~ d'4 cis'4-. } { \stemdown f2 e4 } > | %%12 < [ g'8^"4" d8 > f' e' f' d'^"3"~ c' ] | %%13 \clef "alto"; - < \multi 2; + \multi 2 < { \stemup bes2 c'4 } { \stemdown g4~ f4 e4 }% ugh > | @@ -86,9 +86,9 @@ IImenuetto = \melodic{ %%20 < { [ c'8 ( bes8 a8 )bes g~ bes8 ] } d8 g8 > | %%21 - < \multi 2; - {\stemup d'4 (\stemup ) cis'4 d'4 } - { \stemdown g2 f4 } + \multi 2 < + {\stemup d'4( \stemup )cis'4 d'4 } + { \stemdown g2 f4 } > | %%22 < { [ g8 ~ f8 g8 e8 ] } cis8 > < f4 d4 > | diff --git a/input/slurs.ly b/input/slurs.ly index 4fe7e54186..e7ddad01ee 100644 --- a/input/slurs.ly +++ b/input/slurs.ly @@ -11,7 +11,7 @@ EndMudelaHeader %} -\version "0.1.5"; +\version "0.1.6"; \score{ \melodic{\octave c'; @@ -28,7 +28,7 @@ EndMudelaHeader < { c ~ d } { e ~ f } > - < \multi 2; + \multi 2 < { \stemup c'8 ~g ~e( ~c~ [c'~ g' e' )c'] c'' ~ c'' c~c } { \stemdown c (e g )c'~( [b a g )d] r2 } > diff --git a/input/standchen.ly b/input/standchen.ly index ba5f3d8241..bbe4c65570 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -13,7 +13,7 @@ copyright public domain multiple \paper{}s in one \score %} -\version "0.1.5"; +\version "0.1.6"; commands = \melodic{ \skip 2.*4; @@ -202,7 +202,7 @@ begeleiding = \melodic{ ''a r4 | %%5 \duration 8; - < \multi 2; { \stemup + \multi 2 < { \stemup [ 'f 'a d 'a d 'a ] [ 'd 'e 'g 'e 'g 'e ] [ 'cis 'e 'g 'e 'g 'e ] @@ -220,7 +220,7 @@ begeleiding = \melodic{ %%10 [ 'd 'a d 'a d 'a ] | %%11 - < \multi 2; + \multi 2 < { \stemup [ 'f 'a d 'a d 'a ] [ 'd 'e 'g 'e 'g 'e ] @@ -237,7 +237,7 @@ begeleiding = \melodic{ [ 'c 'g 'bes 'g 'bes 'g ] | %%16 [ ''f 'c 'f 'c 'f 'c ] | - < \multi 2; + \multi 2 < { \stemup [ ''a 'e 'g 'e 'g 'e ][ 'd 'a d 'a d 'a ] [ ''bes 'f 'bes 'f 'bes 'f ][ ''f 'c 'f 'c 'f 'c ] } @@ -252,7 +252,7 @@ begeleiding = \melodic{ < [ 'e 'c > 'g c 'g c 'g ] | %%22 [ 'f 'a c 'a 'f 'c ] | - < \multi 2; { + \multi 2 < { \stemup [ ''a 'e 'g 'e 'g 'e ] [ 'd 'fis 'a 'fis 'a 'fis ] @@ -305,7 +305,7 @@ begeleiding = \melodic{ %%44 < [ 'd ''b > 'fis 'b 'fis 'b 'fis ] | %%45 - < \multi 2; { \stemup + \multi 2 < { \stemup [ ''g 'd 'b 'd 'b 'd ] [ 'd 'a d 'a d 'a ] } { @@ -479,7 +479,6 @@ themusic = \tekstII > \type Grandstaff < - \multi 2; \melodic < \melodie \commands > \melodic < \begeleiding \commands > > diff --git a/input/toccata-fuga-E.ly b/input/toccata-fuga-E.ly index 1702aef9d0..cb1f2fc770 100644 --- a/input/toccata-fuga-E.ly +++ b/input/toccata-fuga-E.ly @@ -1,5 +1,4 @@ \header{ - filename toccata-fuga-E.ly title toccata and fuga in E-major opus BWV 566 @@ -21,7 +20,7 @@ copyright public domain %} -\version "0.1.5"; +\version "0.1.6"; toccata_commands = \melodic{ \meter 4/4; @@ -32,7 +31,7 @@ toccata_right = \melodic{ \$toccata_commands % 13 -- how to type -- where to split -- this more neatly ? \octave c'; - <\multi 2; + \multi 2 < { \stemup r4 dis'4 e'4.-. e'8( | \property Voice.hshift = 1 )e'4 [d'8 fis'8] \property Voice.hshift = 0 gis'4 [gis'8 fis'16 e'16] | fis'4~ [fis'8 e'16 dis'16] e'4 r8 e'8 } { \stemup \property Voice.hshift = 1 r4 bis4 cis'4-. cis'4 | \property Voice.hshift = 0 a'4~ [a'16 gis'16 a'16 b'16] \property Voice.hshift = 1 dis'4 cis'4~ [cis'8 dis'16 a16] bis4 cis'4 r8 b8 } { \stemdown r4 < gis4 fis4 dis4 > gis4-. gis4 | a4. cis'8 gis2 | fis4 gis4 gis4 r8 e8 } @@ -45,7 +44,7 @@ toccata_left = \melodic{ \octave c; \clef bass; % 13 - <\multi 2; + \multi 2 < { \stemup bis2 cis'4-. cis'4~ [cis'8 a8 d'8 cis'8] [bis8 gis8] cis'4 | dis'2 cis'4 r8 cis'8 } { \stemup \property Voice.hshift = 1 r4 gis4. gis8~ gis4 | \stemdown \property Voice.hshift = 0 a4. fis8 gis4. a8~ a4 gis4-. gis4 r8 gis8 } { \stemdown r4 < dis4 fis4 > < cis4 e4 > } @@ -76,7 +75,7 @@ fuga2_right = \melodic{ \clef violin; % 15 \octave c'; - <\multi 2; + \multi 2 < { \stemup [b8 fis8] b4 } { \stemdown fis2 } > @@ -88,14 +87,14 @@ fuga2_right = \melodic{ |x | %} - < \multi 2; + \multi 2 < { \stemup \property Voice.hshift = 0 e'4 } { \stemup \property Voice.hshift = 1 cis'4 } { \stemup \property Voice.hshift = 2 ais4 } { \stemdown fis4 } > | % 16 - <\multi 2; + \multi 2 < { \stemup dis'2 dis'4 | cis'2 cis'4 | b4~ [b8 cis'8 dis'8 e'8] } { \stemup \property Voice.hshift = 1 [b8 fis8] b2~ [b8 a16 g16] a2 | a4 gis2 } { \stemdown fis2.~ fis2.~ fis4 e2 } @@ -109,7 +108,7 @@ fuga2_left = \melodic{ \clef bass; % 15 b2 - <\multi 2; + \multi 2 < { \stemup ais4 | bes2. } { \stemdown e4 | fis2 fis4 } > @@ -140,8 +139,8 @@ break = \melodic{ % these should be two separate scores... \score{ - < \multi 1; - \type Grandstaff = "" < \multi 3; + \multi 1 < + \type Grandstaff \multi 3 < {\toccata_right \break \fuga2_right } { \toccata_left \break \fuga2_left } > diff --git a/input/twinkle-pop.ly b/input/twinkle-pop.ly index 3f3fffccea..d6aa38a153 100644 --- a/input/twinkle-pop.ly +++ b/input/twinkle-pop.ly @@ -12,7 +12,7 @@ copyright public domain Tested Features lyrics and chords %} -\version "0.1.5"; +\version "0.1.6"; melodie = \melodic { \clef"violin"; diff --git a/input/twinkle.ly b/input/twinkle.ly index 52625da9bc..2ec9b40ee0 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -14,11 +14,12 @@ copyright public domain Tested Features: lyrics %} -\version "0.1.5"; +\version "0.1.6"; melody = \melodic{ \clef violin; \octave c'; + c4 c | g g | a a | g g | f f | e e | d d8.( e16 | )c2 | % :| @@ -121,12 +122,11 @@ textiii = \lyric{ \score{ < - \melodic < - \type Grandstaff - < \multi 2; \global - \melody > + \type Grandstaff < + < \global + \melody > < \global - \accompany > + \accompany > > % ugh diff --git a/input/wtk1-fugue1.ly b/input/wtk1-fugue1.ly index 53764efbd0..62a25c5338 100644 --- a/input/wtk1-fugue1.ly +++ b/input/wtk1-fugue1.ly @@ -11,7 +11,7 @@ copyright Public Domain %{ %} -\version "0.1.5"; +\version "0.1.6"; global = @@ -183,13 +183,12 @@ bass = \score { \melodic \type Grandstaff < - \multi 1; - < \multi 2; + \multi 2 < \global \soprane \tenor > - < \multi 2; + \multi 2 < \global \alt \bass diff --git a/input/wtk1-fugue2.ly b/input/wtk1-fugue2.ly index 92ce1d3a12..608ec4b873 100644 --- a/input/wtk1-fugue2.ly +++ b/input/wtk1-fugue2.ly @@ -12,7 +12,7 @@ copyright Public Domain Tested Features: stem direction, multivoice, forced accidentals. %} -\version "0.1.5"; +\version "0.1.6"; % should add \need{dutch.ini} for % correct parsing of note names @@ -157,21 +157,21 @@ bassdux = [F16 G] As4 [G16 F] Es4 r8 es | [d c g G] %% 30 - < \multi 2; - { \stemup c2~ | c1~ | c1 } - { \stemdown C2~ | C1~ | C1 } + \multi 2 < + { \stemup c2~ | c1~ | c1 } + { \stemdown C2~ | C1~ | C1 } > } \score { \melodic \type Grandstaff < - \type Staff=treble < \multi 2; + \type Staff=treble < \global \dux \comes > - \type Staff=bass < \multi 2; + \type Staff=bass < \global \bassdux > diff --git a/input/wtk1-prelude1.ly b/input/wtk1-prelude1.ly index 49ae054af7..060b5866a5 100644 --- a/input/wtk1-prelude1.ly +++ b/input/wtk1-prelude1.ly @@ -8,7 +8,7 @@ enteredby Shay Rojansky copyright Public Domain } -\version "0.1.5"; +\version "0.1.6"; global = \melodic { @@ -23,7 +23,7 @@ soprane = \clef "violin"; \octave c'; - <\multi 2; + \multi 2 < % Real soprane {\stemup r8 [g16 c'] [e' g c' e'] r8 [g16 c'] [e' g c' e'] | @@ -94,7 +94,7 @@ bass = b b | a a | %% 10 - <\multi 2; + \multi 2 < % Alt {\stemup r16 a8. ~ a4 r16 a8. ~ a4 | @@ -163,12 +163,11 @@ bass = \score { \melodic \type Grandstaff < - \multi 1; - < \multi 2; + < \global \soprane > - < \multi 2; + < \global \bass > diff --git a/lily/Stable.make b/lily/Stable.make index c6d2ee88d9..079e634ce3 100644 --- a/lily/Stable.make +++ b/lily/Stable.make @@ -1,7 +1,7 @@ # kept in dist bo stripping stable stuff, still to copy... # a bit of a hack to keep exec size under control. -stablecc=atom.cc bar.cc boxes.cc \ +stablecc=atom.cc offset.cc meter.cc boxes.cc \ keyword.cc leastsquares.cc \ lookup.cc meter.cc\ parser.cc notename-table.cc lexer.cc\ diff --git a/lily/VERSION b/lily/VERSION index deb594da78..7876a844d8 100644 --- a/lily/VERSION +++ b/lily/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 1 -PATCH_LEVEL = 13 +PATCH_LEVEL = 14 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf diff --git a/lily/axis-group-administration.cc b/lily/axis-group-administration.cc new file mode 100644 index 0000000000..5537d742a8 --- /dev/null +++ b/lily/axis-group-administration.cc @@ -0,0 +1,80 @@ +/* + axis-group.cc -- implement Axis_group_administration + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ +#include "interval.hh" +#include "axis-group-administration.hh" +#include "graphical-element.hh" +#include "debug.hh" + +/** don't copy anything: an element can only be in one + Axis_group_element at one time. */ +Axis_group_administration::Axis_group_administration (Axis_group_administration const&) +{ +} + +bool +Axis_group_administration::contains_b (Graphical_element const *e) const +{ + return elem_l_arr_.find_l (e); +} + +Interval +Axis_group_administration::extent (Axis axis) const +{ + Interval r; + for (int i=0; i < elem_l_arr_.size(); i++) + r.unite (elem_l_arr_[i]->extent (axis)); + return r; +} + +void +Axis_group_administration::add_element (Graphical_element*e, + Axis_group_element*g, Axis a1, Axis a2) +{ + Axis_group_element *& g1 = e->axis_group_l_a_[a1]; + Axis_group_element *& g2 = e->axis_group_l_a_[a2]; + + assert (!g1 || g1 == g); + assert (!g2 || g2 == g); + g1 = g; + g2 = g; + elem_l_arr_.push (e); +} + + + +void +Axis_group_administration::remove_element (Graphical_element*e, Axis a1, Axis a2) +{ + assert (contains_b (e)); + elem_l_arr_.unordered_substitute (e,0); + + e->axis_group_l_a_[a1] = 0; + e->axis_group_l_a_[a2] = 0; +} + +void +Axis_group_administration::remove_all (Axis a1, Axis a2) +{ + for (int i=0; i < elem_l_arr_.size(); i++) + { + Graphical_element*e=elem_l_arr_[i]; + e->axis_group_l_a_[a1] = 0; + e->axis_group_l_a_[a2] = 0; + } + elem_l_arr_.clear (); +} + + +void +Axis_group_administration::print() const +{ +#ifndef NPRINT + for (int i=0; i < elem_l_arr_.size(); i++) + DOUT << elem_l_arr_[i]->name () << ' '; +#endif +} diff --git a/lily/axis-group-element.cc b/lily/axis-group-element.cc new file mode 100644 index 0000000000..8ef35c0bea --- /dev/null +++ b/lily/axis-group-element.cc @@ -0,0 +1,59 @@ +/* + axis-group-element.cc -- implement Axis_group_element + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "axis-group-element.hh" + +void +Axis_group_element::do_unlink() +{ + remove_all(); +} + +void +Axis_group_element::do_junk_links() +{ + axis_admin_.elem_l_arr_.set_size (0); +} + + +bool +Axis_group_element::contains_b (Graphical_element const*e) const +{ + return axis_admin_.contains_b (e); +} + +Link_array<Score_elem> +Axis_group_element::get_extra_dependencies() const +{ + return elem_l_arr (); +} + +Link_array<Score_elem> +Axis_group_element::elem_l_arr () const +{ + /* + ugh. I know + */ + Link_array<Score_elem> r; + for (int i=0; i < axis_admin_.elem_l_arr_.size (); i++) + r.push ((Score_elem*)axis_admin_.elem_l_arr_[i]); + return r; +} + +void +Axis_group_element::do_print() const +{ + axis_admin_.print(); +} + + +Axis_group_element::Axis_group_element() +{ + transparent_b_ = true; +} + diff --git a/lily/axis-group-item.cc b/lily/axis-group-item.cc index d033d97571..f22332098b 100644 --- a/lily/axis-group-item.cc +++ b/lily/axis-group-item.cc @@ -13,7 +13,7 @@ IMPLEMENT_IS_TYPE_B2(Axis_group_item, Axis_group_element, Item); void Axis_group_item::OK() const { - Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; + Link_array<Score_elem> elems = elem_l_arr (); for (int i=0; i < elems.size(); i++) { Item * it_l = elems[i]->item(); @@ -31,7 +31,7 @@ Axis_group_item::do_breakable_col_processing() copy_breakable_items(); - Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; + Link_array<Score_elem> elems = elem_l_arr (); for (int i=0; i < elems.size(); i++) { Item* it_l = elems[i]->item(); @@ -51,4 +51,5 @@ void Axis_group_item::do_print() const { Axis_group_element::do_print(); + Item::do_print (); } diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc index 033a55b33a..42050ae5b4 100644 --- a/lily/axis-group-spanner.cc +++ b/lily/axis-group-spanner.cc @@ -17,7 +17,7 @@ void Axis_group_spanner::do_break_processing_if_unbroken() { - Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; + Link_array<Score_elem> elems = elem_l_arr (); Line_of_score *my_line = line_l(); for (int i=0; i < elems.size(); i++) { @@ -49,7 +49,7 @@ Axis_group_spanner::do_break_processing() } break_into_pieces (); - Link_array<Score_elem> loose_elems = axis_admin_.elem_l_arr_; + Link_array<Score_elem> loose_elems = elem_l_arr (); remove_all(); for (int i=0; i < loose_elems.size(); i++) diff --git a/lily/axis-group.cc b/lily/axis-group.cc deleted file mode 100644 index b0161fa2a4..0000000000 --- a/lily/axis-group.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* - axis-group.cc -- implement Axis_group_administration - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ -#include "interval.hh" -#include "axis-group-administration.hh" -#include "score-elem.hh" -#include "debug.hh" - -/** don't copy anything: an element can only be in one - Axis_group_element at one time. */ -Axis_group_administration::Axis_group_administration (Axis_group_administration const&) -{ -} - -bool -Axis_group_administration::contains_b (Score_elem const *e) const -{ - return elem_l_arr_.find_l (e); -} - -Interval -Axis_group_administration::extent (Axis axis) const -{ - Interval r; - for (int i=0; i < elem_l_arr_.size(); i++) - r.unite (elem_l_arr_[i]->extent (axis)); - return r; -} - -void -Axis_group_administration::add_element (Score_elem*e, - Axis_group_element*g, Axis a1, Axis a2) -{ - Axis_group_element *& g1=e->axis_group_l_a_[a1]; - Axis_group_element *& g2 = e->axis_group_l_a_[a2]; - - assert (!g1 || g1 == g); - assert (!g2 || g2 == g); - g1 = g; - g2 = g; - elem_l_arr_.push (e); -} - - - -void -Axis_group_administration::remove_element (Score_elem*e, Axis a1, Axis a2) -{ - assert (contains_b (e)); - elem_l_arr_.unordered_substitute (e,0); - - e->axis_group_l_a_[a1] = 0; - e->axis_group_l_a_[a2] = 0; -} - -void -Axis_group_administration::remove_all (Axis a1, Axis a2) -{ - for (int i=0; i < elem_l_arr_.size(); i++) - { - Score_elem*e=elem_l_arr_[i]; - e->axis_group_l_a_[a1] = 0; - e->axis_group_l_a_[a2] = 0; - } - elem_l_arr_.clear(); -} - - -void -Axis_group_administration::print() const -{ -#ifndef NPRINT - for (int i=0; i < elem_l_arr_.size(); i++) - DOUT << elem_l_arr_[i]->name() << ' '; -#endif -} diff --git a/lily/bar.cc b/lily/bar.cc index 7ba3f2d77b..43811f88c6 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -35,7 +35,7 @@ Bar::brew_molecule_p() const { Paper_def *p = paper(); Symbol s = p->lookup_l()->bar (type_str_, - p->get_var ("bar_size")); + p->get_var ("bar_size")); Molecule*output = new Molecule (Atom (s)); return output; } diff --git a/lily/beam-grav.cc b/lily/beam-grav.cc index bfaf3e12ac..68d798ae25 100644 --- a/lily/beam-grav.cc +++ b/lily/beam-grav.cc @@ -116,11 +116,7 @@ Beam_engraver::acknowledge_element (Score_elem_info i) */ current_grouping_p_->add_child (get_staff_info().time_C_->whole_in_measure_, rhythmic_req->duration ()); - /* - TODO - should change repr. of flags too. - */ - s->flag_i_ = Duration_convert::type2_i (rhythmic_req->duration_.durlog_i_); + s->flag_i_ = rhythmic_req->duration_.durlog_i_; beam_p_->add (s); } diff --git a/lily/beam.cc b/lily/beam.cc index a696c646ce..27825954b6 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -262,7 +262,7 @@ Beam::set_grouping (Rhythmic_grouping def, Rhythmic_grouping cur) { Stem *s = stems[j]; - int f = intlog2(abs (s->flag_i_))-2; + int f = s->flag_i_ - 2; assert (f>0); flags.push (f); } diff --git a/lily/boxes.cc b/lily/boxes.cc index 4a219a4864..1bf7177336 100644 --- a/lily/boxes.cc +++ b/lily/boxes.cc @@ -1,3 +1,11 @@ +/* + boxes.cc -- implement Box + + source file of the GNU LilyPond music typesetter + + (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include "boxes.hh" #include "varray.hh" diff --git a/lily/break-caching.cc b/lily/break-caching.cc deleted file mode 100644 index 8b13789179..0000000000 --- a/lily/break-caching.cc +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lily/break.cc b/lily/break.cc index 7f5139a831..5ee9de0a0b 100644 --- a/lily/break.cc +++ b/lily/break.cc @@ -14,6 +14,7 @@ #include "scoreline.hh" #include "p-score.hh" #include "p-col.hh" +#include "cpu-timer.hh" String Col_stats::str() const { @@ -163,7 +164,17 @@ Break_algorithm::OK() const Array<Col_hpositions> Break_algorithm::solve() const { - return do_solve(); + Cpu_timer timer; + + Array<Col_hpositions> h= do_solve(); + + if (approx_stats_.count_i_) + *mlog << "\nApproximated: " << approx_stats_.str() << "\n"; + if (exact_stats_.count_i_) + *mlog << "Calculated exactly: " << exact_stats_.str() << "\n"; + *mlog << "Time: " << String(timer.read (), "%.2f") << " seconds\n"; + + return h; } void @@ -172,11 +183,3 @@ Break_algorithm::do_set_pscore() } -void -Break_algorithm::print_stats() const -{ - if (approx_stats_.count_i_) - *mlog << "\nApproximated: " << approx_stats_.str() << "\n"; - if (exact_stats_.count_i_) - *mlog << "Calculated exactly: " << exact_stats_.str() << "\n"; -} diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc new file mode 100644 index 0000000000..c6ebf2907f --- /dev/null +++ b/lily/change-iterator.cc @@ -0,0 +1,43 @@ +/* + change-iterator.cc -- implement + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "change-iterator.hh" +#include "translator-group.hh" +#include "change-translator.hh" + +Change_iterator::Change_iterator (Change_translator *change_l) +{ + change_l_ = change_l; +} + +/* + move to construct_children ? + */ +void +Change_iterator::process_and_next (Moment m) +{ + Translator_group * current = report_to_l (); + Translator_group * last = 0; + while (current && current->type_str_ != change_l_->change_to_type_str_) + { + last = current; + current = current->daddy_trans_l_; + } + if (current) + { + Translator_group * dest = + report_to_l ()->find_create_translator_l (change_l_->change_to_type_str_, + change_l_->change_to_id_str_); + current->remove_translator_p (last); + dest->add (last); + } + + Music_iterator::process_and_next (m); +} + +IMPLEMENT_IS_TYPE_B1 (Change_iterator, Music_iterator); diff --git a/lily/change-translator.cc b/lily/change-translator.cc new file mode 100644 index 0000000000..be406c792d --- /dev/null +++ b/lily/change-translator.cc @@ -0,0 +1,19 @@ +/* + change-translator.cc -- implement Change_translator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "change-translator.hh" +#include "debug.hh" + +IMPLEMENT_IS_TYPE_B1(Change_translator,Music); + +void +Change_translator::do_print () const +{ + DOUT << "change " << change_to_type_str_ << " to " << change_to_id_str_ ; +} + diff --git a/lily/chord-iterator.cc b/lily/chord-iterator.cc index 80db90709c..83c5435ed6 100644 --- a/lily/chord-iterator.cc +++ b/lily/chord-iterator.cc @@ -26,13 +26,14 @@ void Chord_iterator::construct_children() { int j = 0; - for (PCursor<Music*> i (chord_C_->music_p_list_.top()); //, int j = 0; + for (PCursor<Music*> i (chord_C_->music_p_list_.top()); i.ok(); j++, i++) { - Music_iterator * mi = get_iterator_p (i.ptr()); + Music_iterator * mi = get_iterator_p (i.ptr()); if (mi->ok()) { - set_translator (mi->report_to_l()->ancestor_l (chord_C_->multi_level_i_)); + if (!chord_C_->translator_type_str_) + set_translator (mi->report_to_l()->ancestor_l (chord_C_->multi_level_i_)); children_p_list_.bottom().add (mi); } else diff --git a/lily/clef-grav.cc b/lily/clef-grav.cc index ad4814202c..5571327077 100644 --- a/lily/clef-grav.cc +++ b/lily/clef-grav.cc @@ -63,7 +63,7 @@ Clef_engraver::read_req (Clef_change_req*c_l) void Clef_engraver::acknowledge_element (Score_elem_info info) { - if (info.elem_l_->name() == Bar::static_name ()) + if (info.elem_l_->name() == Bar::static_name () && clef_type_str_) { create_clef(); if (!clef_req_l_) @@ -74,12 +74,11 @@ Clef_engraver::acknowledge_element (Score_elem_info info) void Clef_engraver::do_creation_processing() { - Scalar def = get_property ("defaultclef"); + Scalar def = get_property ("defaultclef"); if (def) set_type (def); - else - set_type ("violin"); - create_clef(); + if (clef_type_str_) + create_clef(); clef_p_->default_b_ = false; } @@ -90,8 +89,7 @@ Clef_engraver::do_try_request (Request * r_l) if (!creq_l || !creq_l->clefchange()) return false; - clef_req_l_ = creq_l->clefchange(); - + clef_req_l_ = creq_l->clefchange(); read_req (clef_req_l_); return true; } @@ -120,12 +118,12 @@ Clef_engraver::do_process_requests() void Clef_engraver::do_pre_move_processing() { - if (!clef_p_) - return; - typeset_element (clef_p_); - clef_p_ = 0; + if (clef_p_) + { + typeset_element (clef_p_); + clef_p_ = 0; + } } - void Clef_engraver::do_post_move_processing() { diff --git a/lily/clef-item.cc b/lily/clef-item.cc index fc579ec347..920d2c5512 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -21,7 +21,7 @@ Clef_item::do_pre_processing() if (default_b_) { - empty_b_ = (break_status_i() != 1); + set_empty(break_status_i() != 1); transparent_b_ = (break_status_i() != 1); } } diff --git a/lily/elem-group.cc b/lily/elem-group.cc index 8c4c573b26..4e215381cf 100644 --- a/lily/elem-group.cc +++ b/lily/elem-group.cc @@ -11,54 +11,15 @@ #include "item.hh" #include "debug.hh" -void -Axis_group_element::do_unlink() -{ - remove_all(); -} - -void -Axis_group_element::do_junk_links() -{ - axis_admin_.elem_l_arr_.set_size (0); -} - - -bool -Axis_group_element::contains_b (Score_elem const*e) const -{ - return axis_admin_.contains_b (e); -} - -Link_array<Score_elem> -Axis_group_element::get_extra_dependencies() const -{ - return axis_admin_.elem_l_arr_; -} - -void -Axis_group_element::do_print() const -{ - axis_admin_.print(); -} - - -Axis_group_element::Axis_group_element() -{ - transparent_b_ = true; -} - -// **************** - void -Vertical_group_element::add_element (Score_elem*e) +Vertical_group_element::add_element (Graphical_element*e) { axis_admin_.add_element (e, this, Y_AXIS, Y_AXIS); } void -Vertical_group_element::remove_element (Score_elem*e) +Vertical_group_element::remove_element (Graphical_element*e) { axis_admin_.remove_element (e, Y_AXIS, Y_AXIS); } @@ -84,13 +45,13 @@ Horizontal_group_element::remove_all() } void -Horizontal_group_element::add_element (Score_elem*e) +Horizontal_group_element::add_element (Graphical_element*e) { axis_admin_.add_element (e,this, X_AXIS,X_AXIS); } void -Horizontal_group_element::remove_element (Score_elem*e) +Horizontal_group_element::remove_element (Graphical_element*e) { axis_admin_.remove_element (e,X_AXIS,X_AXIS); } @@ -111,13 +72,13 @@ Horizontal_vertical_group_element::remove_all() axis_admin_.remove_all (X_AXIS,Y_AXIS); } void -Horizontal_vertical_group_element::add_element (Score_elem *e) +Horizontal_vertical_group_element::add_element (Graphical_element *e) { axis_admin_.add_element (e, this, X_AXIS, Y_AXIS); } void -Horizontal_vertical_group_element::remove_element (Score_elem*e) +Horizontal_vertical_group_element::remove_element (Graphical_element*e) { axis_admin_.remove_element (e, X_AXIS, Y_AXIS); } diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 740899418b..9806130d14 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -14,7 +14,6 @@ #include "p-score.hh" #include "paper-def.hh" - const HAPPY_DOTS_I = 3; /** @@ -41,7 +40,6 @@ struct Break_node { Array<Col_hpositions> Gourlay_breaking::do_solve() const { - Array<Break_node> optimal_paths; Line_of_cols all = all_cols(); Array<int> breaks = find_break_indices(); @@ -170,20 +168,9 @@ Gourlay_breaking::do_solve() const i = optimal_paths[i].prev_break_i_; } - print_stats(); - /* - TODO print variation in energy - */ - if (max_energy_f) - { - ; - } - - for (int i= final_breaks.size(); i--;) lines.push (optimal_paths[final_breaks[i]].line_config_); - return lines; } diff --git a/lily/graphical-element.cc b/lily/graphical-element.cc new file mode 100644 index 0000000000..98f29f77f4 --- /dev/null +++ b/lily/graphical-element.cc @@ -0,0 +1,188 @@ +/* + graphical-element.cc -- implement Graphical_element + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "graphical-element.hh" +#include "axis-group-element.hh" +#include "debug.hh" + +Graphical_element::Graphical_element () +{ + init (); +} + +Graphical_element::Graphical_element (Graphical_element const &s) +{ + init (); + empty_b_ = s.empty_b_; + axis_group_l_a_[0] = axis_group_l_a_[1] =0; + offset_ = Offset (0,0); +} + +Graphical_element::~Graphical_element () +{ + +} + +void +Graphical_element::init () +{ + empty_b_ = false; + axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0; + offset_ = Offset (0,0); + cached_valid_b_a_ [X_AXIS] = cached_valid_b_a_[Y_AXIS] = false; +} + +void +Graphical_element::invalidate_cache (Axis a) +{ + Graphical_element * g = this; + while (g && g->cached_valid_b_a_[a]) + { + g->cached_valid_b_a_ [a] = false; + g = g->axis_group_l_a_[a]; + } +} + +Real +Graphical_element::absolute_coordinate (Axis a) const +{ + Real r = offset_[a]; + for (Axis_group_element * axis_group_l = axis_group_l_a_[a]; + axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a]) + + r += axis_group_l->offset_[a]; + return r; +} + + +Offset +Graphical_element::absolute_offset() const +{ + return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS)); +} + +void +Graphical_element::translate (Real y, Axis a) +{ + if (axis_group_l_a_[a]) + axis_group_l_a_[a]->invalidate_cache (a); + offset_[a] += y; +} + +Real +Graphical_element::relative_coordinate (Axis_group_element*e, Axis a) const +{ + Real r =0.0; + for (Axis_group_element * axis_group_l = axis_group_l_a_[a]; + axis_group_l != e; + axis_group_l = axis_group_l->axis_group_l_a_[a]) + r += axis_group_l->offset_[a]; + + return r; +} + +Axis_group_element* +Graphical_element::common_group (Graphical_element const* s, Axis a) const +{ + Link_array<Axis_group_element> my_groups; + for (Axis_group_element * axis_group_l = axis_group_l_a_[a]; + axis_group_l; + axis_group_l = axis_group_l->axis_group_l_a_[a]) + my_groups.push (axis_group_l); + + Axis_group_element* common_l=0; + for (Axis_group_element * axis_group_l = s->axis_group_l_a_[a]; + !common_l && axis_group_l; + axis_group_l = axis_group_l->axis_group_l_a_[a]) + common_l = my_groups.find_l (axis_group_l); + + return common_l; +} + + + +void +Graphical_element::translate (Offset offset) +{ + translate (offset[Y_AXIS], Y_AXIS); + translate (offset[X_AXIS], X_AXIS); +} + +Interval +Graphical_element::width() const +{ + return extent (X_AXIS); +} + +void +Graphical_element::set_empty (bool b) +{ + if (empty_b_ != b) + { + empty_b_ = b; + if (!empty_b_) + { + invalidate_cache (X_AXIS); + invalidate_cache (Y_AXIS); + } + } + +} + +Interval +Graphical_element::extent (Axis a) const +{ + if (empty_b_) + return Interval (); + + if (!cached_valid_b_a_[a]) + { + Graphical_element *self = (Graphical_element*)this; + self->cached_dimension_a_[a] = (a == X_AXIS)? do_width(): do_height (); + self->cached_valid_b_a_[a] = true; + } + + Interval r(cached_dimension_a_[a]); + if (!r.empty_b()) // float exception on DEC Alpha + r+=offset_[a]; + + return r; +} + +Interval +Graphical_element::height() const +{ + return extent (Y_AXIS); +} + +void +Graphical_element::unlink () +{ + for (int j=0; j < 2; j++) + if (axis_group_l_a_[j]) + axis_group_l_a_[j]->remove_element (this); +} + +void +Graphical_element::junk_links () +{ + axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0; +} + +void +Graphical_element::print () const +{ +#ifndef NPRINT + if (offset_.x() || offset_.y ()) + DOUT << "offset: " << offset_.str() ; + DOUT << "\n"; +#endif +} + +IMPLEMENT_IS_TYPE_B(Graphical_element); + diff --git a/lily/horizontal-align-item.cc b/lily/horizontal-align-item.cc index 48701d148a..6e63be3daa 100644 --- a/lily/horizontal-align-item.cc +++ b/lily/horizontal-align-item.cc @@ -7,7 +7,7 @@ */ #include "horizontal-align-item.hh" - +#include "debug.hh" IMPLEMENT_IS_TYPE_B1(Horizontal_align_item,Item); @@ -114,12 +114,18 @@ Horizontal_align_item::do_width() const void Horizontal_align_item::do_print() const { +#ifndef NPRINT + Item::do_print (); + DOUT << "contains: "; + for (int i=0 ; i < item_l_arr_.size(); i++) + DOUT << item_l_arr_[i]->name () << ", "; +#endif } Horizontal_align_item::Horizontal_align_item() { center_l_ = 0; align_i_ = 0; - empty_b_ = true; + set_empty (true); transparent_b_ = true; } diff --git a/lily/include/axis-group-administration.hh b/lily/include/axis-group-administration.hh index 77007f8ff1..d7e33e4c7e 100644 --- a/lily/include/axis-group-administration.hh +++ b/lily/include/axis-group-administration.hh @@ -20,7 +20,7 @@ Do the dirty work for Axis_group_element. */ struct Axis_group_administration { - Link_array<Score_elem> elem_l_arr_; + Link_array<Graphical_element> elem_l_arr_; Interval extent (Axis) const; void print() const ; @@ -28,9 +28,9 @@ struct Axis_group_administration { Axis_group_administration(){} void remove_all (Axis a1, Axis a2); - bool contains_b (Score_elem const *) const; - void add_element (Score_elem*, Axis_group_element*, Axis a1, Axis a2); - void remove_element (Score_elem*, Axis a1, Axis a2); + bool contains_b (Graphical_element const *) const; + void add_element (Graphical_element*, Axis_group_element*, Axis a1, Axis a2); + void remove_element (Graphical_element*, Axis a1, Axis a2); }; #endif // AXIS_GROUP_ADMINISTRATION_HH diff --git a/lily/include/axis-group-element.hh b/lily/include/axis-group-element.hh index 42a31fd423..b79b70084e 100644 --- a/lily/include/axis-group-element.hh +++ b/lily/include/axis-group-element.hh @@ -25,11 +25,12 @@ protected: virtual void do_junk_links(); public: + virtual Link_array<Score_elem> elem_l_arr() const; Axis_group_element(); virtual void remove_all()=0; - virtual void add_element (Score_elem*)=0; - virtual void remove_element (Score_elem*)=0; - virtual bool contains_b (Score_elem const *) const; + virtual void add_element (Graphical_element*)=0; + virtual void remove_element (Graphical_element*)=0; + virtual bool contains_b (Graphical_element const *) const; DECLARE_MY_RUNTIME_TYPEINFO; }; diff --git a/lily/include/axis-group.hh b/lily/include/axis-group.hh deleted file mode 100644 index 152688ce69..0000000000 --- a/lily/include/axis-group.hh +++ /dev/null @@ -1,12 +0,0 @@ -/* -axis-group-element.hh -- declare Axis_group_administration, Axis_group_element - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#error -#ifndef Axis_group_administration_HH -#define Axis_group_administration_HH#endif // Axis_group_administration_HH diff --git a/lily/include/break.hh b/lily/include/break.hh index b77414482e..851aa726cf 100644 --- a/lily/include/break.hh +++ b/lily/include/break.hh @@ -19,12 +19,12 @@ */ struct Col_stats { - int count_i_; - int cols_i_; + int count_i_; + int cols_i_; - Col_stats(); - void add (Line_of_cols const&l); - String str() const; + Col_stats(); + void add (Line_of_cols const&l); + String str() const; }; /** Class representation of an algorithm which decides where to put @@ -36,45 +36,43 @@ struct Col_stats class Break_algorithm { protected: - Paper_score *pscore_l_; - Real linelength; + Paper_score *pscore_l_; + Real linelength; - /// search all pcols which are breakable. - Line_of_cols find_breaks() const; + /// search all pcols which are breakable. + Line_of_cols find_breaks() const; - Line_of_cols all_cols() const; - Array<int> find_break_indices() const; + Line_of_cols all_cols() const; + Array<int> find_break_indices() const; - /// helper: solve for the columns in #curline#. - void solve_line (Col_hpositions*) const; + /// helper: solve for the columns in #curline#. + void solve_line (Col_hpositions*) const; - /// helper: approximate the energyv - void approximate_solve_line (Col_hpositions*) const; + /// helper: approximate the energyv + void approximate_solve_line (Col_hpositions*) const; - /// does curline fit on the paper? - bool feasible (Line_of_cols) const; + /// does curline fit on the paper? + bool feasible (Line_of_cols) const; - Line_spacer* generate_spacing_problem (Line_of_cols) const; + Line_spacer* generate_spacing_problem (Line_of_cols) const; - virtual Array<Col_hpositions> do_solve() const=0; - void print_stats() const; - - virtual void do_set_pscore(); + virtual Array<Col_hpositions> do_solve() const=0; + virtual void do_set_pscore(); public: - Col_stats approx_stats_; - Col_stats exact_stats_; - - Line_spacer* (*get_line_spacer)(); + Col_stats approx_stats_; + Col_stats exact_stats_; + + Line_spacer* (*get_line_spacer)(); - Break_algorithm(); - void set_pscore (Paper_score*); + Break_algorithm(); + void set_pscore (Paper_score*); - /// check if the spacing/breaking problem is well-stated - void problem_OK() const; - void OK() const; - Array<Col_hpositions> solve() const; + /// check if the spacing/breaking problem is well-stated + void problem_OK() const; + void OK() const; + Array<Col_hpositions> solve() const; }; #endif // BREAK_HH diff --git a/lily/include/change-iterator.hh b/lily/include/change-iterator.hh new file mode 100644 index 0000000000..bde2628561 --- /dev/null +++ b/lily/include/change-iterator.hh @@ -0,0 +1,27 @@ +/* + change-iterator.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef CHANGE_ITERATOR_HH +#define CHANGE_ITERATOR_HH + +#include "music-iterator.hh" + + +class Change_iterator : public Music_iterator +{ + Change_translator *change_l_; + +public: + DECLARE_MY_RUNTIME_TYPEINFO; + Change_iterator (Change_translator* prop_l); +protected: + virtual void process_and_next (Moment); +}; + +#endif diff --git a/lily/include/change-translator.hh b/lily/include/change-translator.hh new file mode 100644 index 0000000000..ade016e1d5 --- /dev/null +++ b/lily/include/change-translator.hh @@ -0,0 +1,27 @@ +/* + change-translator.hh -- declare Change_translator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef CHANGE_TRANSLATOR_HH +#define CHANGE_TRANSLATOR_HH + +#include "music.hh" + +class Change_translator : public Music +{ +public: + String change_to_type_str_; + String change_to_id_str_; + DECLARE_MY_RUNTIME_TYPEINFO; +protected: + VIRTUAL_COPY_CONS(Change_translator, Music); + void do_print () const; +}; + + +#endif // CHANGE_TRANSLATOR_HH diff --git a/lily/include/elem-group-item.hh b/lily/include/elem-group-item.hh index 52475d905a..ab79afea9c 100644 --- a/lily/include/elem-group-item.hh +++ b/lily/include/elem-group-item.hh @@ -24,8 +24,8 @@ protected: virtual void do_unlink () { Horizontal_vertical_group_element::do_unlink (); } SCORE_ELEM_CLONE(Horizontal_vertical_group_item); public: - virtual void add_element (Score_elem*e) { Horizontal_vertical_group_element::add_element (e); } - virtual void remove_element (Score_elem*e) { Horizontal_vertical_group_element::remove_element (e); } + virtual void add_element (Graphical_element*e) { Horizontal_vertical_group_element::add_element (e); } + virtual void remove_element (Graphical_element*e) { Horizontal_vertical_group_element::remove_element (e); } DECLARE_MY_RUNTIME_TYPEINFO; }; diff --git a/lily/include/elem-group.hh b/lily/include/elem-group.hh index 0edd067ec2..82ab4cc787 100644 --- a/lily/include/elem-group.hh +++ b/lily/include/elem-group.hh @@ -26,8 +26,8 @@ protected: public: DECLARE_MY_RUNTIME_TYPEINFO; - virtual void add_element (Score_elem*); - virtual void remove_element (Score_elem*); + virtual void add_element (Graphical_element*); + virtual void remove_element (Graphical_element*); }; /** @@ -39,8 +39,8 @@ protected: virtual void remove_all(); public: - virtual void add_element (Score_elem*); - virtual void remove_element (Score_elem*); + virtual void add_element (Graphical_element*); + virtual void remove_element (Graphical_element*); DECLARE_MY_RUNTIME_TYPEINFO; }; @@ -54,8 +54,8 @@ class Horizontal_vertical_group_element : public Vertical_group_element, protected: virtual void remove_all(); public: - virtual void add_element (Score_elem*); - virtual void remove_element (Score_elem*); + virtual void add_element (Graphical_element*); + virtual void remove_element (Graphical_element*); DECLARE_MY_RUNTIME_TYPEINFO; }; diff --git a/lily/include/graphical-element.hh b/lily/include/graphical-element.hh new file mode 100644 index 0000000000..fae403280c --- /dev/null +++ b/lily/include/graphical-element.hh @@ -0,0 +1,78 @@ +/* + graphical-element.hh -- declare Graphical_element + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef GRAPHICAL_ELEMENT_HH +#define GRAPHICAL_ELEMENT_HH + +#include "offset.hh" +#include "lily-proto.hh" +#include "interval.hh" +#include "virtual-methods.hh" + +/** The 2d geometric aspects of a score-element. It was put in a + separate class, because Score_elem got quite big. + + */ +class Graphical_element +{ + void init (); + /** Is this element dimensionless?. + This is private to guarantee correctness of the cache + */ + bool empty_b_; + +public: + void set_empty (bool); + DECLARE_MY_RUNTIME_TYPEINFO; + /** + This is needed, because #output# may still be + NULL. + */ + Offset offset_; + + Axis_group_element * axis_group_l_a_[NO_AXES]; + Interval cached_dimension_a_[NO_AXES]; + bool cached_valid_b_a_[NO_AXES]; + + Graphical_element (); + Graphical_element (Graphical_element const&); + virtual ~Graphical_element (); + + void invalidate_cache (Axis); + Interval extent (Axis) const; + Interval width() const; + Interval height() const; + + /** + translate the symbol. The symbol does not have to be created yet. + */ + void translate (Offset); + /** + translate in one direction + */ + + void translate (Real, Axis); + + Real relative_coordinate (Axis_group_element*group, Axis) const; + Offset absolute_offset() const; + Real absolute_coordinate (Axis) const; + /** + Find the group-element which has both #this# and #s# + */ + Axis_group_element*common_group (Graphical_element const* s, Axis a) const; + void unlink (); + void junk_links (); + void print () const; +protected: + virtual Interval do_height () const=0; + virtual Interval do_width () const=0; +}; + +#endif // GRAPHICAL_ELEMENT_HH + diff --git a/lily/include/head-column.hh b/lily/include/head-column.hh new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lily/include/horizontal-group-item.hh b/lily/include/horizontal-group-item.hh index 35918c9570..10d8106b1d 100644 --- a/lily/include/horizontal-group-item.hh +++ b/lily/include/horizontal-group-item.hh @@ -27,8 +27,8 @@ protected: } virtual void do_print() const; public: - virtual void add_element (Score_elem*e) { Horizontal_group_element::add_element (e); } - virtual void remove_element (Score_elem*e) { Horizontal_group_element::remove_element (e); } + virtual void add_element (Graphical_element*e) { Horizontal_group_element::add_element (e); } + virtual void remove_element (Graphical_element*e) { Horizontal_group_element::remove_element (e); } DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Horizontal_group_item); }; diff --git a/lily/include/input-translator.hh b/lily/include/input-translator.hh deleted file mode 100644 index 115a48a1fe..0000000000 --- a/lily/include/input-translator.hh +++ /dev/null @@ -1,50 +0,0 @@ -/* - input-translator.hh -- declare Input_translator - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef INPUT_TRANSLATOR_HH -#define INPUT_TRANSLATOR_HH - -#include "plist.hh" -#include "string.hh" -#include "lily-proto.hh" -#include "input.hh" -#include "string.hh" -#error -#include "varray.hh" - -struct Input_translator_list : public Pointer_list<Input_translator*> -{ - Input_translator_list (Input_translator_list const &); - Input_translator_list(){} - ~Input_translator_list(){} -}; - -/** Define a intereter for music. This is an runtime interface to the - typesystem */ -class Input_translator : public Input { -public: - Input_translator_list contains_itrans_p_list_; - Array<String> consists_str_arr_; - Array<String> alias_str_arr_; - String base_str_; - String type_str_; - String default_id_str_; - - void add (Input_translator *); - bool is_name_b (String); - bool accept_req_b(); - bool accepts_b (String); - void print() const; - Translator_group * get_group_translator_p(); - Input_translator * get_default_itrans_l(); - Input_translator * recursive_find (String nm); - Input_translator * find_itrans_l (String nm); -}; - -#endif // Input_translator_HH diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 575b52afbd..7c735faa27 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -46,7 +46,7 @@ struct Break_align_item; struct Bracket_req; struct Cadenza_req; struct Change_iterator; -struct Change_reg; +struct Change_translator; struct Chord; struct Clef_change_req; struct Clef_item; @@ -73,6 +73,7 @@ struct Dynamic_req; struct Element_group; struct Element_group_item; struct General_script_def; +struct Graphical_element; struct Music_output; struct Music_output_def; struct Global_translator; @@ -144,7 +145,7 @@ struct Note_head; struct Note_head_engraver; struct Notename_table; struct Offset; -struct Output; +struct Outputter; struct Performer; struct Paper_column; struct Paper_score; diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index c9af80091c..638e8c3bdf 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -43,7 +43,7 @@ struct Lookup { Symbol rule_symbol (Real height, Real width) const; Symbol accidental (int) const; Symbol ball (int) const; - Symbol flag (int) const; + Symbol flag (int, Direction) const; Symbol rest (int, bool outside) const; Symbol clef (String) const; Symbol bar (String, Real height) const; diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index d1a4b77914..b0666e160a 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -33,14 +33,12 @@ class My_lily_parser { void set_last_duration (Duration const *); void set_default_duration (Duration const *); - void set_last_abbrev (int type_i); void set_abbrev_beam (int type_i); void set_duration_mode (String s); friend int yyparse (void*); public: int abbrev_beam_type_i_; - int default_abbrev_type_i_; int default_octave_i_; Duration default_duration_; Plet plet_; diff --git a/lily/include/offset.hh b/lily/include/offset.hh index ea22500fd7..9407570463 100644 --- a/lily/include/offset.hh +++ b/lily/include/offset.hh @@ -26,6 +26,7 @@ struct Offset { Real operator[](Axis i) const{ return coordinate_a_[i]; } + String str () const; Offset operator+=(Offset o) { x()+=o.x (); diff --git a/lily/include/outputter.hh b/lily/include/outputter.hh new file mode 100644 index 0000000000..4b80892990 --- /dev/null +++ b/lily/include/outputter.hh @@ -0,0 +1,38 @@ +/* + outputter.hh -- declare Outputter + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef OUTPUTTER_HH +#define OUTPUTTER_HH + +#include "lily-proto.hh" + +/** + Abstract interface for a Score_elem to output itself. + */ +struct Outputter +{ + virtual ~Outputter(){} + virtual void start_line ()=0; + virtual void output_molecule (Molecule const *, Offset)=0; + virtual void stop_line ()=0; +}; + +/** + Output a line of score using TeX strings + */ +struct Tex_outputter : Outputter +{ + Tex_outputter (Tex_stream *); + Tex_stream * outstream_l_; + virtual void output_molecule (Molecule const*, Offset); + virtual void start_line (); + virtual void stop_line (); +}; + +#endif // OUTPUTTER_HH diff --git a/lily/include/p-score.hh b/lily/include/p-score.hh index 1ca1f30ac8..0bce434619 100644 --- a/lily/include/p-score.hh +++ b/lily/include/p-score.hh @@ -22,6 +22,7 @@ */ class Paper_score : public Music_output { + void tex_output (); public: Paper_def *paper_l_; @@ -33,7 +34,8 @@ public: /// other elements Pointer_list<Score_elem*> elem_p_list_; - + + Outputter *outputter_l_; Super_elem *super_elem_l_; Paper_score (); @@ -55,7 +57,6 @@ public: /* STANDARD ROUTINES */ - void OK() const; void print() const; void typeset_element (Score_elem*); diff --git a/lily/include/rest-column-grav.hh b/lily/include/rest-column-grav.hh new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lily/include/rest-column.hh b/lily/include/rest-column.hh new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lily/include/score-elem.hh b/lily/include/score-elem.hh index c67510040a..64ec7fcbe1 100644 --- a/lily/include/score-elem.hh +++ b/lily/include/score-elem.hh @@ -8,14 +8,14 @@ #define STAFFELEM_HH #include "parray.hh" -#include "lily-proto.hh" -#include "offset.hh" #include "virtual-methods.hh" #include "directed-graph.hh" +#include "graphical-element.hh" #define SCORE_ELEM_CLONE(T) VIRTUAL_COPY_CONS(T, Score_elem) +typedef void (Score_elem::*Score_elem_method_pointer)(void); /** 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 @@ -25,94 +25,25 @@ form an acyclic graph. (elem) */ -class Score_elem : private Directed_graph_node { - - /// member: the symbols - Molecule *output; // should scrap, and use temp var? - - - - /** - for administration of what was done already - */ - enum Status { - ORPHAN, // not yet added to pstaff - VIRGIN, // added to pstaff - PREBREAKING, - PREBROKEN, - PRECALCING, - PRECALCED, // calcs before spacing done - BREAKING, - BROKEN, - POSTCALCING, // busy calculating. This is used to trap cyclic deps. - POSTCALCED, // after spacing calcs done - BREWED, - TEXOUTPUT, // molecule has been output - DELETED, // to catch malloc mistakes. - }; - - Status status_; - - Score_elem* dependency (int) const; - Score_elem* dependent (int) const; - int dependent_size() const; - int dependency_size() const; +class Score_elem : private Directed_graph_node, public Graphical_element { public: - /** - This is needed, because #output# may still be - NULL. - */ - Offset offset_; - - - - Paper_score *pscore_l_; - Axis_group_element * axis_group_l_a_[NO_AXES]; + Score_elem(); Score_elem (Score_elem const&); - virtual String TeX_output_str () const ; - virtual void print() const; + virtual void print() const; Paper_def *paper() const; virtual ~Score_elem(); - Score_elem(); DECLARE_MY_RUNTIME_TYPEINFO; - - Interval extent (Axis) const; - Interval width() const; - Interval height() const; - Status status() const; - - /** - translate the symbol. The symbol does not have to be created yet. - */ - void translate (Offset); - /** - translate in one direction - */ - - void translate (Real, Axis); - Real relative_coordinate (Axis_group_element*, Axis) const; - Offset absolute_offset() const; - Real absolute_coordinate (Axis) const; - Axis_group_element*common_group (Score_elem const* s, Axis a) const; void add_processing(); - void OK() const; - void pre_processing(); - void breakable_col_processing(); - void break_processing(); - - void post_processing(); - void molecule_processing(); /** Remove all links (dependencies, dependents, Axis_group_elements. */ void unlink(); - void unlink_all(); void substitute_dependency (Score_elem*,Score_elem*); void remove_dependency (Score_elem*); /** @@ -130,12 +61,30 @@ public: virtual bool linked_b() const; SCORE_ELEM_CLONE(Score_elem); - /// no dimension, translation is noop - bool empty_b_; /// do not print anything black bool transparent_b_; + + // ugh: no protection. Denk na, Vrij Veilig + void calcalute_dependencies (int final, int busy, Score_elem_method_pointer funcptr); + protected: + /** + Administration: Where are we?. This is mainly used by Super_elem and + Score_elem::calcalute_dependencies () + + 0 means ORPHAN, + -1 means deleted + + */ + int status_i_; + Score_elem* dependency (int) const; + Score_elem* dependent (int) const; + int dependent_size() const; + int dependency_size() const; + + virtual void do_brew_molecule (); + void junk_links(); virtual Interval do_height() const; virtual Interval do_width() const; @@ -151,7 +100,6 @@ protected: virtual void do_breakable_col_processing(); /// do calculations after determining horizontal spacing virtual void do_post_processing(); - virtual String do_TeX_output_str () const; virtual void do_substitute_dependency (Score_elem * , Score_elem *); virtual void do_substitute_dependent (Score_elem *, Score_elem *); @@ -161,7 +109,6 @@ protected: virtual Link_array<Score_elem> get_extra_dependencies() const; virtual void do_unlink(); virtual void do_junk_links(); - String make_TeX_string (Offset) const; }; diff --git a/lily/include/score-grav.hh b/lily/include/score-grav.hh index fcdae480fa..6348cdadf0 100644 --- a/lily/include/score-grav.hh +++ b/lily/include/score-grav.hh @@ -54,7 +54,7 @@ protected: virtual void do_announces(); virtual void typeset_element (Score_elem*elem_p); virtual void do_pre_move_processing(); - virtual void add_processing (); + virtual void do_add_processing (); }; #endif // SCORE_GRAV_HH diff --git a/lily/include/score-performer.hh b/lily/include/score-performer.hh index ef2385ad46..b093ae090e 100644 --- a/lily/include/score-performer.hh +++ b/lily/include/score-performer.hh @@ -29,7 +29,7 @@ protected: virtual void prepare (Moment mom); virtual void process(); virtual void start(); - virtual void add_processing (); + virtual void do_add_processing (); virtual int get_tempo_i() const; virtual void play (Audio_element* p); virtual Music_output *get_output_p (); diff --git a/lily/include/scoreline.hh b/lily/include/scoreline.hh index fc1cac844e..cb089cdb05 100644 --- a/lily/include/scoreline.hh +++ b/lily/include/scoreline.hh @@ -16,8 +16,7 @@ class Line_of_score : public Spanner public: Link_array<Paper_column> cols; bool error_mark_b_; - virtual String TeX_output_str () const; - + DECLARE_MY_RUNTIME_TYPEINFO; Line_of_score(); @@ -30,7 +29,10 @@ public: void set_breaking (Array<Col_hpositions> const&); protected: - virtual void do_breakable_col_processing (); + virtual Link_array<Score_elem> get_extra_dependencies () const; + + virtual void do_unlink (); + virtual void do_junk_links (); virtual void break_into_pieces (bool); virtual Interval do_width() const; virtual void do_print() const; diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 44529faaf0..ad205fcbf0 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -56,7 +56,7 @@ protected: virtual void do_unlink(); virtual void do_junk_links(); - virtual String do_TeX_output_str () const; + virtual void do_brew_molecule (); virtual void do_break_processing(); virtual Interval do_width() const; virtual void do_print() const; diff --git a/lily/include/stem-grav.hh b/lily/include/stem-grav.hh index 136e6e5095..b5a77589ec 100644 --- a/lily/include/stem-grav.hh +++ b/lily/include/stem-grav.hh @@ -18,10 +18,12 @@ class Stem_engraver : public Engraver { Direction dir_; + int default_abbrev_i_; Stem *stem_p_; Rhythmic_req *rhythmic_req_l_; Abbreviation_req* abbrev_req_l_; protected: + virtual void do_creation_processing (); virtual void acknowledge_element (Score_elem_info); virtual void do_pre_move_processing (); virtual bool do_try_request (Request*); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 9787323350..f7240397b3 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -57,7 +57,7 @@ public: /// how many abbrev beam don't reach stem? int beam_gap_i_; - /// flagtype? 4 none, 8 8th flag, 0 = beam. + /// log of the duration. Eg. 4 -> 16th note -> 2 flags int flag_i_; /** diff --git a/lily/include/super-elem.hh b/lily/include/super-elem.hh index 1b5a994037..74bfda6691 100644 --- a/lily/include/super-elem.hh +++ b/lily/include/super-elem.hh @@ -16,17 +16,24 @@ */ class Super_elem : public Score_elem { public: - Link_array<Line_of_score> lines_arr_; - Line_of_score * line_of_score_l_; + Link_array<Line_of_score> lines_arr_; + Line_of_score * line_of_score_l_; void add_broken_line (Line_of_score*); - Super_elem(); - virtual String TeX_output_str() const; + Super_elem(); + + void pre_processing(); + void breakable_col_processing(); + void break_processing(); + void post_processing(); + void output_all (); + void unlink_all (); + protected: - virtual void do_substitute_dependency (Score_elem*,Score_elem*); - virtual void handle_broken_dependencies(); + virtual void do_substitute_dependency (Score_elem*,Score_elem*); + virtual void handle_broken_dependencies(); - virtual void do_add_processing(); - DECLARE_MY_RUNTIME_TYPEINFO; + virtual void do_add_processing(); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // SUPER_ELEM_HH diff --git a/lily/include/tie-grav.hh b/lily/include/tie-grav.hh index b967e42c19..dc118c96e0 100644 --- a/lily/include/tie-grav.hh +++ b/lily/include/tie-grav.hh @@ -23,7 +23,7 @@ class Tie_engraver : public Engraver { Melodic_req * melodic_req_l_; protected: - virtual ~Tie_engraver(); + virtual void do_removal_processing (); virtual void acknowledge_element (Score_elem_info); virtual bool do_try_request (Request*); virtual bool acceptable_request_b (Request*); diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 13b8ca3d1e..dc2e8365eb 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -62,7 +62,7 @@ protected: virtual Translator_group * group_l () { return this; } virtual void do_print () const; virtual void do_process_requests (); - virtual void add_processing (); + virtual void do_add_processing (); virtual bool do_try_request (Request* req_l); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); diff --git a/lily/include/translator.hh b/lily/include/translator.hh index e9fc506a46..baa0718366 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -40,7 +40,6 @@ public: Translator_group * daddy_trans_l_ ; - virtual void add_processing (); void print () const; /** @@ -54,6 +53,7 @@ public: */ bool try_request (Request*); void pre_move_processing(); + void add_processing (); void creation_processing (); void process_requests(); void post_move_processing(); @@ -86,6 +86,7 @@ protected: @see{try_request} Default: always return false */ + virtual void do_add_processing (); virtual bool do_try_request (Request *req_l); virtual void do_print () const; virtual void do_pre_move_processing(){} diff --git a/lily/include/vertical-group-spanner.hh b/lily/include/vertical-group-spanner.hh index 720b298932..3c9ef948bc 100644 --- a/lily/include/vertical-group-spanner.hh +++ b/lily/include/vertical-group-spanner.hh @@ -24,8 +24,8 @@ protected: virtual void do_unlink () { Axis_group_spanner::do_unlink (); } public: DECLARE_MY_RUNTIME_TYPEINFO; - virtual void add_element (Score_elem*e) { Vertical_group_element::add_element (e); } - virtual void remove_element (Score_elem*e) { Vertical_group_element::remove_element (e); } + virtual void add_element (Graphical_element*e) { Vertical_group_element::add_element (e); } + virtual void remove_element (Graphical_element*e) { Vertical_group_element::remove_element (e); } }; #endif // SPAN_VERTICAL_GROUP_HH diff --git a/lily/item.cc b/lily/item.cc index 6d72b4c5b8..40df46783f 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -26,8 +26,8 @@ void Item::do_print() const { #ifndef NPRINT - DOUT << "breakable_b_: " << breakable_b_; - DOUT << "break_status_i_: " <<break_status_i_; + DOUT << "breakable_b_: " << breakable_b_ << + " break_status_i_: " <<break_status_i_; #endif } diff --git a/lily/key-item.cc b/lily/key-item.cc index d328f44ac9..f3b57d20a1 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -94,6 +94,7 @@ Key_item::do_pre_processing() { if (default_b_) { - empty_b_ = transparent_b_ = (break_status_i() != 1); + transparent_b_ = (break_status_i() != 1); + set_empty (transparent_b_); } } diff --git a/lily/lookup.cc b/lily/lookup.cc index 480abb5f9a..119c52e449 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -143,9 +143,10 @@ Lookup::dots (int j) const } Symbol -Lookup::flag (int j) const +Lookup::flag (int j, Direction d) const { - return (*symtables_)("flags")->lookup (j); + char c = (d == UP) ? 'u' : 'd'; + return (*symtables_)("flags")->lookup (c + String (j)); } Symbol diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index d05b752df0..9c1f2c733e 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -14,6 +14,8 @@ #include "request-iterator.hh" #include "translator-group.hh" #include "translation-property.hh" +#include "change-iterator.hh" +#include "change-translator.hh" IMPLEMENT_IS_TYPE_B(Music_iterator); @@ -130,7 +132,9 @@ Music_iterator::static_get_iterator_p (Music *m, p = new Voice_iterator ((Voice*) m); else if (m->is_type_b (Translation_property::static_name ())) p = new Property_iterator((Translation_property *) m); - + else if (m->is_type_b (Change_translator::static_name ())) + p = new Change_iterator((Change_translator*) m); + if (m -> translator_type_str_) { Translator_group* a =report_l-> @@ -138,7 +142,6 @@ Music_iterator::static_get_iterator_p (Music *m, p->set_translator (a); } - if (! p->report_to_l()) p ->set_translator (report_l); diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index 7cbcd86bc3..bfa78512da 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -23,7 +23,6 @@ My_lily_parser::My_lily_parser (Sources * source_l) source_l_ = source_l; lexer_p_ = 0; abbrev_beam_type_i_ = 0; - default_abbrev_type_i_ = 0; default_duration_.durlog_i_ = 2; default_octave_i_ = 0; textstyle_str_="roman"; // in lexer? @@ -145,18 +144,11 @@ My_lily_parser::set_abbrev_beam (int type_i) abbrev_beam_type_i_ = type_i; } -void -My_lily_parser::set_last_abbrev (int type_i) -{ - default_abbrev_type_i_ = type_i; -} - void My_lily_parser::set_default_duration (Duration const *d) { last_duration_mode_b_ = false; default_duration_ = *d; - set_last_abbrev (0); } @@ -165,7 +157,6 @@ My_lily_parser::set_last_duration (Duration const *d) { if (last_duration_mode_b_) default_duration_ = *d; - set_last_abbrev (0); } @@ -193,11 +184,11 @@ My_lily_parser::get_rest_element (String s, Duration * duration_p) if (s=="s") { /* Space */ - Skip_req * skip_p = new Skip_req; - skip_p->duration_ = *duration_p; + Skip_req * skip_p = new Skip_req; + skip_p->duration_ = *duration_p; - skip_p->set_spot (here_input()); - velt_p->add (skip_p); + skip_p->set_spot (here_input()); + velt_p->add (skip_p); } else { @@ -227,12 +218,6 @@ My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p) assert (!duration_p->plet_b ()); duration_p->set_plet (1, 2); } - if (default_abbrev_type_i_) - { - Abbreviation_req* a = new Abbreviation_req; - a->type_i_ = default_abbrev_type_i_; - v->add (a); - } rq->set_duration (*duration_p); rq->set_spot (here_input ()); delete duration_p ; diff --git a/lily/note-column.cc b/lily/note-column.cc index fb70c3e7a6..540922d4f0 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -68,12 +68,10 @@ Note_column::set (Stem * stem_l) stem_l_ = stem_l; /* don't add stem to support; mostly invisible for rest-columns (and possibly taken . .) - */ Score_elem::add_dependency (stem_l); for (int i=0; i < script_l_arr_.size(); i++) script_l_arr_[i]->set_stem (stem_l); - } void @@ -125,6 +123,7 @@ Note_column::add (Rhythmic_head *h) void Note_column::translate_rests (int dy_i) { + invalidate_cache (Y_AXIS); for (int i=0; i < rest_l_arr_.size(); i++) rest_l_arr_[i]->position_i_ += dy_i; } diff --git a/lily/offset.cc b/lily/offset.cc new file mode 100644 index 0000000000..105e7fb385 --- /dev/null +++ b/lily/offset.cc @@ -0,0 +1,18 @@ +/* + offset.cc -- implement Offset + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "string.hh" +#include "offset.hh" + +String +Offset::str () const +{ + String s; + s = String("(") + coordinate_a_[X_AXIS] + ", " + coordinate_a_[Y_AXIS] + ")"; + return s; +} diff --git a/lily/outputter.cc b/lily/outputter.cc new file mode 100644 index 0000000000..a533ea8e48 --- /dev/null +++ b/lily/outputter.cc @@ -0,0 +1,57 @@ + +/* + outputter.cc -- implement Tex_outputter + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "outputter.hh" +#include "tex-stream.hh" +#include "molecule.hh" +#include "varray.hh" +#include "dimen.hh" +#include "tex.hh" + +Tex_outputter::Tex_outputter (Tex_stream *s) +{ + outstream_l_ = s; +} + +void +Tex_outputter::output_molecule (Molecule const*m, Offset o) +{ + String t = m->TeX_string(); + if (!t) + return ; + + String s ("\\placebox{%}{%}{%}"); + Array<String> a; + a.push (print_dimen (o.y())); + a.push (print_dimen (o.x())); + a.push (t); + String r; + /* + if (check_debug) + r = String ("\n%start: ") + name() + "\n"; + */ + + r += substitute_args (s, a); + + *outstream_l_ << r; +} + + +void +Tex_outputter::start_line () +{ + *outstream_l_ << "\\hbox{%<- line of score\n"; +} + +void +Tex_outputter::stop_line () +{ + *outstream_l_ << "}"; + *outstream_l_ << "\\interscoreline"; +} diff --git a/lily/p-col.cc b/lily/p-col.cc index 715adecd83..06fae0d37f 100644 --- a/lily/p-col.cc +++ b/lily/p-col.cc @@ -47,7 +47,7 @@ Paper_column::do_print() const DOUT <<'\n' << ((break_status_i_ == -1)? "prebreak" : "postbreak"); DOUT << '\n'; } - DOUT << "extent: " << width().str () << "\n"; + // DOUT << "extent: " << width().str () << "\n"; #endif } diff --git a/lily/p-score.cc b/lily/p-score.cc index 986d3665ba..0591e5cc1e 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -18,9 +18,11 @@ #include "header.hh" #include "word-wrap.hh" #include "gourlay-breaking.hh" +#include "outputter.hh" Paper_score::Paper_score () { + outputter_l_ =0; super_elem_l_ = new Super_elem; typeset_element (super_elem_l_); } @@ -54,7 +56,6 @@ Paper_score::typeset_unbroken_spanner (Spanner*span_p) span_p_list_.bottom ().add (span_p); span_p->pscore_l_=this; - // do not init start/stop fields. These are for broken spans only. span_p->add_processing (); } @@ -80,15 +81,6 @@ Paper_score::add_column (Paper_column *p) -void -Paper_score::OK () const -{ -#ifndef NDEBUG - for (PCursor<Score_elem*> i (elem_p_list_.top ()); i.ok (); i++) - i->OK (); -#endif -} - void Paper_score::print () const { @@ -107,20 +99,6 @@ Paper_score::print () const #endif } -void -Paper_score::preprocess () -{ - super_elem_l_->breakable_col_processing (); - super_elem_l_->pre_processing (); -} - -void -Paper_score::postprocess () -{ - super_elem_l_->post_processing (); - super_elem_l_->molecule_processing (); -} - PCursor<Paper_column *> Paper_score::find_col (Paper_column const *c) const { @@ -197,12 +175,19 @@ Paper_score::process () clean_cols (); print (); *mlog << "Preprocessing elements... " <<flush; - preprocess (); + super_elem_l_->breakable_col_processing (); + super_elem_l_->pre_processing (); *mlog << "\nCalculating column positions ... " <<flush; calc_breaking (); *mlog << "\nPostprocessing elements..." << endl; - postprocess (); + super_elem_l_->post_processing (); + tex_output (); +} + +void +Paper_score::tex_output () +{ // output String outname = paper_l_->outfile_str_ ; if (!outname) @@ -210,17 +195,21 @@ Paper_score::process () *mlog << "TeX output to " << outname << " ...\n"; - Tex_stream the_output (outname); + Tex_stream tex_out (outname); + Tex_outputter interfees (&tex_out); + + outputter_l_ = &interfees; - the_output << "% outputting Score, defined at: " << origin_str_ << "\n"; + tex_out << "% outputting Score, defined at: " << origin_str_ << "\n"; if (header_l_) { - the_output << header_l_->TeX_string(); + tex_out << header_l_->TeX_string(); } - the_output << "\n "<< paper_l_->lookup_l ()->texsetting << "%(Tex id)\n"; - the_output<< super_elem_l_->TeX_output_str (); - the_output << "\n\\EndLilyPondOutput"; + tex_out << "\n "<< paper_l_->lookup_l ()->texsetting << "%(Tex id)\n"; + super_elem_l_->output_all (); + tex_out << "\n\\EndLilyPondOutput"; + outputter_l_ = 0; } /** Get all breakable columns between l and r, (not counting l and r). */ diff --git a/lily/parser.y b/lily/parser.y index ed9a28aceb..d7b2a0d4fa 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -12,7 +12,7 @@ #include <iostream.h> // mmm -#define MUDELA_VERSION "0.1.5" +#define MUDELA_VERSION "0.1.6" #include "scalar.hh" #include "translation-property.hh" @@ -38,6 +38,7 @@ #include "music-list.hh" #include "header.hh" #include "duration-convert.hh" +#include "change-translator.hh" #ifndef NDEBUG #define YYDEBUG 1 @@ -210,7 +211,7 @@ yylex (YYSTYPE *s, void * v_l) %type <scalar> scalar %type <music> Music transposed_music -%type <music> propertydef +%type <music> property_def translator_change %type <musiclist> Voice Voice_body %type <chord> Chord Chord_body %type <paper> paper_block paper_body @@ -472,7 +473,7 @@ paper_block: paper_body: /* empty */ { - $$ = THIS->default_paper (); // paper / video / engrave + $$ = THIS->default_paper (); } | PAPER_IDENTIFIER { $$ = $1->paperdef (); @@ -581,20 +582,24 @@ Music: { THIS->lexer_p_->push_lyric_state (); } Music { $$ = $3; THIS->lexer_p_->pop_state (); } - | propertydef + | property_def + | translator_change ; -propertydef: +translator_change: TRANSLATOR STRING '=' STRING { - /* kluge. Could use Music just as well */ - Translation_property * t = new Translation_property; - t-> translator_type_str_ = *$2; - t-> translator_id_str_ = *$4; + Change_translator * t = new Change_translator; + t-> change_to_type_str_ = *$2; + t-> change_to_id_str_ = *$4; + $$ = t; delete $2; delete $4; } - | PROPERTY STRING '.' STRING '=' scalar { + ; + +property_def: + PROPERTY STRING '.' STRING '=' scalar { Translation_property *t = new Translation_property; t-> translator_type_str_ = *$2; t-> var_str_ = *$4; @@ -614,6 +619,10 @@ scalar: Chord: '<' Chord_body '>' { $$ = $2; } + | MULTI INT Chord { + $$ = $3; + $$->multi_level_i_=$2; + } ; Chord_body: @@ -621,9 +630,6 @@ Chord_body: $$ = new Chord; $$-> multi_level_i_ = 1; } - | Chord_body MULTI INT ';' { - $$->multi_level_i_=$3; - } | Chord_body Music { $$->add ($2); } @@ -978,7 +984,7 @@ voice_command: c' -> default_octave_i_ == 1 */ - /* why can't we have \oct{0} iso \oct{c'}*/ + /* why can't we have \oct 0 iso \oct{c'}*/ THIS->default_octave_i_ = 1; } /* cont */ steno_melodic_req { @@ -1052,15 +1058,17 @@ explicit_steno_duration: abbrev_type: - ':' int { + ':' { + $$ =0; + } + | ':' int { if (!Duration::duration_type_b ($2)) THIS->parser_error ("Not a duration"); else if ($2 < 8) THIS->parser_error ("Can't abbreviate"); - else - THIS->set_last_abbrev ($2); - $$ = THIS->default_abbrev_type_i_; + $$ = $2; } + ; music_elt: diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index cf4a898831..6c50682722 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -151,5 +151,5 @@ Rest_collision::do_substitute_dependency (Score_elem*o,Score_elem*n) Rest_collision::Rest_collision() { transparent_b_ = true; - empty_b_ = true; + set_empty (true); } diff --git a/lily/score-elem.cc b/lily/score-elem.cc index 9995896a02..c06ebd0d2c 100644 --- a/lily/score-elem.cc +++ b/lily/score-elem.cc @@ -5,9 +5,7 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -/* - too big. Should split. - */ +#include "outputter.hh" #include "p-score.hh" #include "paper-def.hh" #include "lookup.hh" @@ -23,15 +21,13 @@ Score_elem::Score_elem() { - transparent_b_ = empty_b_ = false; - axis_group_l_a_[0] = axis_group_l_a_[1] =0; + transparent_b_ = false; pscore_l_=0; - offset_ = Offset (0,0); - output = 0; - status_ = ORPHAN; + status_i_ = 0; } Score_elem::Score_elem (Score_elem const&s) + : Graphical_element (s) { /* called from derived ctor, so most info points to the same deps as (Directed_graph_node&)s. Nobody points to us, so don't copy @@ -39,22 +35,14 @@ Score_elem::Score_elem (Score_elem const&s) */ copy_edges_out (s); transparent_b_ = s.transparent_b_; - empty_b_ = s.empty_b_; - axis_group_l_a_[0] = axis_group_l_a_[1] =0; - status_ = s.status_; - assert (!s.output); - output = 0; + status_i_ = s.status_i_; pscore_l_ = s.pscore_l_; - offset_ = Offset (0,0); } Score_elem::~Score_elem() { - // some paranoia to prevent weird segv's - assert (status_ < DELETED); - delete output; - status_ = DELETED; - output = 0; + assert (status_i_ >=0); + status_i_ = -1; } Score_elem* @@ -81,130 +69,17 @@ Score_elem::dependent_size() const return get_in_edge_arr().size (); } -String -Score_elem::make_TeX_string (Offset o)const -{ - String s ("\\placebox{%}{%}{%}"); - Array<String> a; - a.push (print_dimen (o.y())); - a.push (print_dimen (o.x())); - String t = output->TeX_string(); - if (!t) - return t; - - a.push (t); - String r; - if (check_debug) - r = String ("\n%start: ") + name() + "\n"; - r += substitute_args (s, a); - return r; -} -String -Score_elem::do_TeX_output_str () const -{ - return make_TeX_string(absolute_offset()); -} - -/* - GEOMETRY - */ -Real -Score_elem::absolute_coordinate (Axis a) const -{ - Real r = offset_[a]; - for (Axis_group_element * axis_group_l = axis_group_l_a_[a]; - axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a]) - - r += axis_group_l->offset_[a]; - return r; -} - -Offset -Score_elem::absolute_offset() const -{ - return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS)); -} - -void -Score_elem::translate (Real y, Axis a) -{ - offset_[a] += y; -} - -Real -Score_elem::relative_coordinate (Axis_group_element*e, Axis a) const -{ - Real r =0.0; - for (Axis_group_element * axis_group_l = axis_group_l_a_[a]; - axis_group_l != e; - axis_group_l = axis_group_l->axis_group_l_a_[a]) - r += axis_group_l->offset_[a]; - - return r; -} - -Axis_group_element* -Score_elem::common_group (Score_elem const* s, Axis a) const -{ - Link_array<Axis_group_element> my_groups; - for (Axis_group_element * axis_group_l = axis_group_l_a_[a]; - axis_group_l; - axis_group_l = axis_group_l->axis_group_l_a_[a]) - my_groups.push (axis_group_l); - - Axis_group_element* common_l=0; - for (Axis_group_element * axis_group_l = s->axis_group_l_a_[a]; - !common_l && axis_group_l; - axis_group_l = axis_group_l->axis_group_l_a_[a]) - common_l = my_groups.find_l (axis_group_l); - - return common_l; -} - - - -void -Score_elem::translate (Offset O) -{ - offset_ += O; -} Interval Score_elem::do_width() const { Interval r; - if (!output) - { - Molecule*m = brew_molecule_p(); - r = m->extent().x (); - delete m; - } - else - r = output->extent().x (); - return r; -} - -Interval -Score_elem::width() const -{ - return extent (X_AXIS); -} - -Interval -Score_elem::extent (Axis a) const -{ - Interval r; - if (!empty_b_) - { - - r = (a == X_AXIS)? do_width(): do_height (); - } + Molecule*m = brew_molecule_p(); + r = m->extent().x (); + delete m; - if (!r.empty_b()) // float exception on DEC Alpha - r+=offset_[a]; - return r; } @@ -212,22 +87,12 @@ Interval Score_elem::do_height() const { Interval r; - if (!output) - { - Molecule*m = brew_molecule_p(); - r = m->extent().y (); - delete m; - } - else - r = output->extent().y (); + Molecule*m = brew_molecule_p(); + r = m->extent().y (); + delete m; return r; } -Interval -Score_elem::height() const -{ - return extent (Y_AXIS); -} /* STANDARD METHS @@ -239,13 +104,9 @@ Score_elem::print() const DOUT << name() << "{\n"; DOUT << "dets: " << dependent_size() << "dependencies: " << dependency_size(); - if (offset_.x() || offset_.y ()) - DOUT << "offset (" << offset_.x() << ", " << offset_.y () <<")"; - DOUT << "\n"; - + + Graphical_element::print (); do_print(); - if (output) - output->print(); DOUT << "}\n"; #endif @@ -259,86 +120,54 @@ Score_elem::paper() const return pscore_l_->paper_l_; } + void Score_elem::add_processing() { - if (status_ >= VIRGIN) + if (status_i_) return; - status_ = VIRGIN; + status_i_ ++; do_add_processing(); } -void -Score_elem::pre_processing() -{ - if (status_ >= PRECALCED) - return; - - assert (status_ != PRECALCING); // cyclic dependency - status_ = PRECALCING; - - for (int i=0; i < dependency_size(); i++) - dependency (i)->pre_processing(); - - Link_array<Score_elem> extra (get_extra_dependencies()); - for (int i=0; i < extra.size(); i++) - extra[i]->pre_processing(); - - do_pre_processing(); - status_ = PRECALCED; -} void -Score_elem::breakable_col_processing() +Score_elem::calcalute_dependencies (int final, int busy, + Score_elem_method_pointer funcptr) { - if (status_ >= PREBROKEN) + if (status_i_ >= final) return; - if (status_== PREBREAKING) - { - status_ = PREBROKEN; - return ; - } - status_ = PREBREAKING; + assert (status_i_!= busy); + status_i_= busy; for (int i=0; i < dependency_size(); i++) - dependency (i)->breakable_col_processing(); + dependency (i)->calcalute_dependencies (final, busy, funcptr); Link_array<Score_elem> extra (get_extra_dependencies()); for (int i=0; i < extra.size(); i++) - extra[i]->breakable_col_processing(); + extra[i]->calcalute_dependencies (final, busy, funcptr); - - do_breakable_col_processing(); - status_ = PREBROKEN; + invalidate_cache (X_AXIS); + invalidate_cache (Y_AXIS); + (this->*funcptr)(); + status_i_= final; } void -Score_elem::break_processing() +Score_elem::do_brew_molecule () { - if (status_ >= BROKEN) - return; - - if (status_ == BREAKING) - { - status_ = BROKEN; - return; - } - status_ = BREAKING; - - for (int i=0; i < dependency_size(); i++) - dependency (i)->break_processing(); - - Link_array<Score_elem> extra (get_extra_dependencies()); - for (int i=0; i < extra.size(); i++) - extra[i]->break_processing(); - + if (transparent_b_) + return ; + Molecule *output= brew_molecule_p (); + pscore_l_->outputter_l_->output_molecule (output, absolute_offset ()); +} +/* - do_break_processing(); - status_ = BROKEN; + VIRTUAL STUBS -} + */ void Score_elem::do_break_processing() @@ -346,81 +175,6 @@ Score_elem::do_break_processing() handle_broken_dependencies(); } - -void -Score_elem::post_processing() -{ - if (status_ >= POSTCALCED) - return; - assert (status_ != POSTCALCING);// cyclic dependency - status_=POSTCALCING; - - - for (int i=0; i < dependency_size(); i++) - dependency (i)->post_processing(); - - Link_array<Score_elem> extra (get_extra_dependencies()); - for (int i=0; i < extra.size(); i++) - extra[i]->post_processing(); - - - do_post_processing(); - status_=POSTCALCED; -} - -Score_elem::Status -Score_elem::status() const -{ - return status_; -} - -void -Score_elem::molecule_processing() -{ - if (status_ >= BREWED) - return; - status_ = BREWED; // do it only once. - - for (int i=0; i < dependency_size(); i++) - dependency (i)->molecule_processing(); - - Link_array<Score_elem> extra (get_extra_dependencies()); - for (int i=0; i < extra.size(); i++) - extra[i]->molecule_processing(); - - - if (transparent_b_) - return ; - output= brew_molecule_p(); -} - -String -Score_elem::TeX_output_str() const -{ - String s; - if (status_ >= TEXOUTPUT) - return ""; - - ((Score_elem*)this)->status_ = TEXOUTPUT; - - for (int i=0; i < dependency_size(); i++) - s += dependency (i)->TeX_output_str(); - - Link_array<Score_elem> extra (get_extra_dependencies()); - for (int i=0; i < extra.size(); i++) - s += extra[i]->TeX_output_str (); - - if (!transparent_b_) - s+= do_TeX_output_str(); - - return s; -} - -/* - - VIRTUAL STUBS - - */ void Score_elem::do_post_processing() { @@ -461,7 +215,7 @@ Score_elem::do_junk_links() { } -IMPLEMENT_IS_TYPE_B(Score_elem); +IMPLEMENT_IS_TYPE_B1(Score_elem, Graphical_element); Molecule* Score_elem::brew_molecule_p() const @@ -540,7 +294,7 @@ Score_elem::handle_broken_dependencies() for (int i=0; i <remove_us_arr.size(); i++) remove_dependency (remove_us_arr[i]); - status_ = BROKEN; + // status_i_= BROKEN; } /* @@ -589,23 +343,16 @@ Score_elem::handle_prebroken_dependencies() substitute_dependency (old_arr[i], new_arr[i]); - status_ = PREBROKEN; + // status_i_= PREBROKEN; } - void -Score_elem::unlink_all() +Score_elem::junk_links () { - for (int i=0; i < dependency_size(); i++) - dependency (i)->unlink_all(); - Link_array<Score_elem> extra (get_extra_dependencies()); - for (int i=0; i < extra.size(); i++) - extra[i]->unlink_all(); - - junk_links(); - axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0; - do_unlink(); + Directed_graph_node::junk_links(); + Graphical_element::junk_links (); + do_junk_links(); } void @@ -624,19 +371,8 @@ Score_elem::unlink() for (int j=0; j < 2; j++) if (axis_group_l_a_[j]) axis_group_l_a_[j]->remove_element (this); - } -void -Score_elem::OK() const -{ -#ifndef NDEBUG - for (int i=0; i < dependency_size(); i++) - { - dependency (i)->OK(); - } -#endif -} Link_array<Score_elem> Score_elem::get_extra_dependencies() const @@ -651,3 +387,5 @@ Score_elem::linked_b() const return get_extra_dependencies().size() || dependency_size(); } + + diff --git a/lily/score-grav.cc b/lily/score-grav.cc index bad0498dcc..c08afae18e 100644 --- a/lily/score-grav.cc +++ b/lily/score-grav.cc @@ -232,9 +232,9 @@ IMPLEMENT_IS_TYPE_B1(Score_engraver,Engraver_group_engraver); ADD_THIS_TRANSLATOR(Score_engraver); void -Score_engraver::add_processing () +Score_engraver::do_add_processing () { - Translator_group::add_processing (); + Translator_group::do_add_processing (); assert (output_def_l_->is_type_b (Paper_def::static_name ())); assert (!daddy_trans_l_); pscore_p_ = new Paper_score; diff --git a/lily/score-performer.cc b/lily/score-performer.cc index 75e9fc2200..9db18a916f 100644 --- a/lily/score-performer.cc +++ b/lily/score-performer.cc @@ -92,9 +92,9 @@ Score_performer::get_output_p () } void -Score_performer::add_processing () +Score_performer::do_add_processing () { - Translator_group::add_processing (); + Translator_group::do_add_processing (); assert (output_def_l_->is_type_b (Midi_def::static_name ())); performance_p_ = new Performance; performance_p_->midi_l_ = (Midi_def*) output_def_l_; diff --git a/lily/score.cc b/lily/score.cc index f1adcc0def..5e8fa7e7f1 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -16,6 +16,7 @@ #include "music.hh" #include "global-translator.hh" #include "header.hh" +#include "cpu-timer.hh" extern String default_out_fn; @@ -45,6 +46,7 @@ Score::~Score() void Score::run_translator (Music_output_def *odef_l) { + Cpu_timer timer; Global_translator * trans_p = odef_l->get_global_translator_p(); if (!trans_p) return ; @@ -94,7 +96,9 @@ Score::run_translator (Music_output_def *odef_l) Music_output * output = trans_p->get_output_p(); delete trans_p; + *mlog << " (time: " << String(timer.read (), "%.2f") << " seconds)"; + output->header_l_ = header_p_; output->default_out_str_ = default_out_fn; output->origin_str_ = location_str(); diff --git a/lily/scoreline.cc b/lily/scoreline.cc index f332409152..2bd4f870b4 100644 --- a/lily/scoreline.cc +++ b/lily/scoreline.cc @@ -15,23 +15,6 @@ #include "p-score.hh" -/* To do: - - take out hard coded TeX stuff. - */ -String -Line_of_score::TeX_output_str () const -{ - String s ("\\hbox{%<- line of score\n"); - if (error_mark_b_) - s+= "\\scorelineerrormark"; - - s+= Score_elem::TeX_output_str(); - s += "}"; - return s; -} - - Line_of_score::Line_of_score() { error_mark_b_ = 0; @@ -131,10 +114,26 @@ Line_of_score::do_width() const return Spanner::do_width(); } +Link_array<Score_elem> +Line_of_score::get_extra_dependencies () const +{ + Link_array<Score_elem> r; + for (int i=0; i < cols.size (); i++) + r.push (cols[i]); + return r; +} + void -Line_of_score::do_breakable_col_processing() +Line_of_score::do_unlink () { for (int i=0; i < cols.size (); i++) - cols[i]->breakable_col_processing(); - Spanner::do_breakable_col_processing(); + cols[i]->line_l_ =0; + cols.set_size (0); +} + + +void +Line_of_score::do_junk_links () +{ + cols.set_size (0); } diff --git a/lily/script-grav.cc b/lily/script-grav.cc index d49c447fb5..1fed7f0299 100644 --- a/lily/script-grav.cc +++ b/lily/script-grav.cc @@ -25,7 +25,6 @@ Script_engraver::do_try_request (Request *r_l) { if (r_l->equal_b (script_req_l_arr_[i])) return true; - } script_req_l_arr_.push (r_l->script()); @@ -35,6 +34,9 @@ Script_engraver::do_try_request (Request *r_l) void Script_engraver::do_process_requests() { + if (script_p_arr_.size ()) + return ; + for (int i=0; i < script_req_l_arr_.size(); i++) { Script_req* l=script_req_l_arr_[i]; diff --git a/lily/script.cc b/lily/script.cc index ea3bfbef20..073fc7cd93 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -80,7 +80,8 @@ Script::do_pre_processing() { if (breakable_b_ && break_status_i() != 1) { - transparent_b_ = empty_b_ = true; + transparent_b_ = true; + set_empty (true); } if (!dir_) diff --git a/lily/slur.cc b/lily/slur.cc index a4349ab750..aadb9d44b9 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -89,7 +89,6 @@ Slur::do_post_processing() Direction d=LEFT; Real nw_f = paper()->note_width (); - while ((d *= -1) != LEFT); do { if (extrema[d] != spanned_drul_[d]) diff --git a/lily/span-bar.cc b/lily/span-bar.cc index ba2c3739f2..e23b322678 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -63,7 +63,7 @@ Span_bar::do_pre_processing() if (spanning_l_arr_.size() < 1) { transparent_b_ = true; - empty_b_ =true; + set_empty (true); } else { @@ -72,7 +72,7 @@ Span_bar::do_pre_processing() if (!type_str_) { transparent_b_=true; - empty_b_ = true; + set_empty (true); } else if (type_str_ == "|:") { diff --git a/lily/span-score-bar.cc b/lily/span-score-bar.cc index 96c73a9d1d..97b195ef1e 100644 --- a/lily/span-score-bar.cc +++ b/lily/span-score-bar.cc @@ -23,7 +23,8 @@ Span_score_bar::do_pre_processing() if (break_status_i() != 1) { - empty_b_ = transparent_b_ = true; + set_empty (true); + transparent_b_ = true; } } diff --git a/lily/spanner.cc b/lily/spanner.cc index 07eb278b84..3685865b8f 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -10,7 +10,7 @@ #include "spanner.hh" #include "p-col.hh" #include "p-score.hh" - +#include "outputter.hh" IMPLEMENT_IS_TYPE_B1(Spanner,Score_elem); @@ -113,11 +113,15 @@ Spanner::Spanner() spanned_drul_[RIGHT]=0; } -String -Spanner::do_TeX_output_str () const +void +Spanner::do_brew_molecule () { + if (transparent_b_) + return ; + Molecule *output= brew_molecule_p (); Offset left_off (spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), 0); - return make_TeX_string (absolute_offset() + left_off); + Offset o = absolute_offset() + left_off; + pscore_l_->outputter_l_->output_molecule (output, o); } Interval diff --git a/lily/stem-grav.cc b/lily/stem-grav.cc index 2d81cc58f2..c2114bf972 100644 --- a/lily/stem-grav.cc +++ b/lily/stem-grav.cc @@ -17,9 +17,20 @@ Stem_engraver::Stem_engraver() { abbrev_req_l_ = 0; stem_p_ = 0; + default_abbrev_i_ = 16; dir_ = CENTER; } +void +Stem_engraver::do_creation_processing () +{ + Scalar prop = get_property ("abbrev"); + if (prop && prop.isnum ()) + { + default_abbrev_i_ = prop; + } +} + void Stem_engraver::acknowledge_element(Score_elem_info i) { @@ -31,10 +42,18 @@ Stem_engraver::acknowledge_element(Score_elem_info i) Rhythmic_req * r = i.req_l_->musical()->rhythmic(); stem_p_ = new Stem; int durlog_i = r->duration_.durlog_i_; - stem_p_->flag_i_ = Duration_convert::type2_i(durlog_i); + stem_p_->flag_i_ = durlog_i; + + if (abbrev_req_l_) - stem_p_->abbrev_flag_i_ = intlog2 (abbrev_req_l_->type_i_) - - (durlog_i>? 2); + { + int t = abbrev_req_l_->type_i_; + if (!t) + t = default_abbrev_i_; + else + default_abbrev_i_ = t; + stem_p_->abbrev_flag_i_ = intlog2 (t) - (durlog_i>? 2); + } announce_element (Score_elem_info (stem_p_, r)); } stem_p_->add (h); diff --git a/lily/stem.cc b/lily/stem.cc index 875db21405..60f7b1bad3 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -4,6 +4,8 @@ source file of the GNU LilyPond music typesetter (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl> + + TODO: This is way too hairy */ #include "stem.hh" @@ -33,8 +35,8 @@ Stem::Stem () beams_right_i_ = 0; stem_bottom_f_ = stem_top_f_ = 0; - flag_i_ = 4; - dir_ =CENTER; + flag_i_ = 2; + dir_ = CENTER; staff_size_i_ = 8; stem_xoffset_f_ =0; @@ -64,7 +66,9 @@ void Stem::do_print () const { #ifndef NPRINT - DOUT << "flag "<< flag_i_ << " print_flag? " << !(bool)beam_l_ << "abbrev_flag_i_" << abbrev_flag_i_; + DOUT << "flag "<< flag_i_ << "abbrev_flag_i_" << abbrev_flag_i_; + if (beam_l_) + DOUT << "beamed"; #endif } @@ -109,7 +113,7 @@ void Stem::add (Note_head *n) { n->add_dependency (this); - head_l_arr_.push (n); + head_l_arr_.push (n); } void @@ -123,13 +127,12 @@ bool Stem::invisible_b () const { - return !head_l_arr_.size () || - head_l_arr_[0]->balltype_i_ <= 0; + return (!head_l_arr_.size () || + head_l_arr_[0]->balltype_i_ <= 0); } // if dir_ is set we return fake values. - int Stem::get_center_distance_from_top () { @@ -159,7 +162,7 @@ Stem::get_default_dir () if (dir_) return dir_; return (get_center_distance_from_top () >= - get_center_distance_from_bottom ()) ? + get_center_distance_from_bottom ()) ? (Direction)-1 : (Direction)1; } @@ -178,8 +181,8 @@ Stem::set_default_stemlen () // ugh... how about non 5-line staffs? bool on_ledger_line_b = ((max_head_i () < -2 && dir_ == 1) -// || (min_head_i () > staff_size_i_ && dir_ == -1)); - || (min_head_i () > staff_size_i_ + 3 && dir_ == -1)); + // || (min_head_i () > staff_size_i_ && dir_ == -1)); + || (min_head_i () > staff_size_i_ + 3 && dir_ == -1)); if (on_ledger_line_b) { set_stemend (staff_size_i_ / 2 - 1); @@ -254,10 +257,9 @@ Stem::do_pre_processing () if (stem_bottom_f_== stem_top_f_) set_default_extents (); set_noteheads (); - flag_i_ = dir_ * abs (flag_i_); + flag_i_ = flag_i_; transparent_b_ = invisible_b (); - empty_b_ = invisible_b (); - + set_empty (invisible_b ()); } @@ -269,68 +271,68 @@ Stem::do_width () const { r = abbrev_mol ().extent ().x (); } - else if (beam_l_ || abs (flag_i_) <= 4) + else if (beam_l_ || abs (flag_i_) <= 2) ; // TODO! else { Paper_def*p= paper (); - r = p->lookup_l ()->flag (flag_i_).dim.x (); + r = p->lookup_l ()->flag (flag_i_, dir_).dim.x (); r+= stem_xoffset_f_; } return r; } - + Molecule -Stem::abbrev_mol () const + Stem::abbrev_mol () const { Real dy = paper ()->interbeam_f (); Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim.x ().length (); Real beamdy = paper ()->interline_f () / 2; - + int beams_i = 0; Real slope = paper ()->internote_f () / 4; - + if (beam_l_) { // huh? - slope = 2 * beam_l_->slope; + slope = 2 * beam_l_->slope; // ugh, rather calc from Abbreviation_req - beams_i = beams_right_i_ >? beams_left_i_; + beams_i = beams_right_i_ >? beams_left_i_; } paper ()->lookup_l ()->beam (slope, 20 PT); - + Molecule beams; Atom a (paper ()->lookup_l ()->beam (slope, w)); a.translate (Offset(- w / 2, stem_end_f () - (w / 2 * slope))); // ugh - if (!beams_i) - a.translate (dy + beamdy - dir_ * dy, Y_AXIS); - else - a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS); - + if (!beams_i) + a.translate (dy + beamdy - dir_ * dy, Y_AXIS); + else + a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS); + for (int i = 0; i < abbrev_flag_i_; i++) { Atom b (a); b.translate (-dir_ * dy * (beams_i + i), Y_AXIS); beams.add (b); } - + return beams; } Molecule* -Stem::brew_molecule_p () const + Stem::brew_molecule_p () const { Molecule *mol_p =new Molecule; - + Real bot = stem_bottom_f_; Real top = stem_top_f_; assert (bot!=top); - + Paper_def *p =paper (); - + Real dy = p->internote_f (); if (!invisible_b ()) { @@ -338,23 +340,13 @@ Stem::brew_molecule_p () const mol_p->add (Atom (ss)); } - if (!beam_l_ &&abs (flag_i_) > 4) + if (!beam_l_ &&abs (flag_i_) > 2) { - Symbol fl = p->lookup_l ()->flag (flag_i_); - Molecule m (fl); - if (flag_i_ < -4) - { - mol_p->add_at_edge (Y_AXIS, DOWN, m); - } - else if (flag_i_ > 4) - { - mol_p->add_at_edge (Y_AXIS, UP, m); - } - else - assert (false); - assert (!abbrev_flag_i_); - } - + Symbol fl = p->lookup_l ()->flag (flag_i_, dir_); + mol_p->add_at_edge (Y_AXIS, dir_, Molecule (Atom (fl))); + assert (!abbrev_flag_i_); + } + if (abbrev_flag_i_) mol_p->add (abbrev_mol ()); @@ -363,14 +355,14 @@ Stem::brew_molecule_p () const } Real -Stem::hpos_f () const + Stem::hpos_f () const { return Item::hpos_f () + stem_xoffset_f_; } void -Stem::do_substitute_dependency (Score_elem*o,Score_elem*n) + Stem::do_substitute_dependency (Score_elem*o,Score_elem*n) { Item * o_l = o->item (); Item * n_l = n? n->item () : 0; diff --git a/lily/super-elem.cc b/lily/super-elem.cc index ef162d0a0b..0cc425198c 100644 --- a/lily/super-elem.cc +++ b/lily/super-elem.cc @@ -10,19 +10,7 @@ #include "scoreline.hh" #include "p-score.hh" #include "string.hh" - -String -Super_elem::TeX_output_str() const -{ - String s; - for (int i=0; i < lines_arr_.size(); i++) - { - s += lines_arr_[i]->TeX_output_str(); - if (i + 1<lines_arr_.size()) - s += "\\interscoreline"; // TODO - } - return s; -} +#include "outputter.hh" void Super_elem::handle_broken_dependencies() @@ -53,3 +41,69 @@ Super_elem::do_add_processing() } IMPLEMENT_IS_TYPE_B1(Super_elem,Score_elem); + + +/** + for administration of what was done already + */ +enum Score_elem_status { + ORPHAN=0, // not yet added to pstaff + VIRGIN, // added to pstaff + PREBROKEN, + PRECALCING, + PRECALCED, // calcs before spacing done + BROKEN, + POSTCALCING, // busy calculating. This is used to trap cyclic deps. + POSTCALCED, // after spacing calcs done + BREWING, + BREWED, + UNLINKING, + UNLINKED, +}; + +void +Super_elem::pre_processing () +{ + calcalute_dependencies (PRECALCING, PRECALCED, &Score_elem::do_pre_processing); +} + +/* for break processing, use only one status, because copies have to + have correct status. (Previously, + Score_elem::handle_[pre]broken_dependencies assigned to status_i_ + */ +void +Super_elem::breakable_col_processing () +{ + calcalute_dependencies (PREBROKEN, PREBROKEN, &Score_elem::do_breakable_col_processing); +} + +void +Super_elem::break_processing () +{ + calcalute_dependencies (BROKEN, BROKEN, &Score_elem::do_break_processing); +} +void +Super_elem::post_processing () +{ + calcalute_dependencies (POSTCALCING, POSTCALCED, &Score_elem::do_post_processing); +} + +void +Super_elem::output_all () +{ + for (int i=0; i < lines_arr_.size(); i++) + { + pscore_l_->outputter_l_->start_line (); + lines_arr_[i]->calcalute_dependencies (BREWING, BREWED, &Score_elem::do_brew_molecule); + pscore_l_->outputter_l_->stop_line (); + } +} + + + +void +Super_elem::unlink_all () +{ + calcalute_dependencies (UNLINKING, UNLINKED, &Score_elem::junk_links); +} + diff --git a/lily/tie-grav.cc b/lily/tie-grav.cc index c7201bde2e..385de4ab05 100644 --- a/lily/tie-grav.cc +++ b/lily/tie-grav.cc @@ -104,11 +104,14 @@ Tie_engraver::do_pre_move_processing() } } -Tie_engraver::~Tie_engraver() +void +Tie_engraver::do_removal_processing () { + do_pre_move_processing (); if (tie_p_) { req_l_->warning ("unended Tie"); + tie_p_->unlink (); delete tie_p_; } } diff --git a/lily/translator-group.cc b/lily/translator-group.cc index cd7b6e62e9..c824164d50 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -115,12 +115,17 @@ Translator_group::find_create_translator_l (String n, String id) return existing; Link_array<Translator_group> path = path_to_acceptable_translator (n); - - if (path.size ()) + + /* + if path.size () == 1, then + type_str_ == n, but not id == id_str_ + */ + if (path.size () > 1) { + assert (path.size () > 1); Translator_group * current = this; - // start at 1. The first one will be us. + // start at 1. The first one (index 0) will be us. for (int i=1; i < path.size (); i++) { Translator_group * new_group = path[i]->clone ()->group_l (); @@ -130,9 +135,8 @@ Translator_group::find_create_translator_l (String n, String id) current->id_str_ = id; return current; } - - Translator_group * ret =0; + Translator_group *ret = 0; if (daddy_trans_l_) ret = daddy_trans_l_->find_create_translator_l (n,id); else @@ -208,7 +212,14 @@ Translator * Translator_group::remove_translator_p (Translator*trans_l) { PCursor<Translator*> trans_cur (trans_p_list_.find (trans_l)); - return trans_cur.remove_p(); + Translator * t = trans_cur.remove_p(); + /* + For elegant design, we would do this too. Alas, it does not work yet.. + + t-> removal_processing (); + */ + t-> daddy_trans_l_ = 0; + return t; } @@ -314,9 +325,8 @@ Translator_group::do_removal_processing () } void -Translator_group::add_processing () +Translator_group::do_add_processing () { - Translator::add_processing (); for (int i=0; i < consists_str_arr_.size(); i++) { Translator * t = output_def_l ()->find_translator_l (consists_str_arr_[i]); diff --git a/lily/translator.cc b/lily/translator.cc index 636123a950..58b4c58917 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -24,6 +24,7 @@ Translator::Translator () } Translator::Translator (Translator const &s) + : Input (s) { status = ORPHAN; daddy_trans_l_ =0; @@ -55,8 +56,16 @@ Translator::now_moment () const void Translator::add_processing () { - if (status == ORPHAN) - status = VIRGIN; + if (status > ORPHAN) + return; + + do_add_processing (); + status = VIRGIN; +} + +void +Translator::do_add_processing () +{ } void @@ -65,7 +74,7 @@ Translator::print () const #ifndef NPRINT DOUT << name () << " {"; if (name () != type_str_) - DOUT << "type= " << type_str_; + DOUT << "type = " << type_str_; for (Dictionary_iter<Scalar> i (properties_dict_); i.ok (); i++) { DOUT << i.key () << "=" << i.val () <<"\n"; @@ -107,8 +116,12 @@ Translator::post_move_processing() void Translator::removal_processing() { + if (status == ORPHAN) + return; creation_processing(); do_removal_processing(); + // elegancy ... + // status = ORPHAN; } diff --git a/lily/vertical-align-elem.cc b/lily/vertical-align-elem.cc index 02d1823b25..4f83ba1b7b 100644 --- a/lily/vertical-align-elem.cc +++ b/lily/vertical-align-elem.cc @@ -64,7 +64,7 @@ Vertical_align_element::contains_b (Score_elem const *e) const Vertical_align_element::Vertical_align_element() { transparent_b_ = true; - empty_b_ =true; + set_empty (true); } diff --git a/lily/word-wrap.cc b/lily/word-wrap.cc index 5814012ca0..5f61be35d3 100644 --- a/lily/word-wrap.cc +++ b/lily/word-wrap.cc @@ -101,7 +101,6 @@ Word_wrap::do_solve() const *mlog << "[" <<break_idx_i<<"]"<<flush; breaking.push (minimum); } - print_stats(); return breaking; } diff --git a/make/lilypond.lsm b/make/lilypond.lsm index 55823d2e0a..d554febe9e 100644 --- a/make/lilypond.lsm +++ b/make/lilypond.lsm @@ -1,7 +1,7 @@ Begin3 Title: LilyPond -Version: 0.1.13 -Entered-date: 11SEP97 +Version: 0.1.14 +Entered-date: 14SEP97 Description: LilyPond is the GNU Project music typesetter. This program converts music definition files into visual or auditive output: it can typeset formatted @@ -14,8 +14,8 @@ Author: hanwen@stack.nl (Han-Wen Nienhuys) jan@digicash.com (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps - 395k lilypond-0.1.13.tar.gz + 395k lilypond-0.1.14.tar.gz Original-site: pcnov095.win.tue.nl /pub/lilypond/ - 395k lilypond-0.1.13.tar.gz + 395k lilypond-0.1.14.tar.gz Copying-policy: GPL End diff --git a/make/lilypond.spec b/make/lilypond.spec index dbee70b290..4717e5d444 100644 --- a/make/lilypond.spec +++ b/make/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 0.1.13 +Version: 0.1.14 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.13.tar.gz +Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.14.tar.gz Summary: A preprocessor to make TeX typeset music. URL: http://www.stack.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys <hanwen@stack.nl> diff --git a/mf/dimen.tex b/mf/dimen.tex index 1b38526a5c..9134edf382 100644 --- a/mf/dimen.tex +++ b/mf/dimen.tex @@ -2,7 +2,7 @@ % A tex file to help determine dims. % -\font\musicfont=musix16 +\font\musicfont=opus20 %musix16 \font\slurfont=xslu16 \font\specfont=musixspx \def\thefont{\musicfont} @@ -35,16 +35,16 @@ \repeat% } \def\twhrul{\hbox to 0pt{\hbox{\hruler{20}% - \vrule width0.1pt height 2pt depth 2pt}}} + \vrule width0.1pt height 2pt depth 2pt}}} \def\twvrul{\vbox to0pt{\vss\hbox to0pt{\hss\vruler{12}}\vss}% - \kern-1pt\vrule width4pt height 0.1pt}% - + \kern-1pt\vrule width4pt height 0.1pt}% + \def\doitem#1{ #1% \vbox to12pt{\vfill\hbox to0pt{\qquad\kern-1pt\twvrul\hss}}% \hbox to50pt{\qquad\twhrul\mb{#1}\hss}% - \setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0} + \setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0} \newcount\n \def\charn{\n=-1 diff --git a/mudela-mode.el b/mudela-mode.el new file mode 100644 index 0000000000..1707a46b9f --- /dev/null +++ b/mudela-mode.el @@ -0,0 +1,205 @@ +;;; mudela-mode.el --- Major mode for editing Mudela programs + + +;; Copyright (C) 1992,1993,1994 Tim Peters + +;; Author: 1997: Han-Wen Nienhuys +;; Author: 1995-1996 Barry A. Warsaw +;; 1992-1994 Tim Peters +;; Created: Feb 1992 +;; Version: 0.0 +;; Last Modified: 12SEP97 +;; Keywords: mudela languages music + +;; This software is provided as-is, without express or implied +;; warranty. Permission to use, copy, modify, distribute or sell this +;; software, without fee, for any purpose and by any individual or +;; organization, is hereby granted, provided that the above copyright +;; notice and this paragraph appear in all copies. + + + +;; Kyrie Eleison; it is my first real Elisp file +;; This is a cannabalised version of python-mode.el (HWN) +;; +;; TODO: +;; * should handle block comments too. +;; * handle lexer modes (\header, \melodic, \lyric) etc. +;; * indentation +;; * notenames? +;; * fontlock: \melodic \melodic + +(defconst mudela-font-lock-keywords + (let* ((keywords '( + "accepts" "bar" "cadenza" "clear" "clef" "cm" "consists" "contains" + "duration" "absdynamic" "in" "translator" "type" "lyric" "key" + "melodic" "melodic_request" "meter" "midi" "mm" "multi" "header" + "notenames" "octave" "output" "partial" "paper" "plet" "property" "pt" + "include" + "score" "script" "skip" "staff" "table" "spandynamic" "symboltables" + "tempo" "texid" "textstyle" "transpose" "version" "grouping" + )) + (kwregex (mapconcat (lambda (x) (concat "\\\\" x)) keywords "\\|"))) + + (list + (cons (concat ".\\(" kwregex "\\)[^a-zA-Z]") 1) + (cons (concat "^\\(" kwregex "\\)[^a-zA-Z]") 1) + '(".\\(\\\\[a-zA-Z][a-zA-Z]*\\)" 1 font-lock-variable-name-face) + '("^[\t ]*\\([a-zA-Z][_a-zA-Z]*\\) *=" 1 font-lock-variable-name-face) + )) + "Additional expressions to highlight in Mudela mode.") + +;; define a mode-specific abbrev table for those who use such things +(defvar mudela-mode-abbrev-table nil + "Abbrev table in use in `mudela-mode' buffers.") + +(define-abbrev-table 'mudela-mode-abbrev-table nil) + +(defvar mudela-mode-hook nil + "*Hook called by `mudela-mode'.") + +(defvar mu-mode-map () + "Keymap used in `mudela-mode' buffers.") + +(defun mu-newline-and-indent () + (interactive) + (newline) + (indent-relative-maybe) + "Newline and copy previous indentation") + +(if mu-mode-map + () + (setq mu-mode-map (make-sparse-keymap)) + + (mapcar (function (lambda (key) + (define-key + mu-mode-map key 'mu-newline-and-indent))) + (where-is-internal 'newline-and-indent)) + + (mapcar (function + (lambda (x) + (define-key mu-mode-map (car x) (cdr x)))) + '(("\C-c\C-c" . mu-foo-bar) + )) + ;; should do all keybindings this way + (define-key mu-mode-map [RET] 'mu-newline-and-indent) + ) + +(defvar mu-mode-syntax-table nil + "Syntax table used in `mudela-mode' buffers.") + +;; +(if mu-mode-syntax-table + () + (setq mu-mode-syntax-table (make-syntax-table)) + (mapcar (function + (lambda (x) (modify-syntax-entry + (car x) (cdr x) mu-mode-syntax-table))) + '(( ?\( . "()" ) ( ?\) . ")(" ) + ( ?\[ . "(]" ) ( ?\] . ")[" ) + ( ?\{ . "(}" ) ( ?\} . "){" ) + ( ?\< . "(>" )( ?\> . ")>") + ( ?\$ . "." ) ( ?\% . "." ) ( ?\& . "." ) + ( ?\* . "." ) ( ?\+ . "." ) ( ?\- . "." ) + ( ?\/ . "." ) ( ?\= . "." ) + ( ?\| . "." ) (?\\ . "\\" ) + ( ?\_ . "." ) + ( ?\' . "w") + ( ?\" . "\"" ) + ( ?\% . "<") + ( ?\n . ">") + + ))) + +(defconst mu-stringlit-re + "\"\\([^\"\n\\]\\|\\\\.\\)*\"" ; double-quoted + "Regexp matching a Mudela string literal.") + + +(defconst mu-blank-or-comment-re "[ \t]*\\($\\|%\\)" + "Regexp matching blank or comment lines.") + +(defconst mu-imenu-generic-re "^\\([a-zA-Z_][a-zA-Z0-9_]*\\) *=" + "Regexp matching Identifier definitions.") + +;; Sadly we need this for a macro in Emacs 19. +(eval-when-compile + ;; Imenu isn't used in XEmacs, so just ignore load errors. + (condition-case () + (require 'imenu) + (error nil))) + +(defvar mu-imenu-generic-expression + (list (list nil mu-imenu-generic-re 1)) + "Expression for imenu") + +(defun mudela-mode () + "Major mode for editing Mudela files." + + (interactive) + ;; set up local variables + (kill-all-local-variables) + (make-local-variable 'font-lock-defaults) + (make-local-variable 'paragraph-separate) + (make-local-variable 'paragraph-start) + (make-local-variable 'require-final-newline) + (make-local-variable 'comment-start) + (setq comment-start "% ") + (setq comment-end "") + (make-local-variable 'comment-end) + (make-local-variable 'comment-start-skip) + (setf comment-start-skip "%{") + (make-local-variable 'comment-column) + (make-local-variable 'imenu-generic-expression) + (setq imenu-generic-expression mu-imenu-generic-expression) + (make-local-variable 'indent-line-function) + + ;; + (set-syntax-table mu-mode-syntax-table) + (setq major-mode 'mudela-mode + mode-name "Mudela" + local-abbrev-table mudela-mode-abbrev-table + font-lock-defaults '(mudela-font-lock-keywords) + paragraph-separate "^[ \t]*$" + paragraph-start "^[ \t]*$" + require-final-newline t + comment-start "% " + comment-start-skip "% *" + comment-column 40 + indent-line-function 'indent-relative-maybe + ) + (use-local-map mu-mode-map) + + ;; run the mode hook. mu-mode-hook use is deprecated + (if mudela-mode-hook + (run-hooks 'mudela-mode-hook) + (run-hooks 'mu-mode-hook))) + +(defun mu-keep-region-active () + ;; do whatever is necessary to keep the region active in XEmacs. + ;; Ignore byte-compiler warnings you might see. Also note that + ;; FSF's Emacs 19 does it differently and doesn't its policy doesn't + ;; require us to take explicit action. + (and (boundp 'zmacs-region-stays) + (setq zmacs-region-stays t))) + + +(defun mu-comment-region (beg end &optional arg) + "Like `comment-region' but uses double hash (`#') comment starter." + (interactive "r\nP") + (let ((comment-start mu-block-comment-prefix)) + (comment-region beg end arg))) + +(defconst mu-version "0.0" + "`mudela-mode' version number.") +(defconst mu-help-address "hanwen@stack.nl" + "Address accepting submission of bug reports.") + +(defun mu-version () + "Echo the current version of `mudela-mode' in the minibuffer." + (interactive) + (message "Using `mudela-mode' version %s" mu-version) + (mu-keep-region-active)) + +(provide 'mu-mode) +;;; mudela-mode.el ends here diff --git a/tex/dyndefs.tex b/tex/dyndefs.tex index 630cf8e824..b31a2303e9 100644 --- a/tex/dyndefs.tex +++ b/tex/dyndefs.tex @@ -13,15 +13,15 @@ \def\kdynf{\dynnf} \def\kdynp{\dynp\kern-.1ex} -\def\dynf{\dynaf} -\def\dynpp{\kdynp\dynp} -\def\dynppp{\kdynp\kdynp\dynp} -\def\dynmp{\dynm\kern -.2ex\dynp} -\def\dynmf{\dynfont\raise.08ex\hbox{\dynm}\kern-.3ex\dynnf} -\def\dynff{\kdynf\dynnf} -\def\dynfff{\kdynf\kdynf\dynnf} +\def\dynf{{\dynaf}} +\def\dynpp{{\kdynp\dynp}} +\def\dynppp{{\kdynp\kdynp\dynp}} +\def\dynmp{{\dynm\kern -.2ex\dynp}} +\def\dynmf{{\dynfont\raise.08ex\hbox{\dynm}\kern-.3ex\dynnf}} +\def\dynff{{\kdynf\dynnf}} +\def\dynfff{{\kdynf\kdynf\dynnf}} -\def\dynfp{\kdynf\dynp} -\def\dynsf{\dyns\kern-.3ex\dynnf} -\def\dynsfz{\dynsf\dynz} +\def\dynfp{{\kdynf\dynp}} +\def\dynsf{{\dyns\kern-.3ex\dynnf}} +\def\dynsfz{{\dynsf\dynz}} diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index 670a25a644..feff7b983e 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -81,8 +81,8 @@ } \def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}} -\def\textflat{\raise.4ex\hbox{\textmusic\char"5B}} -\def\flt{\raise.2ex\hbox{\mus\char"5B}} +\def\textflat{\raise.2ex\hbox{\mus\char"5B}} + diff --git a/tex/taupindefs.tex b/tex/taupindefs.tex index 2aef5e5e87..037b7a943d 100644 --- a/tex/taupindefs.tex +++ b/tex/taupindefs.tex @@ -12,7 +12,7 @@ \font\musicfnt=musix20 \font\musicdraw=musixsps \font\italicfont=cmti10 - \font\dynfont=dyn10% scaled \magstep2 + \font\dynfont=dyn10 scaled \magstep2 \font\musicmathfont=cmsy10 } @@ -29,7 +29,7 @@ \font\hslurdfont=xslhd16 \font\hslurhfont=xslhz20 \font\musicfnt=musix16 - \font\dynfont=dyn10% scaled \magstep1 + \font\dynfont=dyn10 scaled \magstep1 \font\musicdraw=musixsps \font\musicmathfont=cmsy8 }