From: Han-Wen Nienhuys Date: Mon, 28 Oct 2002 00:25:44 +0000 (+0000) Subject: * input/regression/finger-chords.ly (texidoc): new file. X-Git-Tag: release/1.7.5~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0afbca9d16e35aaa0602d088ec7d57ed25008870;p=lilypond.git * input/regression/finger-chords.ly (texidoc): new file. * lily/script-engraver.cc (process_music): remove scriptHorizontal support * lily/fingering-engraver.cc (process_music): remove kludgy scriptHorizontal stuff. * lily/script.cc: remove staff-support property. --- diff --git a/ChangeLog b/ChangeLog index c3a3dcd7ca..a6af655e88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2002-10-28 Han-Wen Nienhuys + + * input/regression/finger-chords.ly (texidoc): new file. + + * lily/script-engraver.cc (process_music): remove scriptHorizontal + support + + * lily/fingering-engraver.cc (process_music): remove kludgy + scriptHorizontal stuff. + + * lily/script.cc: remove staff-support property. + + * lily/new-fingering-engraver.cc (add_fingering): new + file. Fingering engraver for new style chords. + 2002-10-27 Han-Wen Nienhuys * lily/parser.yy (bare_number): allow 4 \cm (without diff --git a/VERSION b/VERSION index 2e00d51e1e..df4ced4ab5 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=7 -PATCH_LEVEL=4 +PATCH_LEVEL=5 MY_PATCH_LEVEL= # Use the above to send patches: MY_PATCH_LEVEL is always empty for a diff --git a/input/regression/finger-chords.ly b/input/regression/finger-chords.ly new file mode 100644 index 0000000000..97bcbe1146 --- /dev/null +++ b/input/regression/finger-chords.ly @@ -0,0 +1,26 @@ +\header { + +texidoc = "With the new chord syntax it's possible to associate +fingerings uniquely with notes. This makes horizontal fingering much +easier to process." + +} + +\score { + \notes \relative c'{ + <> 4 + <> 4 + <> 4 + <> 4 + <> 4 + << c-1 e-3>> 4 + << c-1 e-3 g-5 >> 4 + << c-1 e-2 g-3 b-5 >> 4 + \property Voice.fingersHorizontal = ##t + << c-1 e-3 g-5 >> 4 + \property Voice.fingersHorizontal = ##t + << c-1 e-2 g-3 b-5 >> 4 + +} + +} diff --git a/lily/fingering-engraver.cc b/lily/fingering-engraver.cc index 690a6d418f..40044e0066 100644 --- a/lily/fingering-engraver.cc +++ b/lily/fingering-engraver.cc @@ -21,10 +21,6 @@ class Fingering_engraver : public Engraver Link_array reqs_; Link_array fingerings_; - Link_array up_reqs_; - Link_array hor_reqs_; - Link_array down_reqs_; - public: TRANSLATOR_DECLARATIONS(Fingering_engraver); protected: @@ -40,11 +36,8 @@ protected: bool Fingering_engraver::try_music (Music *m) { - if (m->is_mus_type ("text-script-event")) + if (m->is_mus_type ("fingering-event")) { - if (m->get_mus_property ("text-type") != ly_symbol2scm ("finger")) - return false; - reqs_.push (m); return true; } @@ -63,111 +56,24 @@ Fingering_engraver::acknowledge_grob (Grob_info inf) } else if (Rhythmic_head::has_interface (inf.grob_)) { - Music * mc =inf.music_cause (); - Pitch * mp = mc? unsmob_pitch (mc->get_mus_property ("pitch")) :0; for (int i=0; i < fingerings_.size (); i++) { Grob*t = fingerings_[i]; Side_position_interface::add_support (t,inf.grob_); - Pitch *fp = unsmob_pitch (t->get_grob_property ("pitch")); - if (fp) - { - if (!mp) - continue; - - if (*fp == *mp) - { - Axis other = other_axis (Side_position_interface::get_axis (t)); - t->set_parent (inf.grob_, other); - } - } - else - { - if (!t->get_parent (X_AXIS)) + if (!t->get_parent (X_AXIS)) t->set_parent (inf.grob_, X_AXIS); - } } } } -static int -req_compare (Music * const &a,Music * const &b) -{ - Pitch *pa = unsmob_pitch (a->get_mus_property ("pitch")); - Pitch *pb = unsmob_pitch (b->get_mus_property ("pitch")); - - if (!pa && !pb) - return 0; - if (pa && !pb) - return 1; - if (!pa && pb) - return -1; - - return Pitch::compare (*pa, *pb); -} - void Fingering_engraver::process_music () { - if (!reqs_.size()) - return ; - - Link_array pitch_sorted_reqs = reqs_; - for (int i= pitch_sorted_reqs.size(); i--;) - { - SCM dir = pitch_sorted_reqs[i]->get_mus_property ("direction"); - if (ly_dir_p (dir) && to_dir (dir)) { - if (to_dir (dir) == UP) - up_reqs_.push (pitch_sorted_reqs[i]); - else if (to_dir (dir) == DOWN) - down_reqs_ .push (pitch_sorted_reqs[i]); - pitch_sorted_reqs.del(i); - - continue ; - } - else if (!unsmob_pitch (pitch_sorted_reqs[i]->get_mus_property ("pitch"))) - { - /* - chuck out reqs that have no pitch. We put them over the note by default. - */ - up_reqs_.push (pitch_sorted_reqs [i]); - pitch_sorted_reqs.del (i); - } - } - up_reqs_.reverse (); - down_reqs_.reverse (); - - pitch_sorted_reqs.sort (&req_compare); - - if (to_boolean (get_property ("scriptHorizontal"))) + for (int i= reqs_.size(); i--;) { -#if 1 // -> 0 for testing horizontal fingerings. - - down_reqs_.push ( pitch_sorted_reqs[0]); - pitch_sorted_reqs.del (0); - - if (pitch_sorted_reqs.size()) - { - up_reqs_.push (pitch_sorted_reqs.top ()); - pitch_sorted_reqs.pop(); - } -#endif - hor_reqs_ = pitch_sorted_reqs; + SCM dir = reqs_[i]->get_mus_property ("direction"); + make_script (to_dir (dir), reqs_[i], Y_AXIS, i); } - else - { - int sz = pitch_sorted_reqs.size (); - down_reqs_.concat (pitch_sorted_reqs.slice(0, (sz + sz%2)/2 )); - up_reqs_.concat (pitch_sorted_reqs.slice((sz + sz%2)/2, sz)); - hor_reqs_ .clear (); - } - - for (int i = 0; i < down_reqs_.size();i++) - make_script (DOWN, down_reqs_[i], Y_AXIS, i); - for (int i = 0; i < up_reqs_.size();i++) - make_script (UP, up_reqs_[i], Y_AXIS, i); - for (int i = 0; i < hor_reqs_.size();i++) - make_script (CENTER, hor_reqs_[i],X_AXIS, i); } void @@ -205,9 +111,10 @@ Fingering_engraver::make_script (Direction d, Music *r,Axis a, int i) else fingering->set_grob_property ("direction", gh_int2scm (RIGHT)); } - - fingering->set_grob_property ("text", r->get_mus_property ("text")); - + + SCM dig = r->get_mus_property ("digit"); + fingering->set_grob_property ("text", scm_number_to_string (dig, gh_int2scm (10))); + announce_grob (fingering, r->self_scm()); fingerings_.push (fingering); } @@ -231,9 +138,6 @@ void Fingering_engraver::start_translation_timestep () { reqs_.clear (); - up_reqs_.clear (); - down_reqs_.clear (); - hor_reqs_.clear (); } Fingering_engraver::Fingering_engraver() @@ -244,7 +148,7 @@ Fingering_engraver::Fingering_engraver() ENTER_DESCRIPTION(Fingering_engraver, /* descr */ "Create fingering-scripts", /* creats*/ "Fingering", -/* accepts */ "text-script-event", +/* accepts */ "fingering-event", /* acks */ "rhythmic-head-interface stem-interface", -/* reads */ "scriptHorizontal", +/* reads */ "fingersHorizontal", /* write */ ""); diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 096cf36d51..1914ed3a28 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -104,10 +104,8 @@ gulp_file_to_string (String fn) LY_DEFINE(ly_gulp_file, "ly:gulp-file", 1,0, 0, (SCM name), - "Read the file named @var{name}, and return its contents in a string. The -file is looked up using the lilypond search path. - -") + "Read the file named @var{name}, and return its contents in a string. The " +" file is looked up using the lilypond search path.") { return scm_makfrom0str (gulp_file_to_string (ly_scm2string (name)).to_str0 ()); } @@ -160,9 +158,8 @@ LY_DEFINE(ly_warning,"ly:warn", 1, 0, 0, } LY_DEFINE(ly_isdir, "ly:dir?", 1,0, 0, (SCM s), - "type predicate. A direction is a -1, 0 or 1, where -1 represents left or -down and 1 represents right or up. -") + "type predicate. A direction is a -1, 0 or 1, where -1 represents left or " +"down and 1 represents right or up. ") { if (gh_number_p (s)) { @@ -311,9 +308,8 @@ ly_scm2offset (SCM s) LY_DEFINE(ly_number2string, "ly:number->string", 1, 0,0, (SCM s), - " converts @var{num} to a string without generating many decimals. It -leaves a space at the end. -") + " converts @var{num} to a string without generating many decimals. It " +"leaves a space at the end.") { SCM_ASSERT_TYPE (gh_number_p (s), s, SCM_ARG1, __FUNCTION__, "number"); @@ -364,9 +360,7 @@ wave_sweep_goodbye (void *dummy1, void *dummy2, void *dummy3) #include "version.hh" LY_DEFINE(ly_version, "ly:version", 0, 0, 0, (), - "Return the current lilypond version as a list, e.g. -@code{(1 3 127 uu1)}. -") + "Return the current lilypond version as a list, e.g. @code{(1 3 127 uu1)}. ") { char const* vs = "\' (" MAJOR_VERSION " " MINOR_VERSION " " PATCH_LEVEL " " MY_PATCH_LEVEL ")" ; diff --git a/lily/parser.yy b/lily/parser.yy index ffbb9d01d2..7dd73519b5 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1626,11 +1626,9 @@ gen_text_def: $$ = t; } | DIGIT { - String ds = to_string ($1); - Music * t = MY_MAKE_MUSIC("TextScriptEvent"); + Music * t = MY_MAKE_MUSIC("FingerEvent"); SCM finger = ly_symbol2scm ("finger"); - t->set_mus_property ("text", scm_makfrom0str (ds.to_str0 ())); - t->set_mus_property ("text-type" , finger); + t->set_mus_property ("digit", gh_int2scm ($1)); t->set_spot (THIS->here_input ()); $$ = t; } diff --git a/lily/script-column.cc b/lily/script-column.cc index 9462cdc061..029d506e64 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -45,9 +45,16 @@ Script_column::before_line_breaking (SCM smob) { Grob* me = unsmob_grob (smob); Drul_array scripts (SCM_EOL, SCM_EOL); - Link_array staff_sided - = Pointer_group_interface__extract_grobs (me, (Grob*)0, "scripts"); - + Link_array staff_sided; + + for (SCM s = me->get_grob_property( "scripts"); gh_pair_p (s); s = gh_cdr( s)) + { + Grob *sc = unsmob_grob (gh_car (s)); + + if (!sc->has_offset_callback_b (Side_position_interface::aligned_side_proc, X_AXIS)) + staff_sided.push (sc); + } + for (int i=0; i < staff_sided.size (); i++) { Grob* g = staff_sided[i]; @@ -65,7 +72,6 @@ Script_column::before_line_breaking (SCM smob) Direction d = DOWN; do { SCM ss = scm_reverse_x (scripts[d], SCM_EOL); - ss = scm_stable_sort_x (ss, grob_script_priority_less_proc); Grob * last = 0; diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 009ee8a978..69668f20cb 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -12,11 +12,23 @@ #include "engraver.hh" #include "note-column.hh" -class Script_engraver : public Engraver + +struct Script_tuple { - Link_array scripts_; - Link_array script_reqs_; + Music *event_; + Grob * script_; + SCM description_; + Script_tuple () + { + event_ = 0; + script_ = 0; + description_ = SCM_EOL; + } +}; +class Script_engraver : public Engraver +{ + Array scripts_; public: TRANSLATOR_DECLARATIONS(Script_engraver); protected: @@ -31,7 +43,7 @@ protected: void Script_engraver::initialize () { - script_reqs_.clear (); + scripts_.clear (); } bool @@ -39,7 +51,9 @@ Script_engraver::try_music (Music *r) { if (r->is_mus_type ("articulation-event")) { - script_reqs_.push (r); + Script_tuple t; + t.event_ =r; + scripts_.push (t); return true; } return false; @@ -48,9 +62,9 @@ Script_engraver::try_music (Music *r) void Script_engraver::process_music () { - for (int i=0; i < script_reqs_.size (); i++) + for (int i=0; i < scripts_.size (); i++) { - Music* l=script_reqs_[i]; + Music* l=scripts_[i].event_; SCM alist = get_property ("scriptDefinitions"); SCM art = scm_assoc (l->get_mus_property ("articulation-type"), alist); @@ -62,13 +76,17 @@ Script_engraver::process_music () continue; } + // todo -> use result of articulation-to-scriptdef directly as basic prop list. Grob *p =new Item (get_property ("Script")); + scripts_[i].script_ = p; art = ly_cdr (art); + + scripts_[i].description_ = art; + p->set_grob_property ("script-molecule", ly_car (art)); art = ly_cdr (art); - bool follow_staff = gh_scm2bool (ly_car (art)); art = ly_cdr (art); SCM relative_stem_dir = ly_car (art); art = ly_cdr (art); @@ -84,9 +102,10 @@ Script_engraver::process_music () if (gh_number_p (s)) priority = gh_scm2int (s); - /* Make sure they're in order of user input by adding index i. - Don't use the direction in this priority. Smaller means closer - to the head. + /* + Make sure they're in order of user input by adding index i. + Don't use the direction in this priority. Smaller means closer + to the head. */ priority += i; @@ -96,23 +115,9 @@ Script_engraver::process_music () p->set_grob_property ("side-relative-direction", relative_stem_dir); - /* - FIXME: should figure this out in relation with basic props! - */ - SCM axisprop = get_property ("scriptHorizontal"); - bool xaxis = to_boolean (axisprop); - Side_position_interface::set_axis (p, xaxis ? X_AXIS : Y_AXIS); - - if (!follow_staff && ! xaxis) - p->set_grob_property ("staff-support", SCM_BOOL_T); - - if (!xaxis && follow_staff) - p->add_offset_callback (Side_position_interface::quantised_position_proc, Y_AXIS); - - + Side_position_interface::set_axis (p, Y_AXIS); p->set_grob_property ("script-priority", gh_int2scm (priority)); - - scripts_.push (p); + announce_grob (p, l->self_scm()); } @@ -125,7 +130,7 @@ Script_engraver::acknowledge_grob (Grob_info inf) { for (int i=0; i < scripts_.size (); i++) { - Grob*e = scripts_[i]; + Grob*e = scripts_[i].script_; e->set_grob_property ("direction-source", inf.grob_->self_scm ()); e->add_dependency (inf.grob_); @@ -136,7 +141,7 @@ Script_engraver::acknowledge_grob (Grob_info inf) { for (int i=0; i < scripts_.size (); i++) { - Grob *e = scripts_[i]; + Grob *e = scripts_[i].script_; if (Side_position_interface::get_axis (e) == X_AXIS && !e->get_parent (Y_AXIS)) @@ -160,7 +165,7 @@ Script_engraver::acknowledge_grob (Grob_info inf) */ for (int i=0; i < scripts_.size (); i++) { - Grob *e = scripts_[i]; + Grob *e = scripts_[i].script_; if (!e->get_parent (X_AXIS) && Side_position_interface::get_axis (e) == Y_AXIS) @@ -176,15 +181,14 @@ Script_engraver::stop_translation_timestep () { for (int i=0; i < scripts_.size (); i++) { - - /* - TODO: junk staff-support. - */ - Grob * sc = scripts_[i]; - if (to_boolean (sc->get_grob_property ("staff-support"))) - { - Side_position_interface::add_staff_support (sc); - } + if (!scripts_[i].script_) + continue; + + Grob * sc = scripts_[i].script_; + if (to_boolean (gh_cadr (scripts_[i].description_))) + sc->add_offset_callback (Side_position_interface::quantised_position_proc, Y_AXIS); + else + Side_position_interface::add_staff_support (sc); typeset_grob (sc); } scripts_.clear (); @@ -193,7 +197,7 @@ Script_engraver::stop_translation_timestep () void Script_engraver::start_translation_timestep () { - script_reqs_.clear (); + scripts_.clear (); } @@ -201,10 +205,9 @@ Script_engraver::start_translation_timestep () Script_engraver::Script_engraver(){} ENTER_DESCRIPTION(Script_engraver, -/* descr */ " Handles note ornaments generated by @code{\\script}. -", +/* descr */ "Handles note scripted articulations.", /* creats*/ "Script", /* accepts */ "script-event articulation-event", /* acks */ "stem-interface rhythmic-head-interface note-column-interface", -/* reads */ "scriptDefinitions scriptHorizontal", +/* reads */ "scriptDefinitions", /* write */ ""); diff --git a/lily/script.cc b/lily/script.cc index 7a8630dd7c..69f9325094 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -27,10 +27,13 @@ Script_interface::get_molecule (Grob * me, Direction d) SCM key = ly_car (s); if (key == ly_symbol2scm ("feta")) { + SCM name_entry = ly_cdr (s); + + SCM str = (gh_pair_p (name_entry)) ? index_get_cell (name_entry, d) : name_entry; return Font_interface::get_default_font (me)->find_by_name ("scripts-" + - ly_scm2string (index_get_cell (ly_cdr (s), d))); + ly_scm2string (str)); } - else if (key == ly_symbol2scm ("accordion")) + else if (key == ly_symbol2scm ("accordion")) { return Lookup::accordion (ly_cdr (s), 1.0, Font_interface::get_default_font (me)); } @@ -107,5 +110,5 @@ ADD_INTERFACE (Text_script,"text-script-interface", ADD_INTERFACE (Script_interface, "script-interface", "", - "script-priority script-molecule staff-support"); + "script-priority script-molecule"); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 6ed3450a10..bfdf7047eb 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -143,7 +143,7 @@ VoiceContext = \translator { \consists "Beam_engraver" \consists "Grace_beam_engraver" \consists "Auto_beam_engraver" - + \consists "New_fingering_engraver" \consists "Chord_tremolo_engraver" \consists "Percent_repeat_engraver" \consists "Melisma_engraver" diff --git a/make/lilypond.mandrake.spec.in b/make/lilypond.mandrake.spec.in index 43edd6971d..e09d22468a 100644 --- a/make/lilypond.mandrake.spec.in +++ b/make/lilypond.mandrake.spec.in @@ -1,4 +1,3 @@ -# Does info really work? %define info yes %define name lilypond @@ -10,16 +9,15 @@ Name: %{name} Version: %{version} Release: %{release} License: GPL -Group: Publishing +Group: Applications/Publishing URL: http://www.lilypond.org/ Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-%{version}.tar.gz -## Patch0: lilypond-GNUmakefile.in.patch.bz2 -Source1: %name-16x16.png.tar.bz2 -Source2: %name-32x32.png.tar.bz2 -Source3: %name-48x48.png.tar.bz2 +# Source1: %name-16x16.png.tar.bz2 +# Source2: %name-32x32.png.tar.bz2 +# Source3: %name-48x48.png.tar.bz2 BuildRoot: %{_tmppath}/%{name}-buildroot -BuildRequires: guile guile-devel -Requires: tetex +BuildRequires: t1utils bison texinfo +Requires: tetex tetex-latex %description LilyPond is a music typesetter. It produces beautiful sheet music using a @@ -52,8 +50,7 @@ example input files and the files from the Mutopia project. %prep rm -rf $RPM_BUILD_ROOT -%setup -a 1 -## % patch0 -b .orig +%setup %build # DO NOT use % { configure } , it hardcodes all paths, runs libtool, diff --git a/scm/grob-description.scm b/scm/grob-description.scm index 5271238584..3302ffba54 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -344,8 +344,6 @@ (Fingering . ( (molecule-callback . ,Text_item::brew_molecule) - (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent - ,Self_alignment_interface::aligned_on_self)) (padding . 0.6) ;; (direction . -1) (self-alignment-X . 0) diff --git a/scm/grob-property-description.scm b/scm/grob-property-description.scm index 732f157594..a8e3d1fb84 100644 --- a/scm/grob-property-description.scm +++ b/scm/grob-property-description.scm @@ -573,8 +573,7 @@ columns. (grob-property-description 'rest-collision ly:grob? "rest collision that a rest is in.") (grob-property-description 'rest-collision-done boolean? "Is this rest collision processed yet?") -(grob-property-description 'staff-support boolean? " JUNKME.") -(grob-property-description 'script-molecule pair? "index code for script.") +(grob-property-description 'script-molecule pair? "Index code for script -- internal, see script.cc.") (grob-property-description 'accidental-grob ly:grob? "Accidental for this note.") diff --git a/scm/music-property-description.scm b/scm/music-property-description.scm index 25eb13ec1a..d2ea553304 100644 --- a/scm/music-property-description.scm +++ b/scm/music-property-description.scm @@ -40,6 +40,7 @@ TODO: consider making type into symbol ") (music-property-description 'context-id string? "name of context") (music-property-description 'context-type string? "type of context") (music-property-description 'denominator integer? "denominator in a time signature") +(music-property-description 'digit integer? "digit for fingering") (music-property-description 'direction ly:dir? "Print this up or down?") (music-property-description 'text-type symbol? "Particular type of text script (eg. finger, dynamic).") (music-property-description 'element ly:music? "The single child of a Music_wrapper music object, or the body of a repeat.") diff --git a/scm/music-types.scm b/scm/music-types.scm index 9effc7b937..7746ca4cf9 100644 --- a/scm/music-types.scm +++ b/scm/music-types.scm @@ -118,7 +118,13 @@ is an articulation (such as @code{-.}, @code{->}, @code{\\tenuto}, (internal-class-name . "Event") (types . (general-music extender-event event)) - )) + )) + (FingerEvent + . ( + (description . "") + (internal-class-name . "Event") + (types . (general-music fingering-event event)) + )) (GlissandoEvent . ( (description . "") diff --git a/scm/translator-property-description.scm b/scm/translator-property-description.scm index 546cfbb863..3d9982067c 100644 --- a/scm/translator-property-description.scm +++ b/scm/translator-property-description.scm @@ -318,6 +318,8 @@ than this number of measures, no number is printed. ") scripts left or right of note heads. Support for this is limited. Accidentals will collide with scripts. ") +(translator-property-description 'fingersHorizontal boolean? "Put the middle fingerings to the +right side of the note head.") (translator-property-description 'skipBars boolean? " Set to true to skip the empty bars that are produced by multimeasure notes and rests.