From 328da63607783ab1c2fc7f186f1c8bf71db27725 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:55:04 +0000 Subject: [PATCH] lilypond-1.3.81 --- CHANGES | 36 ++++++ Documentation/faq.texi | 66 ++++++++++- Documentation/regression-test.tely | 2 +- input/bugs/grace-gets-slur.ly | 11 ++ input/test/pedal.ly | 2 + input/test/slur-broken-trend.ly | 13 +++ input/test/tie-broken.ly | 17 +++ lily/all-font-metrics.cc | 2 +- lily/bar.cc | 5 +- lily/beam-engraver.cc | 5 + lily/beam.cc | 15 ++- lily/break-align-item.cc | 2 +- lily/chord-name.cc | 5 +- lily/chord-tremolo-engraver.cc | 4 + lily/clef-engraver.cc | 2 +- lily/dynamic-engraver.cc | 15 ++- lily/dynamic-performer.cc | 12 +- lily/include/slur.hh | 2 + lily/key-engraver.cc | 3 +- lily/lily-guile.cc | 4 +- lily/lookup.cc | 2 +- lily/note-head.cc | 5 +- lily/paper-outputter.cc | 11 +- lily/paper-score.cc | 4 + lily/script-engraver.cc | 3 +- lily/slur-engraver.cc | 11 +- lily/slur.cc | 172 ++++++++++++++++++++--------- lily/stem.cc | 11 +- lily/system-start-delimiter.cc | 2 +- lily/tie.cc | 37 ++++++- lily/translator.cc | 26 +++-- scm/chord-names.scm | 4 +- scm/lily.scm | 11 +- scm/slur.scm | 9 +- 34 files changed, 417 insertions(+), 114 deletions(-) create mode 100644 input/bugs/grace-gets-slur.ly create mode 100644 input/test/slur-broken-trend.ly create mode 100644 input/test/tie-broken.ly diff --git a/CHANGES b/CHANGES index 30dc75fd56..d5564b062f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,37 @@ +1.3.80.gp1 +========== + +* Added property LyricVoice.associatedVoice to enable switching associated + voice mid-stream. Association still defaults to context name. + +1.3.80.hwn1 +=========== + +* \pushproperty, \popproperty: property settings with less memory +cost. See input/test/pushproperty.ly and Documentation/hacking. Note: +syntax is most likely only temporary. + +1.3.80.jcn1 +=========== + +* (Line-)broken slurs now have vertical trend. + +* Better length for broken ties: no invisibly short ties. Now ties may + collide with time signatures, though. + +* Don't typeset unfinished spanners, but kill them. + +* Added two FAQs (Mats) + +* Made workaround guile-1.4.1 backward incompatible (scm_)eval change. + Note that we must use (scm_)eval2 to remain backwards compatible with + guile < 1.4.1 snapshot. + +* Reincluded 79.jcn2 fix + +1.3.80 +====== + 1.3.79.jcn5 =========== @@ -50,6 +84,7 @@ 1.3.79 ====== + * etf2ly.py: Finale to LilyPond conversion. 1.3.78.jcn4 @@ -2198,3 +2233,4 @@ pl 15.hwn1 pl 15.jcn4 - direct #... to scm parser (Thanks to Gary Houston) + diff --git a/Documentation/faq.texi b/Documentation/faq.texi index c7d8cd5d21..ae39d2e12b 100644 --- a/Documentation/faq.texi +++ b/Documentation/faq.texi @@ -30,6 +30,14 @@ directly. Note: relative paths are meant to be relative to the source directory +@subsubsection I've got a simple question, but this FAQ doesn't help! + +Please have a look in the searchable mail achives of +@uref{http://www.mail-archive.com/gnu-music-discuss@@gnu.org/, +gnu-music-discuss} and +@uref{http://www.mail-archive.com/help-gnu-music@@gnu.org/, help-gnu-music}. +Your question may well have been answered before. + @node Installing,, ,top @section Installing @@ -181,9 +189,48 @@ Yes. See @file{input/test/grace.ly}. @node How do I -,, ,top @section How do I .... -@subsubsection How do I change the TeX layout? +@subsubsection How do I change the page layout? + +The height and width of the music on each page is set +using the paper variables @code{textheight} and @code{linewidth} in +the input file. +If you want to change the placement of the page number or the +layout of the title, you could run @code{lilypond infile.ly} and +include the generated @file{infile.tex} file in your own LaTeX +wrapper file. The easiest way is to start from the ly2dvi default +layout, using the following steps (assuming that the input file +is @file{infile.ly}: + +@itemize @bullet -See @file{lilyponddefs.tex}, it has some comments. Or use @file{ly2dvi}. + @item @code{ly2dvi -kK infile.ly} + + @item Edit the generated LaTeX file @file{infile_lyN.tex} (@code{N} is + some number) to get the desired layout. Some aspects are determined in + the file titledefs.tex. + + @item Run @code{latex infile_lyN.tex} + + @item If you update the Mudela file, run @code{lilypond infile.ly} + and then @code{latex infile_lyN.tex}. +@end itemize +Another alternative is to use @command{mudela-book}, where smaller or +larger music examples can be included in a LaTeX or Texinfo file. + +@subsubsection The tagline is visible in the .dvi file but is not printed on paper. + +The default page size is A4. If you use letter sized papers, +add the following at the top of your Mudela file. +@example +\paper@{ + papersize="letter"; +@} +\include "paper20.ly" +@end example +(Note that setting the papersize in the ordinary paper section inside +a score declaration will not have the desired effect.) +The default paper size can be set globally for the installation +in the file @file{declarations.ly}. @subsubsection How do I place lyrics under @emph{each} of the staves in a score, as choral music. I can work out how to put lyrics for each line all under the top line, or at the bottom but not between! @@ -396,6 +443,21 @@ Upgrade/downgrade to 4.17. @node Running,, ,top @section Running +@subsubsection LilyPond takes ages to run, what am I doing wrong? + +LilyPond uses a lot CPU time, and insane amounts of memory. The amount +of memory it requires is proportional to the size of the score, in other +words. For a moderately complex piano scores of 5 pages, the footprint +can easily become 20 megs. (Our favorite test is the coriolan: +approx. 100 megs for a 50 page orchestral). If your system has not got +enough memory, it can easily start swapping. + +A part of the memory is used as temporary storage, and is reclaimed +through GUILE's garbage collection. A way to trade in CPU time for +storage is by decreasing the environment variable +@var{GUILE_MAX_SEGMENT_SIZE} (default 8388608, which is 8 megs). + + @subsubsection Correcting errors is so tedious. Is there a better way? As of 1.3.73, lilypond provides support for the xdvi @code{src:} diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index a22fa63767..39ae494574 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -169,7 +169,7 @@ just after the preferatory matter, and on the right to the end of the staff. A slur should follow the same vertical direction it would have in unbroken state. -@mudelafile{slur-broken.ly} +@mudelafile{slur-broken-trend.ly} Ties are strictly horizontal. They are placed in between note heads. The horizontal middle should not overlap with a staffline. diff --git a/input/bugs/grace-gets-slur.ly b/input/bugs/grace-gets-slur.ly new file mode 100644 index 0000000000..8836127897 --- /dev/null +++ b/input/bugs/grace-gets-slur.ly @@ -0,0 +1,11 @@ + +\score { + \notes\relative c''{ + \grace g8 g'2 ( )g + } + \paper { + linewidth=40.\mm; + indent=0.; + } +} + diff --git a/input/test/pedal.ly b/input/test/pedal.ly index a30ab93a09..1215159943 100644 --- a/input/test/pedal.ly +++ b/input/test/pedal.ly @@ -4,6 +4,8 @@ c4\sustaindown d e f\sustainup g\sustaindown b c c, [d16 \sustainup \sustaindown c c c] [e e \sustainup \sustaindown e e ] f4 \sustainup g\sustaindown b c \property Staff.stopStartSustain = #"-P" \property Staff.startSustain = #"P" +\property Staff.sustainPedalPadding = #10 + c,\sustainup\sustaindown d e f \sustainup g\sustaindown b c } \paper{ diff --git a/input/test/slur-broken-trend.ly b/input/test/slur-broken-trend.ly new file mode 100644 index 0000000000..fb5cf7fed5 --- /dev/null +++ b/input/test/slur-broken-trend.ly @@ -0,0 +1,13 @@ +\score{ + \notes \relative c''{ + e1( \break) a, + \time 2/4; + e'2( \break) a,(\break + a2\break + )e'2 + } + \paper { + linewidth=40.\mm; + indent=0.; + } +} diff --git a/input/test/tie-broken.ly b/input/test/tie-broken.ly new file mode 100644 index 0000000000..166cd40abe --- /dev/null +++ b/input/test/tie-broken.ly @@ -0,0 +1,17 @@ +\score{ + \notes \relative c''{ + c1~\break c + c4 c c c~\break + c c c c + + c1~\break + \time 8/8; c + c4 c c c~\break + \time 4/4; + c c c c + } + \paper { + linewidth=40.\mm; + indent=0.; + } +} diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 8c286e428d..d39c15bc26 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -153,7 +153,7 @@ All_font_metrics::find_font (String name) String def_name = default_font_sz_; SCM l = scm_assoc (ly_str02scm ("default"), - scm_eval (ly_symbol2scm ("cmr-alist"))); + scm_eval2 (ly_symbol2scm ("cmr-alist"), SCM_EOL)); if (l != SCM_BOOL_F) def_name = ly_scm2string (gh_cdr (l)); diff --git a/lily/bar.cc b/lily/bar.cc index 7eaa478b7d..00625374fe 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -142,10 +142,11 @@ Bar::before_line_breaking (SCM smob) if (bsd) { SCM breakdir = gh_int2scm (bsd); - g = scm_eval (gh_list (ly_symbol2scm ("break-barline"), + g = scm_eval2 (gh_list (ly_symbol2scm ("break-barline"), g, breakdir, - SCM_UNDEFINED)); + SCM_UNDEFINED), + SCM_EOL); } } else diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 8b404079f3..a4ffe9a519 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -200,9 +200,14 @@ Beam_engraver::do_removal_processing () if (beam_p_) { prev_start_req_->origin ()->warning (_ ("unterminated beam")); +#if 0 finished_beam_p_ = beam_p_; finished_beam_info_p_ = beam_info_p_; typeset_beam (); +#else + beam_p_->suicide (); + delete beam_info_p_; +#endif } } diff --git a/lily/beam.cc b/lily/beam.cc index 25fe6e9019..a9ba9b076e 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -125,12 +125,13 @@ Beam::get_default_dir (Score_element*me) } while (flip(&d) != DOWN); - SCM s = scm_eval (gh_list (ly_symbol2scm ("beam-dir-algorithm"), + SCM s = scm_eval2 (gh_list (ly_symbol2scm ("beam-dir-algorithm"), ly_quote_scm (gh_cons (gh_int2scm (count[UP]), gh_int2scm (count[DOWN]))), ly_quote_scm (gh_cons (gh_int2scm (total[UP]), gh_int2scm (total[DOWN]))), - SCM_UNDEFINED)); + SCM_UNDEFINED), + SCM_EOL); if (gh_number_p (s) && gh_scm2int (s)) return to_dir (s); @@ -244,7 +245,7 @@ Beam::set_stem_shorten (Score_element*m) int multiplicity = get_multiplicity (me); // grace stems? - SCM shorten = scm_eval (ly_symbol2scm ("beamed-stem-shorten")); + SCM shorten = scm_eval2 (ly_symbol2scm ("beamed-stem-shorten"), SCM_EOL); if (shorten == SCM_EOL) return; @@ -550,7 +551,8 @@ Real Beam::quantise_dy_f (Score_element*me,Real dy) { Array a; - for (SCM s = scm_eval (ly_symbol2scm ("beam-height-quants")); s !=SCM_EOL; s = gh_cdr (s)) + for (SCM s = scm_eval2 (ly_symbol2scm ("beam-height-quants"), SCM_EOL); + s !=SCM_EOL; s = gh_cdr (s)) a.push (gh_scm2double (gh_car (s))); if (a.size () <= 1) @@ -580,10 +582,11 @@ Beam::quantise_y_f (Score_element*me,Real y, Real dy, int quant_dir) int multiplicity = get_multiplicity (me); Real staff_space = Staff_symbol_referencer::staff_space (me); - SCM quants = scm_eval (gh_list (ly_symbol2scm ("beam-vertical-position-quants"), + SCM quants = scm_eval2 (gh_list (ly_symbol2scm ("beam-vertical-position-quants"), gh_int2scm (multiplicity), gh_double2scm (dy/staff_space), - SCM_UNDEFINED)); + SCM_UNDEFINED), + SCM_EOL); Array a; diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index 2c9e705117..c325aa1aa3 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -107,7 +107,7 @@ Break_align_item::do_alignment (Score_element *me) SCM e = scm_assoc (scm_listify (current_origin, next_origin, SCM_UNDEFINED), - scm_eval (ly_symbol2scm ("space-alist"))); + scm_eval2 (ly_symbol2scm ("space-alist"), SCM_EOL)); SCM extra_space; if (e != SCM_BOOL_F) diff --git a/lily/chord-name.cc b/lily/chord-name.cc index c8e8e785ac..3d786acc81 100644 --- a/lily/chord-name.cc +++ b/lily/chord-name.cc @@ -167,11 +167,12 @@ Chord_name::brew_molecule (SCM smob) bass = SCM_BOOL_F; SCM pitches = sc->get_elt_property ("pitches"); - SCM text = scm_eval (gh_list (ly_symbol2scm ("chord::user-name"), + SCM text = scm_eval2 (gh_list (ly_symbol2scm ("chord::user-name"), style, ly_quote_scm (pitches), ly_quote_scm (gh_cons (inversion, bass)), - SCM_UNDEFINED)); + SCM_UNDEFINED), + SCM_EOL); return ly_text2molecule (sc, text).create_scheme (); } diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 63626bd022..289ad00b28 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -113,8 +113,12 @@ Chord_tremolo_engraver::do_removal_processing () if (beam_p_) { repeat_->origin ()->warning (_ ("unterminated chord tremolo")); +#if 0 finished_beam_p_ = beam_p_; typeset_beam (); +#else + beam_p_->suicide (); +#endif } } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 5d287e38a8..df8b2eb23f 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -222,7 +222,7 @@ Clef_engraver::do_pre_move_processing() if(to_boolean (clef_p_->get_elt_property("non-default"))) { vis = ly_symbol2scm ("all-visible"); - vis = scm_eval (vis); + vis = scm_eval2 (vis, SCM_EOL); } if (vis) diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index cfd5eae9a2..c399d36f63 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -281,11 +281,13 @@ void Dynamic_engraver::do_removal_processing () { typeset_all (); - + +#if 0 if (cresc_p_) { typeset_element (cresc_p_ ); finished_cresc_p_ = cresc_p_; + current_cresc_req_->origin ()->warning (_ ("unterminated (de)crescendo")); } if (line_spanner_) @@ -293,6 +295,17 @@ Dynamic_engraver::do_removal_processing () finished_line_spanner_ = line_spanner_; } typeset_all (); +#else + if (cresc_p_) + { + current_cresc_req_->origin ()->warning (_ ("unterminated (de)crescendo")); + cresc_p_->suicide (); + } + if (line_spanner_) + { + line_spanner_->suicide (); + } +#endif } void diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc index f51ae2beb6..3ed300021e 100644 --- a/lily/dynamic-performer.cc +++ b/lily/dynamic-performer.cc @@ -66,12 +66,13 @@ Dynamic_performer::do_process_music () if (text_script_req_l_) { - SCM s = scm_eval + SCM s = scm_eval2 (gh_list (ly_symbol2scm ("dynamic-absolute-volume"), ly_quote_scm (ly_str02scm (text_script_req_l_->text_str_.ch_C ())), - SCM_UNDEFINED)); - Real volume = gh_scm2double (scm_eval (ly_symbol2scm ("dynamic-default-volume"))); + SCM_UNDEFINED), + SCM_EOL); + Real volume = gh_scm2double (scm_eval2 (ly_symbol2scm ("dynamic-default-volume"), SCM_EOL)); if (gh_number_p (s)) volume = gh_scm2double (s); @@ -103,8 +104,9 @@ Dynamic_performer::do_process_music () s = ly_str02scm ("piano"); - s = scm_eval (gh_list (ly_symbol2scm ("instrument-equaliser"), - s, SCM_UNDEFINED)); + s = scm_eval2 (gh_list (ly_symbol2scm ("instrument-equaliser"), + s, SCM_UNDEFINED), + SCM_EOL); if (gh_pair_p (s)) { Interval iv; diff --git a/lily/include/slur.hh b/lily/include/slur.hh index 83d0900834..abc1b55b33 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -24,6 +24,8 @@ public: static SCM after_line_breaking (SCM); static SCM set_spacing_rods (SCM); private: + static Real get_first_notecolumn_y (Score_element *me, Direction dir); + static Offset broken_trend_offset (Score_element *me, Direction dir); static Offset get_attachment (Score_element*me,Direction dir, Score_element**common) ; static void de_uglyfy (Score_element*me,Slur_bezier_bow* bb, Real default_height); static void set_extremities (Score_element*me); diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 9f1b66d1a6..f19ddf1c1f 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -78,7 +78,8 @@ Key_engraver::create_key (bool def) if (!def) item_p_->set_elt_property ("visibility-lambda", - scm_eval (ly_symbol2scm ("all-visible"))); + scm_eval2 (ly_symbol2scm ("all-visible"), + SCM_EOL)); } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 7877d3674f..325517061f 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -45,7 +45,7 @@ ly_parse_scm (char const* s, int* n) { SCM str = gh_str02scm ((char*)s); SCM port = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_RDNG, - "scm_eval_0str"); + "ly_eval_scm_0str"); SCM from = scm_ftell (port); SCM form; @@ -53,7 +53,7 @@ ly_parse_scm (char const* s, int* n) /* Read expression from port */ if (!SCM_EOF_OBJECT_P (form = scm_read (port))) - answer = scm_eval_x (form); + answer = scm_eval_3 (form, 1, SCM_EOL); /* After parsing diff --git a/lily/lookup.cc b/lily/lookup.cc index a6c24eddd3..ab81aa4284 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -267,7 +267,7 @@ Lookup::text (String style, String text, Paper_def *paper_l) } SCM l = scm_assoc (ly_str02scm (style.ch_C()), - scm_eval (ly_symbol2scm ("cmr-alist"))); + scm_eval2 (ly_symbol2scm ("cmr-alist"), SCM_EOL)); if (l != SCM_BOOL_F) { diff --git a/lily/note-head.cc b/lily/note-head.cc index 505b75deb0..71c7889a95 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -74,10 +74,11 @@ Note_head::brew_molecule (SCM smob) // ugh: use gh_call () Molecule out = me->lookup_l()->afm_find (String ("noteheads-") + - ly_scm2string (scm_eval (gh_list (ly_symbol2scm("find-notehead-symbol"), + ly_scm2string (scm_eval2 (gh_list (ly_symbol2scm("find-notehead-symbol"), me->get_elt_property ("duration-log"), ly_quote_scm(style), - SCM_UNDEFINED)))); + SCM_UNDEFINED), + SCM_EOL))); if (streepjes_i) { diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 39d1b49c0e..0a9cbd2fc5 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -74,8 +74,8 @@ Paper_outputter::output_header () SCM exp = gh_list (ly_symbol2scm ((String (output_global_ch) + "-scm").ch_C()), ly_quote_scm (ly_symbol2scm ("all-definitions")), SCM_UNDEFINED); - exp = scm_eval (exp); - scm_eval (exp); + exp = scm_eval2 (exp, SCM_EOL); + scm_eval2 (exp, SCM_EOL); String creator; if (no_timestamps_global_b) @@ -137,14 +137,15 @@ Paper_outputter::dump_scheme (SCM s) { if (verbatim_scheme_b_) { - SCM result = scm_eval (scm_listify (ly_symbol2scm ("scm->string"), - ly_quote_scm (gh_car (s)), SCM_UNDEFINED)); + SCM result = scm_eval2 (scm_listify (ly_symbol2scm ("scm->string"), + ly_quote_scm (gh_car (s)), SCM_UNDEFINED), + SCM_EOL); *stream_p_ << ly_scm2string (result); } else { - SCM result = scm_eval (s); + SCM result = scm_eval2 (s, SCM_EOL); char *c=gh_scm2newstr (result, NULL); *stream_p_ << c; diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 9c13a867ea..508d93f24c 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -125,7 +125,11 @@ Paper_score::process () scm = gh_list (ly_symbol2scm ("end-output"), SCM_UNDEFINED); outputter_l_->output_scheme (scm); + progress_indication ("\n"); // huh? delete outputter_l_; outputter_l_ = 0; + + if (verbose_global_b) + ly_display_scm (scm_gc_stats ()); } diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 3f47d8f714..bac852ce55 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -58,7 +58,8 @@ Script_engraver::do_process_music() Articulation_req* l=script_req_l_arr_[i]; SCM list = scm_assoc (ly_str02scm (l->articulation_str_.ch_C ()), - scm_eval (ly_symbol2scm ("script-alist"))); + scm_eval2 (ly_symbol2scm ("script-alist"), + SCM_EOL)); if (list == SCM_BOOL_F) { diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 839b64649a..2acdd0d99d 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -71,7 +71,14 @@ Slur_engraver::do_removal_processing () { for (int i = 0; i < slur_l_stack_.size (); i++) { +#if 0 typeset_element (slur_l_stack_[i]); +#else + /* + Let's not typeset unterminated stuff + */ + slur_l_stack_[i]->suicide (); +#endif } slur_l_stack_.clear (); SCM wg = get_property ("weAreGraceContext"); @@ -94,8 +101,8 @@ Slur_engraver::do_process_music () if (slur_req_l->span_dir_ == STOP) { if (slur_l_stack_.empty ()) - - slur_req_l->origin ()->warning (_f ("can't find both ends of %s", _ ("slur"))); + slur_req_l->origin ()->warning (_f ("can't find start of %s", + _ ("slur"))); else { Score_element* slur = slur_l_stack_.pop (); diff --git a/lily/slur.cc b/lily/slur.cc index 4b6a9e081c..e59f5fdf03 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -104,54 +104,6 @@ Slur::get_default_dir (Score_element*me) } - - - -Offset -Slur::encompass_offset (Score_element*me, - Score_element* col, - Score_element **common) -{ - Offset o; - Score_element* stem_l = unsmob_element (col->get_elt_property ("stem")); - - Direction dir = Directional_element_interface (me).get (); - - if (!stem_l) - { - warning (_ ("Slur over rest?")); - o[X_AXIS] = col->relative_coordinate (common[X_AXIS], X_AXIS); - o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS); - return o; - } - Direction stem_dir = Directional_element_interface (stem_l).get (); - o[X_AXIS] = stem_l->relative_coordinate (0, X_AXIS); - - /* - Simply set x to middle of notehead - */ - - o[X_AXIS] -= 0.5 * stem_dir * col->extent (X_AXIS).length (); - - if ((stem_dir == dir) - && !stem_l->extent (Y_AXIS).empty_b ()) - { - o[Y_AXIS] = stem_l->relative_coordinate (common[Y_AXIS], Y_AXIS); // iuhg - o[Y_AXIS] += stem_l->extent (Y_AXIS)[dir]; - } - else - { - o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS); // ugh - o[Y_AXIS] += col->extent (Y_AXIS)[dir]; - } - - /* - leave a gap: slur mustn't touch head/stem - */ - o[Y_AXIS] += dir * me->paper_l ()->get_var ("slur_y_free"); - return o; -} - MAKE_SCHEME_CALLBACK (Slur, after_line_breaking); SCM Slur::after_line_breaking (SCM smob) @@ -180,7 +132,8 @@ Slur::set_extremities (Score_element*me) { // for (SCM s = get_elt_property ("slur-extremity-rules"); s != SCM_EOL; s = gh_cdr (s)) - for (SCM s = scm_eval (ly_symbol2scm ("slur-extremity-rules")); + for (SCM s = scm_eval2 (ly_symbol2scm ("slur-extremity-rules"), + SCM_EOL); s != SCM_EOL; s = gh_cdr (s)) { SCM r = gh_call2 (gh_caar (s), me->self_scm (), @@ -197,13 +150,75 @@ Slur::set_extremities (Score_element*me) while (flip (&dir) != LEFT); } +Real +Slur::get_first_notecolumn_y (Score_element *me, Direction dir) +{ + Score_element *col = dir == LEFT + ? unsmob_element (gh_car (scm_reverse (me->get_elt_property + ("note-columns")))) + : unsmob_element + (gh_car (me->get_elt_property ("note-columns"))); + + Score_element *common[] = + { + 0, + me->common_refpoint (col, Y_AXIS) + }; + Real y; + if (col == ((Spanner*)me)->get_bound (dir)) + { + y = get_attachment (me, dir, common)[Y_AXIS]; + } + else + { + y = encompass_offset (me, col, common)[Y_AXIS] + - me->relative_coordinate (common[Y_AXIS], Y_AXIS); + } + return y; +} + +Offset +Slur::broken_trend_offset (Score_element *me, Direction dir) +{ + /* + A broken slur should maintain the same vertical trend + the unbroken slur would have had. + */ + Offset o; + if (Spanner *mother = dynamic_cast (me->original_l_)) + { + for (int i = dir == LEFT ? 0 : mother->broken_into_l_arr_.size (); + dir == LEFT ? i < mother->broken_into_l_arr_.size () : i; + dir == LEFT ? i++ : --i) + { + if (mother->broken_into_l_arr_[i - dir] == me) + { + Score_element *neighbour = mother->broken_into_l_arr_[i]; + if (dir == RIGHT) + neighbour->set_elt_property ("direction", + me->get_elt_property ("direction")); + Real neighbour_y = get_first_notecolumn_y (neighbour, dir); + Real y = get_first_notecolumn_y (me, -dir); + o = Offset (0, (y + neighbour_y) / 2); + break; + } + } + } + return o; +} + Offset Slur::get_attachment (Score_element*me,Direction dir, Score_element **common) { - Spanner*sp = dynamic_cast(me); SCM s = me->get_elt_property ("attachment"); + if (!gh_symbol_p (index_cell (s, dir))) + { + set_extremities (me); + s = me->get_elt_property ("attachment"); + } SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s); + Spanner*sp = dynamic_cast(me); String str = ly_symbol2string (a); Real ss = Staff_symbol_referencer::staff_space ((Score_element*)me); Real hs = ss / 2.0; @@ -255,8 +270,18 @@ Slur::get_attachment (Score_element*me,Direction dir, SCM other_a = dir == LEFT ? gh_cdr (s) : gh_car (s); if (ly_symbol2string (other_a) != "loose-end") { +#if 0 + /* + The braindead way: horizontal + */ o = Offset (0, get_attachment (me, -dir, common)[Y_AXIS]); +#else + o = broken_trend_offset (me, dir); +#endif + + } + } SCM l = scm_assoc @@ -264,7 +289,7 @@ Slur::get_attachment (Score_element*me,Direction dir, gh_int2scm (stem ? Stem::get_direction (stem) : 1 * dir), gh_int2scm (Directional_element_interface (me).get () * dir), SCM_UNDEFINED), - scm_eval (ly_symbol2scm ("slur-extremity-offset-alist"))); + scm_eval2 (ly_symbol2scm ("slur-extremity-offset-alist"), SCM_EOL)); if (l != SCM_BOOL_F) { @@ -284,6 +309,51 @@ Slur::get_attachment (Score_element*me,Direction dir, return o; } +Offset +Slur::encompass_offset (Score_element*me, + Score_element* col, + Score_element **common) +{ + Offset o; + Score_element* stem_l = unsmob_element (col->get_elt_property ("stem")); + + Direction dir = Directional_element_interface (me).get (); + + if (!stem_l) + { + warning (_ ("Slur over rest?")); + o[X_AXIS] = col->relative_coordinate (common[X_AXIS], X_AXIS); + o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS); + return o; + } + Direction stem_dir = Directional_element_interface (stem_l).get (); + o[X_AXIS] = stem_l->relative_coordinate (0, X_AXIS); + + /* + Simply set x to middle of notehead + */ + + o[X_AXIS] -= 0.5 * stem_dir * col->extent (X_AXIS).length (); + + if ((stem_dir == dir) + && !stem_l->extent (Y_AXIS).empty_b ()) + { + o[Y_AXIS] = stem_l->relative_coordinate (common[Y_AXIS], Y_AXIS); // iuhg + o[Y_AXIS] += stem_l->extent (Y_AXIS)[dir]; + } + else + { + o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS); // ugh + o[Y_AXIS] += col->extent (Y_AXIS)[dir]; + } + + /* + leave a gap: slur mustn't touch head/stem + */ + o[Y_AXIS] += dir * me->paper_l ()->get_var ("slur_y_free"); + return o; +} + Array Slur::get_encompass_offset_arr (Score_element*me) { diff --git a/lily/stem.cc b/lily/stem.cc index 9332b6532d..36f9c46793 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -260,7 +260,8 @@ Stem::get_default_stem_end_position (Score_element*me) } else { - s = scm_eval (ly_symbol2scm ((type_str + "stem-length").ch_C())); + s = scm_eval2 (ly_symbol2scm ((type_str + "stem-length").ch_C()), + SCM_EOL); for (SCM q = s; q != SCM_EOL; q = gh_cdr (q)) a.push (gh_scm2double (gh_car (q))); @@ -270,7 +271,8 @@ Stem::get_default_stem_end_position (Score_element*me) a.clear (); - s = scm_eval (ly_symbol2scm ((type_str + "stem-shorten").ch_C())); + s = scm_eval2 (ly_symbol2scm ((type_str + "stem-shorten").ch_C()), + SCM_EOL); for (SCM q = s; q != SCM_EOL; q = gh_cdr (q)) a.push (gh_scm2double (gh_car (q))); @@ -547,14 +549,15 @@ Stem::calc_stem_info (Score_element*me) SCM s; String type_str = grace_b ? "grace-" : ""; - s = scm_eval (ly_symbol2scm ((type_str + "beamed-stem-minimum-length").ch_C())); + s = scm_eval2 (ly_symbol2scm ((type_str + "beamed-stem-minimum-length").ch_C()), SCM_EOL); a.clear (); for (SCM q = s; q != SCM_EOL; q = gh_cdr (q)) a.push (gh_scm2double (gh_car (q))); Real minimum_length = a[multiplicity ? 0; SCM l = scm_assoc (ly_str02scm ("brace"), - scm_eval (ly_symbol2scm ("cmr-alist"))); + scm_eval2 (ly_symbol2scm ("cmr-alist"), SCM_EOL)); String nm = "feta-braces"; if (l != SCM_BOOL_F) diff --git a/lily/tie.cc b/lily/tie.cc index 2b214131b1..9c7b70ff33 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -20,6 +20,7 @@ #include "molecule.hh" #include "bezier-bow.hh" #include "stem.hh" +#include "note-head.hh" /* tie: Connect two noteheads. @@ -130,13 +131,37 @@ Tie::get_control_points (SCM smob) Score_element* l = me->get_bound (LEFT); Score_element* r = me->get_bound (RIGHT); - Real width = r->relative_coordinate (commonx, X_AXIS) - + r->extent (X_AXIS)[LEFT] - - l->relative_coordinate (commonx, X_AXIS) - - l->extent (X_AXIS)[RIGHT] - -2* x_gap_f; - Real left_x = l->extent (X_AXIS)[RIGHT] + x_gap_f; + Real left_x; + if (Note_head::has_interface (me->get_bound (LEFT))) + left_x = l->extent (X_AXIS)[RIGHT] + x_gap_f; + else + left_x = l->extent (X_AXIS).length () / 2; + + Real width; + if (Note_head::has_interface (me->get_bound (LEFT)) + && Note_head::has_interface (me->get_bound (RIGHT))) + { + width = r->relative_coordinate (commonx, X_AXIS) + + r->extent (X_AXIS)[LEFT] + - l->relative_coordinate (commonx, X_AXIS) + - l->extent (X_AXIS)[RIGHT] + -2 * x_gap_f; + } + else + { + if (Note_head::has_interface (me->get_bound (LEFT))) + width = r->relative_coordinate (commonx, X_AXIS) + - l->relative_coordinate (commonx, X_AXIS) + - l->extent (X_AXIS)[RIGHT] + - 2 * x_gap_f; + else + width = r->relative_coordinate (commonx, X_AXIS) + - l->extent (X_AXIS).length () / 2 + + r->extent (X_AXIS)[LEFT] + - l->relative_coordinate (commonx, X_AXIS) + - 2 * x_gap_f; + } Direction dir = Directional_element_interface (me).get(); diff --git a/lily/translator.cc b/lily/translator.cc index 579deaad47..68db603831 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -175,15 +175,27 @@ Translator::get_property (SCM sym) const return daddy_trans_l_->get_property (sym); } - - void -Translator:: do_pre_move_processing(){} +Translator:: do_pre_move_processing () +{ +} + void -Translator::do_post_move_processing(){} +Translator::do_post_move_processing () +{ +} + void -Translator::do_process_music () {} +Translator::do_process_music () +{ +} + void -Translator::do_creation_processing() {} +Translator::do_creation_processing () +{ +} + void -Translator::do_removal_processing(){} +Translator::do_removal_processing () +{ +} diff --git a/scm/chord-names.scm b/scm/chord-names.scm index 5fa71559ac..5116a7904f 100644 --- a/scm/chord-names.scm +++ b/scm/chord-names.scm @@ -328,9 +328,9 @@ ;(display "b&i:") (display base-and-inversion) (newline) (let ((diff (pitch::diff '(0 0 0) (car pitches))) (name-func - (eval (string->symbol (string-append "chord::name-" style)))) + (ly-eval (string->symbol (string-append "chord::name-" style)))) (names-alist - (eval (string->symbol (string-append "chord::names-alist-" style))))) + (ly-eval (string->symbol (string-append "chord::names-alist-" style))))) (let loop ((note-names (reverse pitches)) (chord '()) (user-name #f)) diff --git a/scm/lily.scm b/scm/lily.scm index c22f512b8a..13f8359c55 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -29,6 +29,11 @@ ;; do nothing in .scm output (define (comment s) "") +;; URG guile-1.3/1.4 compatibility +(define (ly-eval x) (eval2 x #f)) + +(define (comment s) "") + (define (mm-to-pt x) (* (/ 72.27 25.40) x) ) @@ -945,13 +950,13 @@ (gulp-file name)))) (define (scm-tex-output) - (eval (tex-scm 'all-definitions))) + (ly-eval (tex-scm 'all-definitions))) (define (scm-ps-output) - (eval (ps-scm 'all-definitions))) + (ly-eval (ps-scm 'all-definitions))) (define (scm-as-output) - (eval (as-scm 'all-definitions))) + (ly-eval (as-scm 'all-definitions))) (define (index-cell cell dir) (if (equal? dir 1) diff --git a/scm/slur.scm b/scm/slur.scm index 476d3cc233..2574afd619 100644 --- a/scm/slur.scm +++ b/scm/slur.scm @@ -26,15 +26,16 @@ (define slur-extremity-rules (list - ;; (cons (lambda (slur dir) (begin (display "before head") (newline))#f) #f) + ;; (cons (lambda (slur dir) (begin (display "before sanity check") (newline))#f) #f) ;; urg: don't crash on a slur without note-columns (cons (lambda (slur dir) (< (length (ly-get-elt-property slur 'note-columns)) 1)) 'head) - ;; urg: don't crash on a slur without note-columns - (cons (lambda (slur dir) - (< (length (ly-get-elt-property slur 'note-columns)) 1)) 'head) + ;; (cons (lambda (slur dir) (begin (display "before loose-end") (newline))#f) #f) + (cons (lambda (slur dir) (not (attached-to-stem slur dir))) 'loose-end) + + ;; (cons (lambda (slur dir) (begin (display "before head") (newline))#f) #f) (cons (lambda (slur dir) ;; urg, code dup -- 2.39.5