From 3de788bd1b1e1933a4ec6fbb01000b84cdc3ef4f Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 00:33:42 +0000 Subject: [PATCH] lilypond-1.3.112 --- Documentation/regression-test.tely | 6 +- input/test/crescendi.ly | 2 +- input/test/ottava.ly | 2 +- input/test/text-spanner.ly | 4 +- lily/chord.cc | 6 -- lily/duration.cc | 2 +- lily/dynamic-engraver.cc | 2 +- lily/font-interface.cc | 2 +- lily/include/lily-guile.hh | 2 + lily/include/lily-proto.hh | 1 + lily/include/line-spanner.hh | 22 ++++++ lily/include/musical-request.hh | 5 ++ lily/lily-guile.cc | 10 ++- lily/music-output-def.cc | 2 +- lily/my-lily-lexer.cc | 1 + lily/parser.yy | 6 ++ lily/pitch.cc | 2 +- lily/text-spanner.cc | 107 ++++++++--------------------- ly/engraver.ly | 1 + scm/generic-property.scm | 2 +- 20 files changed, 90 insertions(+), 97 deletions(-) create mode 100644 lily/include/line-spanner.hh diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index a2d0289437..8a5d214837 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -119,10 +119,14 @@ linked with (de)crescendi, they should be on the same line. @lilypondfile{dyn-line.ly} -Arpeggios are supported, both cross-staff and one-staff. +Arpeggios are supported, both cross-staff and broken single staff. @lilypondfile{arpeggio.ly} +Simple glissando lines between notes are supported. + +@lilypondfile{glissando.ly} + @section Chord names diff --git a/input/test/crescendi.ly b/input/test/crescendi.ly index 5a7e44eba3..7e9287904d 100644 --- a/input/test/crescendi.ly +++ b/input/test/crescendi.ly @@ -3,7 +3,7 @@ a1\fff\> \!a\pp a\< \!a \property Voice.crescendoText = "cresc." -\property Voice.crescendoSpanner = "dashed-line" +\property Voice.crescendoSpanner = #'dashed-line a\mf\< a \!a a\< \!a } diff --git a/input/test/ottava.ly b/input/test/ottava.ly index 21aaeb4aad..ad3b746fe1 100644 --- a/input/test/ottava.ly +++ b/input/test/ottava.ly @@ -4,7 +4,7 @@ \score{ \notes\relative c'''{ \property Voice.TextSpanner \revert #'type - \property Voice.TextSpanner \override #'type = #"dotted-line" + \property Voice.TextSpanner \override #'type = #'dotted-line \property Voice.TextSpanner \override #'edge-height = #'(0 . 1.5) \property Voice.TextSpanner \override #'edge-text = #'("8va " . "") \property Staff.centralCPosition = #-13 diff --git a/input/test/text-spanner.ly b/input/test/text-spanner.ly index 9016c074dd..53784a734a 100644 --- a/input/test/text-spanner.ly +++ b/input/test/text-spanner.ly @@ -9,13 +9,13 @@ a \spanrequest \stop "text" \property Voice.TextSpanner \revert #'type - \property Voice.TextSpanner \override #'type = #"dotted-line" + \property Voice.TextSpanner \override #'type = #'dotted-line a \spanrequest \start "text" b c a \spanrequest \stop "text" \property Voice.TextSpanner \revert #'type - \property Voice.TextSpanner \override #'type = #"dashed-line" + \property Voice.TextSpanner \override #'type = #'dashed-line \property Voice.TextSpanner \override #'edge-height = #'(1 . -2) a \spanrequest \start "text" b c diff --git a/lily/chord.cc b/lily/chord.cc index 3454f47a77..2aa4b0532e 100644 --- a/lily/chord.cc +++ b/lily/chord.cc @@ -46,12 +46,6 @@ ly_remove_member (SCM s, SCM list) return gh_reverse (removed); } -SCM -ly_last (SCM list) -{ - return gh_car (scm_last_pair (list)); -} - /* tail add */ SCM ly_snoc (SCM s, SCM list) diff --git a/lily/duration.cc b/lily/duration.cc index 6b9925ba17..cc44db4def 100644 --- a/lily/duration.cc +++ b/lily/duration.cc @@ -97,7 +97,7 @@ Duration::print_smob (SCM s, SCM port, scm_print_state *) Duration *r = (Duration *) gh_cdr (s); scm_puts ("#str().ch_C()), port); + scm_display (ly_str02scm (r->str().ch_C()), port); scm_puts (" >", port); return 1; diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 7b5b536113..15b6561b1b 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -238,7 +238,7 @@ Dynamic_engraver::create_grobs () ugh. Use push/pop? */ SCM s = get_property ((start_type + "Spanner").ch_C()); - if (!gh_string_p (s) || ly_scm2string (s) == "hairpin") + if (!gh_symbol_p (s) || s == ly_symbol2scm ("hairpin")) { cresc_p_ = new Spanner (get_property ("Crescendo")); cresc_p_->set_grob_property ("grow-direction", diff --git a/lily/font-interface.cc b/lily/font-interface.cc index 1e7b6d34f2..d5a15ab2d9 100644 --- a/lily/font-interface.cc +++ b/lily/font-interface.cc @@ -199,6 +199,6 @@ Font_interface::properties_to_font_name (SCM fonts, SCM alist_chain) warning (_("couldn't find any font satisfying ") ); scm_write (gh_list (name, point_sz, shape, series , family, rel_sz, SCM_UNDEFINED), scm_current_error_port ()); - return gh_str02scm ("cmr10"); + return ly_str02scm ("cmr10"); } diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 2f50f6d384..9e18991490 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -31,6 +31,8 @@ A ly_B2A (B b); */ + +SCM ly_last (SCM list); SCM ly_str02scm (char const*c); SCM ly_deep_copy (SCM); SCM ly_symbol2scm (char const *); diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index b4bcf7d24f..094879e9ad 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -57,6 +57,7 @@ class Folded_repeat_iterator; class Font_metric; class Font_size_engraver; class Global_translator; +class Glissando_req; class Gourlay_breaking; class Grace_engraver_group; class Grace_iterator; diff --git a/lily/include/line-spanner.hh b/lily/include/line-spanner.hh new file mode 100644 index 0000000000..3b9ac9545d --- /dev/null +++ b/lily/include/line-spanner.hh @@ -0,0 +1,22 @@ +/* + line-spanner.hh -- declare Line_spanner + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen +*/ + + +#ifndef LINE_SPANNER_HH +#define LINE_SPANNER_HH + +#include "lily-guile.hh" + +class Line_spanner +{ +public: + DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); + static SCM line_atom (Grob* me, Real dx, Real dy); +}; + +#endif /* LINE_SPANNER_HH */ diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 4b8eecd877..45cf8e3825 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -158,4 +158,9 @@ public: VIRTUAL_COPY_CONS (Music); }; +class Glissando_req : public Request +{ + VIRTUAL_COPY_CONS (Music); +}; + #endif // MUSICALREQUESTS_HH diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 09447caa19..1b71965951 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -23,6 +23,12 @@ #include "offset.hh" #include "interval.hh" +SCM +ly_last (SCM list) +{ + return gh_car (scm_last_pair (list)); +} + SCM ly_str02scm (char const*c) { @@ -41,7 +47,7 @@ ly_str02scm (char const*c) SCM ly_parse_scm (char const* s, int* n) { - SCM str = gh_str02scm ((char*)s); + SCM str = ly_str02scm (s); SCM port = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_RDNG, "ly_eval_scm_0str"); SCM from = scm_ftell (port); @@ -365,7 +371,7 @@ ly_number2string (SCM s) sprintf (str, "%d ", gh_scm2int (s)); } - return gh_str02scm (str); + return ly_str02scm (str); } /* diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index 976c41767d..edc315cb7b 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -67,7 +67,7 @@ Music_output_def::find_translator_l (SCM name) const Global_translator * Music_output_def::get_global_translator_p () { - Translator_def * t = unsmob_translator_def (find_translator_l (gh_str02scm ("Score"))); + Translator_def * t = unsmob_translator_def (find_translator_l (ly_str02scm ("Score"))); if (!t) error (_f ("can't find `%s' context", "Score")); diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index bf1cb58de9..9a5661cb99 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -48,6 +48,7 @@ static Keyword_ent the_key_tab[]={ {"elementdescriptions", ELEMENTDESCRIPTIONS}, {"font", FONT}, {"grace", GRACE}, + {"glissando", GLISSANDO}, {"header", HEADER}, {"in", IN_T}, {"lyrics", LYRICS}, diff --git a/lily/parser.yy b/lily/parser.yy index e290df52a9..b44508c4b8 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -159,6 +159,7 @@ yylex (YYSTYPE *s, void * v_l) %token DURATION %token EXTENDER %token FONT +%token GLISSANDO %token GRACE %token HEADER %token HYPHEN @@ -1170,6 +1171,11 @@ verbose_request: a->set_spot (THIS->here_input ()); $$ = a; } + | GLISSANDO { + Glissando_req *g = new Glissando_req; + g->set_spot /* No pun intended */ (THIS->here_input ()); + $$ = g; + } ; sup_quotes: diff --git a/lily/pitch.cc b/lily/pitch.cc index a6447b5f26..576054389e 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -213,7 +213,7 @@ Pitch::print_smob (SCM s, SCM port, scm_print_state *) Pitch *r = (Pitch *) gh_cdr (s); scm_puts ("#str().ch_C()), port); + scm_display (ly_str02scm (r->str().ch_C()), port); scm_puts (" >", port); return 1; diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index e84fee6f47..c83551e556 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -9,6 +9,7 @@ #include "molecule.hh" #include "text-item.hh" #include "text-spanner.hh" +#include "line-spanner.hh" #include "spanner.hh" #include "font-interface.hh" #include "dimensions.hh" @@ -35,26 +36,19 @@ Text_spanner::brew_molecule (SCM smob) Spanner *spanner = dynamic_cast (me); Real staff_space = Staff_symbol_referencer::staff_space (me); - Real thickness = me->paper_l ()->get_var ("stafflinethickness"); - Drul_array broken; Direction d = LEFT; do { Paper_column* s = dynamic_cast(spanner->get_bound (d)); // UGH - broken[d] = (!s->musical_b ()); + if (s && s->musical_b ()) + broken[d] = false; + else + broken[d] = true; } while (flip (&d) != LEFT); -#if 0 - SCM s = me->get_grob_property ("text-style"); - - String text_style = "italic"; - if (gh_string_p (s)) - text_style = ly_scm2string (s); -#endif - SCM properties = Font_interface::font_alist_chain (me); SCM edge_text = me->get_grob_property ("edge-text"); @@ -98,83 +92,40 @@ Text_spanner::brew_molecule (SCM smob) width = 0; } - - String type = "dashed-line"; - s = me->get_grob_property ("type"); - if (gh_string_p (s)) - type = ly_scm2string (s); - + /* ugh */ + Real thick = me->paper_l ()->get_var ("stafflinethickness"); + Molecule line; - Drul_array edge_line; - if (type == "line" - || type == "dashed-line" - || type == "dotted-line") + SCM list = Line_spanner::line_atom (me, width, 0); + if (list != SCM_EOL) { - Real thick = thickness; - s = me->get_grob_property ("line-thickness"); - if (gh_number_p (s)) - thick *= gh_scm2double (s); - - // maybe these should be in line-thickness? - Real length = staff_space; - s = me->get_grob_property ("dash-length"); - if (gh_number_p (s)) - length = gh_scm2double (s) * staff_space; - - Real period = 2 * length + thick; - s = me->get_grob_property ("dash-period"); - if (gh_number_p (s)) - period = gh_scm2double (s) * staff_space; - if (type == "dotted-line") - length = thick; - - if (type == "line") - length = period + thick; - - Real on = length - thick; - Real off = period - on; - - SCM list = gh_list (ly_symbol2scm ("dashed-line"), - gh_double2scm (thick), - gh_double2scm (on), - gh_double2scm (off), - gh_double2scm (width), - gh_double2scm (0), - SCM_UNDEFINED); - Box b (Interval (0, width), Interval (-thick / 2, thick / 2)); line = Molecule (b, list); - - s = me->get_grob_property ("edge-height"); - if (gh_pair_p (s)) + } + + Drul_array edge_line; + s = me->get_grob_property ("edge-height"); + if (gh_pair_p (s)) + { + Direction d = LEFT; + int dir = to_dir (me->get_grob_property ("direction")); + do { - Direction d = LEFT; - int dir = to_dir (me->get_grob_property ("direction")); - do + Real dy = gh_scm2double (index_cell (s, d)) * - dir; + if (dy) { - Real dy = gh_scm2double (index_cell (s, d)) * - dir; - if (dy) - { - SCM list = gh_list (ly_symbol2scm ("dashed-line"), - gh_double2scm (thick), - gh_double2scm (on), - gh_double2scm (off), - gh_double2scm (0), - gh_double2scm (dy), - SCM_UNDEFINED); - - Box b (Interval (0, thick), - dy > 0 - ? Interval (0, dy) - : Interval (dy, 0)); - edge_line[d] = Molecule (b, list); - } + SCM list = Line_spanner::line_atom (me, 0, dy); + Box b (Interval (0, thick), + dy > 0 + ? Interval (0, dy) + : Interval (dy, 0)); + edge_line[d] = Molecule (b, list); } - while (flip (&d) != LEFT); } + while (flip (&d) != LEFT); } - + Molecule m; if (!edge[LEFT].empty_b ()) m = edge[LEFT]; diff --git a/ly/engraver.ly b/ly/engraver.ly index e6cca6f7ec..d44bd8fbf6 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -181,6 +181,7 @@ ThreadContext = \translator{ \type Engraver_group_engraver; \consists "Thread_devnull_engraver"; \consists "Note_heads_engraver"; + \consists "Note_head_line_engraver"; \consists "Output_property_engraver"; Generic_property_list = #generic-thread-properties \consists "Property_engraver"; diff --git a/scm/generic-property.scm b/scm/generic-property.scm index 882f083290..f7256676a6 100644 --- a/scm/generic-property.scm +++ b/scm/generic-property.scm @@ -164,7 +164,7 @@ (define generic-notename-properties (cons 'note-name-interface - (list (list 'noteNaemStyle symbol? 'style)))) + (list (list 'noteNameStyle symbol? 'style)))) (define generic-rest-properties -- 2.39.5