From e2e2ace2fdf8b0484f59d98720a5129ce91ee8fd Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 7 Sep 2002 13:20:47 +0000 Subject: [PATCH] * ly/performer-init.ly (ScoreContext): add Timing alias * lily/translator-def.cc (Translator_def): copy alias list too. * lily/stem.cc (height): add half beam thickness for beamed stems. This fixes tuplet bracket vertical offsets on beams. * lily/text-spanner-engraver.cc (stop_translation_timestep): small cleanups; only hang spanner on paper-columns if there are no note-columns to hang on. Also hang finished spanner on the last note. * lily/tuplet-bracket.cc (calc_position_and_height): only quantize inside staff. --- ChangeLog | 17 ++++++++++ CHANGES => Documentation/misc/CHANGES-1.5 | 0 GNUmakefile.in | 2 +- lily/beam.cc | 16 ++++++---- lily/include/beam.hh | 3 ++ lily/lexer.ll | 6 ++++ lily/parser.yy | 34 ++++++++++---------- lily/stem.cc | 6 ++++ lily/text-spanner-engraver.cc | 39 +++++++++++++---------- lily/translator-def.cc | 2 +- lily/tuplet-bracket.cc | 7 ++-- ly/engraver-init.ly | 2 +- ly/performer-init.ly | 2 +- 13 files changed, 90 insertions(+), 46 deletions(-) rename CHANGES => Documentation/misc/CHANGES-1.5 (100%) diff --git a/ChangeLog b/ChangeLog index 45cb7f2e37..1c1019ec3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2002-09-07 Han-Wen Nienhuys + + * ly/performer-init.ly (ScoreContext): add Timing alias + + * lily/translator-def.cc (Translator_def): copy alias list too. + + * lily/stem.cc (height): add half beam thickness for beamed stems. + This fixes tuplet bracket vertical offsets on beams. + + * lily/text-spanner-engraver.cc (stop_translation_timestep): small + cleanups; only hang spanner on paper-columns if there are no + note-columns to hang on. Also hang finished spanner on the last + note. + + * lily/tuplet-bracket.cc (calc_position_and_height): only quantize + inside staff. + 2002-09-07 Rune Zedeler * scm/output-lib.scm: (default-bar-number-visibility) added diff --git a/CHANGES b/Documentation/misc/CHANGES-1.5 similarity index 100% rename from CHANGES rename to Documentation/misc/CHANGES-1.5 diff --git a/GNUmakefile.in b/GNUmakefile.in index 6a2834fa29..5ae750579e 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -16,7 +16,7 @@ SUBDIRS = buildscripts scripts flower lily \ # SCRIPTS = configure aclocal.m4 autogen.sh -README_FILES = ChangeLog CHANGES COPYING DEDICATION NEWS README.mandrake ROADMAP THANKS +README_FILES = ChangeLog COPYING DEDICATION NEWS README.mandrake ROADMAP THANKS README_TXT_FILES = AUTHORS.txt README.txt INSTALL.txt IN_FILES := $(wildcard *.in) EXTRA_DIST_FILES = $(wildcard *.el) vimrc VERSION $(README_FILES) $(SCRIPTS) $(IN_FILES) emacsclient.patch lexer-gcc-3.0.patch server.el.patch darwin.patch .cvsignore lexer-gcc-3.1.sh diff --git a/lily/beam.cc b/lily/beam.cc index 8e454d3e91..56774c1b5a 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -67,6 +67,13 @@ Beam::add_stem (Grob *me, Grob *s) } +Real +Beam::get_thickness (Grob * me) +{ + return gh_scm2double (me->get_grob_property ("thickness")) + * Staff_symbol_referencer::staff_space (me); +} + /* Return the translation between 2 adjoining beams. */ Real Beam::get_beam_translation (Grob *me) @@ -97,8 +104,7 @@ Beam::space_function (SCM smob, SCM beam_count) Real staff_space = Staff_symbol_referencer::staff_space (me); Real line = me->get_paper ()->get_var ("linethickness"); - Real thickness = gh_scm2double (me->get_grob_property ("thickness")) - * staff_space; + Real thickness = get_thickness (me); Real beam_translation = gh_scm2int (beam_count) < 4 ? (2*staff_space + line - thickness) / 2.0 @@ -316,8 +322,7 @@ Beam::brew_molecule (SCM grob) Real dy = pos.delta (); Real dydx = dy && dx ? dy/dx : 0; - Real thick = gh_scm2double (me->get_grob_property ("thickness")) - * Staff_symbol_referencer::staff_space (me); + Real thick = get_thickness (me); Real bdy = get_beam_translation (me); SCM last_beaming = SCM_EOL;; @@ -1215,8 +1220,7 @@ Beam::set_stem_lengths (Grob *me) &&gh_scm2double (me->get_grob_property ("gap"))) { gap = true; - thick = gh_scm2double (me->get_grob_property ("thickness")) - * Staff_symbol_referencer::staff_space(me); + thick = get_thickness(me); } // ugh -> use commonx diff --git a/lily/include/beam.hh b/lily/include/beam.hh index b06afc0e4e..e5f544b706 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -26,7 +26,10 @@ public: static void set_beaming (Grob*,Beaming_info_list *); static void set_stemlens (Grob*); static int get_beam_count (Grob*me); + static Real get_beam_translation (Grob*me); + static Real get_thickness (Grob*me); + static void connect_beams (Grob*me); DECLARE_SCHEME_CALLBACK (space_function, (SCM, SCM)); DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); diff --git a/lily/lexer.ll b/lily/lexer.ll index 8413a0ce43..53bae6edef 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -474,6 +474,12 @@ HYPHEN -- return E_TILDE; case '\\': return E_BACKSLASH; + + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + yylval.i = c -'0'; + return E_DIGIT; + default: return E_CHAR; } diff --git a/lily/parser.yy b/lily/parser.yy index 3e92db7735..6de60181d2 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -241,7 +241,7 @@ yylex (YYSTYPE *s, void * v) /* escaped */ %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE -%token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE +%token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE E_DIGIT %token E_BACKSLASH %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH %token FIGURE_SPACE @@ -525,7 +525,7 @@ translator_spec_body: } | translator_spec_body ALIAS STRING { Translator_def*td = unsmob_translator_def ($$); - td->type_aliases_ = gh_cons ($3, td->type_aliases_); + td->type_aliases_ = scm_cons ($3, td->type_aliases_); } | translator_spec_body GROBDESCRIPTIONS embedded_scm { Translator_def*td = unsmob_translator_def($$); @@ -688,11 +688,11 @@ The representation of a list is the to have efficient append. */ Music_list: /* empty */ { - $$ = gh_cons (SCM_EOL, SCM_EOL); + $$ = scm_cons (SCM_EOL, SCM_EOL); } | Music_list Music { SCM s = $$; - SCM c = gh_cons ($2->self_scm (), SCM_EOL); + SCM c = scm_cons ($2->self_scm (), SCM_EOL); scm_gc_unprotect_object ($2->self_scm ()); /* UGH */ if (gh_pair_p (ly_cdr (s))) gh_set_cdr_x (ly_cdr (s), c); /* append */ @@ -862,14 +862,14 @@ Composite_music: SCM ms = SCM_EOL; if (stopm) { stopm = stopm->clone (); - ms = gh_cons (stopm->self_scm (), ms); + ms = scm_cons (stopm->self_scm (), ms); scm_gc_unprotect_object (stopm->self_scm ()); } - ms = gh_cons ($2->self_scm (), ms); + ms = scm_cons ($2->self_scm (), ms); scm_gc_unprotect_object ($2->self_scm()); if (startm) { startm = startm->clone (); - ms = gh_cons (startm->self_scm () , ms); + ms = scm_cons (startm->self_scm () , ms); scm_gc_unprotect_object (startm->self_scm ()); } @@ -1175,7 +1175,7 @@ request_chord: command_element: command_req { $$ = new Request_chord (SCM_EOL); - $$->set_mus_property ("elements", gh_cons ($1->self_scm (), SCM_EOL)); + $$->set_mus_property ("elements", scm_cons ($1->self_scm (), SCM_EOL)); scm_gc_unprotect_object ($1->self_scm()); $$-> set_spot (THIS->here_input ()); @@ -1188,7 +1188,7 @@ command_element: l->set_spot (THIS->here_input ()); $$ = new Request_chord (SCM_EOL); - $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL)); + $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL)); scm_gc_unprotect_object (l->self_scm()); $$->set_spot (THIS->here_input ()); } @@ -1199,13 +1199,13 @@ command_element: l->set_spot (THIS->here_input ()); $$ = new Request_chord (SCM_EOL); - $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL)); + $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL)); $$->set_spot (THIS->here_input ()); scm_gc_unprotect_object (l->self_scm()); } | E_BACKSLASH { - $$ = new Music (gh_list (gh_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED)); + $$ = new Music (gh_list (scm_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED)); $$->set_spot (THIS->here_input ()); } | '|' { @@ -1245,7 +1245,7 @@ command_element: for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) { Music * p = new Music (SCM_EOL); set_music_properties (p, ly_car (s)); - l = gh_cons (p->self_scm (), l); + l = scm_cons (p->self_scm (), l); scm_gc_unprotect_object (p->self_scm ()); } Sequential_music * seq = new Sequential_music (SCM_EOL); @@ -1399,7 +1399,7 @@ post_request: TODO. */ string_request: - '/' DIGIT { $$ = new Text_script_req (); } + E_DIGIT { $$ = new Text_script_req (); } ; request_that_take_dir: @@ -1778,7 +1778,7 @@ multiplied_duration: fraction: FRACTION { $$ = $1; } | UNSIGNED '/' UNSIGNED { - $$ = gh_cons (gh_int2scm ($1), gh_int2scm ($3)); + $$ = scm_cons (gh_int2scm ($1), gh_int2scm ($3)); } ; @@ -1861,7 +1861,7 @@ figure_list: $$ = SCM_EOL; } | figure_list br_bass_figure { - $$ = gh_cons ($2, $1); + $$ = scm_cons ($2, $1); } ; @@ -2044,10 +2044,10 @@ chord_bass: chord_step: chord_note { - $$ = gh_cons ($1, SCM_EOL); + $$ = scm_cons ($1, SCM_EOL); } | CHORDMODIFIER_PITCH { - $$ = gh_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL); + $$ = scm_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL); } | CHORDMODIFIER_PITCH chord_note { /* Ugh. */ $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (), diff --git a/lily/stem.cc b/lily/stem.cc index a7bd85ea37..510ca1b60d 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -516,6 +516,12 @@ Stem::height (SCM smob, SCM ax) Interval iv; if (mol != SCM_EOL) iv = unsmob_molecule (mol)->extent (a); + if (Grob *b =get_beam (me)) + { + Direction d = get_direction (me); + iv[d] += d * Beam::get_thickness (b) /2.0 ; + } + return ly_interval2scm (iv); } diff --git a/lily/text-spanner-engraver.cc b/lily/text-spanner-engraver.cc index 8e26e7d501..e0d1c5f0a7 100644 --- a/lily/text-spanner-engraver.cc +++ b/lily/text-spanner-engraver.cc @@ -29,7 +29,7 @@ protected: virtual bool try_music (Music *); virtual void stop_translation_timestep (); virtual void start_translation_timestep (); - virtual void process_acknowledged_grobs (); + virtual void process_music (); private: Spanner *span_; @@ -82,7 +82,7 @@ Text_spanner_engraver::try_music (Music *m) } void -Text_spanner_engraver::process_acknowledged_grobs () +Text_spanner_engraver::process_music () { if (req_drul_[STOP]) { @@ -93,14 +93,9 @@ Text_spanner_engraver::process_acknowledged_grobs () } else { - assert (!finished_); - Grob* e = unsmob_grob (get_property ("currentMusicalColumn")); - span_->set_bound (RIGHT, e); - finished_ = span_; span_ = 0; current_req_ = 0; - req_drul_[STOP] = 0; } } @@ -108,8 +103,7 @@ Text_spanner_engraver::process_acknowledged_grobs () { if (current_req_) { - req_drul_[START]->origin ()->warning - (_ ("already have a text spanner")); + req_drul_[START]->origin ()->warning(_ ("already have a text spanner")); } else { @@ -122,9 +116,6 @@ Text_spanner_engraver::process_acknowledged_grobs () span_->set_grob_property ("width-correct", gh_double2scm (0)); Side_position_interface::set_axis (span_, Y_AXIS); - Grob *e = unsmob_grob (get_property ("currentMusicalColumn")); - span_->set_bound (LEFT, e); - announce_grob (span_, req_drul_[START]->self_scm()); req_drul_[START] = 0; } @@ -134,10 +125,14 @@ Text_spanner_engraver::process_acknowledged_grobs () void Text_spanner_engraver::acknowledge_grob (Grob_info info) { - if (span_ && Note_column::has_interface (info.grob_)) + Spanner * spans[2] ={span_, finished_}; + for (int i = 0; i < 2 ; i++) { - Side_position_interface::add_support (span_, info.grob_); - add_bound_item (span_, dynamic_cast (info.grob_)); + if (spans[i] && Note_column::has_interface (info.grob_)) + { + Side_position_interface::add_support (spans[i], info.grob_); + add_bound_item (spans[i], dynamic_cast (info.grob_)); + } } } @@ -147,6 +142,12 @@ Text_spanner_engraver::typeset_all () if (finished_) { Side_position_interface::add_staff_support (finished_); + + if (!finished_->get_bound (RIGHT)) + { + Grob* e = unsmob_grob (get_property ("currentMusicalColumn")); + span_->set_bound (RIGHT, e); + } typeset_grob (finished_); finished_ = 0; } @@ -155,6 +156,12 @@ Text_spanner_engraver::typeset_all () void Text_spanner_engraver::stop_translation_timestep () { + if (span_ && !span_->get_bound (LEFT)) + { + Grob* e = unsmob_grob (get_property ("currentMusicalColumn")); + span_->set_bound (LEFT, e); + } + typeset_all (); } @@ -171,7 +178,7 @@ Text_spanner_engraver::finalize () } ENTER_DESCRIPTION(Text_spanner_engraver, -/* descr */ "Create text spanner from a Span_req ", +/* descr */ "Create text spanner from a Span_req.", /* creats*/ "TextSpanner", /* acks */ "note-column-interface", /* reads */ "", diff --git a/lily/translator-def.cc b/lily/translator-def.cc index 7db483d56a..14d7c9f9f8 100644 --- a/lily/translator-def.cc +++ b/lily/translator-def.cc @@ -62,7 +62,7 @@ Translator_def::Translator_def (Translator_def const & s) end_consists_name_list_ = scm_list_copy (s.end_consists_name_list_); accepts_name_list_ = scm_list_copy (s.accepts_name_list_); property_ops_ = scm_list_copy (s.property_ops_); - type_aliases_ = s.type_aliases_; + type_aliases_ = scm_list_copy (s.type_aliases_); translator_group_type_ = s.translator_group_type_; type_name_ = s.type_name_; } diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index b00c319c23..77078a50d1 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -308,7 +308,7 @@ Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy) { Real notey = columns[i]->extent (commony, Y_AXIS)[dir] - me->relative_coordinate (commony, Y_AXIS); - + Real x = columns[i]->relative_coordinate (commonx, X_AXIS) - x0; Real tuplety = *dy * x * factor; @@ -322,11 +322,12 @@ Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy) /* horizontal brackets should not collide with staff lines. + */ - if (*dy == 0) + Real ss= Staff_symbol_referencer::staff_space (me); + if (*dy == 0 && fabs (*offset) < ss * Staff_symbol_referencer::staff_radius (me)) { // quantize, then do collision check. - Real ss= Staff_symbol_referencer::staff_space (me); *offset *= 2 / ss; *offset = rint (*offset); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 872679695d..5929aaec4d 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -352,7 +352,7 @@ ScoreContext = \translator { %% TODO? add this alias from Timing_engraver::initialize() ? \consists "Timing_engraver" - \alias Timing + \alias "Timing" \consists "Output_property_engraver" \consists "System_start_delimiter_engraver" diff --git a/ly/performer-init.ly b/ly/performer-init.ly index 3bc296fab1..500ea65b51 100644 --- a/ly/performer-init.ly +++ b/ly/performer-init.ly @@ -115,7 +115,7 @@ ScoreContext = \translator { \accepts ChoirStaff \accepts RhythmicStaff \accepts ChordNames - + \alias "Timing" \consists "Timing_translator" \consists "Swallow_performer" -- 2.39.5