From: hanwen Date: Sat, 10 Jan 2004 10:54:16 +0000 (+0000) Subject: * lily/tab-note-heads-engraver.cc: listen to string number events X-Git-Tag: release/2.1.9~16 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=adb3fdc3d740c4b2949434bb060788e7a8e51836;p=lilypond.git * lily/tab-note-heads-engraver.cc: listen to string number events inside < > too. (backportme). * Documentation/user/refman.itely (Text scripts): add fatText to index. --- diff --git a/ChangeLog b/ChangeLog index a0e7bd48c8..44f51cdf51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ +2004-01-10 Han-Wen Nienhuys + + * lily/tab-note-heads-engraver.cc: listen to string number events + inside < > too. (backportme). + + * Documentation/user/refman.itely (Text scripts): add fatText to + index. + 2004-01-09 Han-Wen Nienhuys + * VERSION: 2.1.8 + * stepmake/bin/add-html-footer.py (built): add Wiki links to footer. diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index 03b9b96f45..e1641e0c4a 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -16,6 +16,9 @@ Version 2.1.7 @itemize @bullet +@item The documentation now has links to a wiki, where everyone can +add personal comments to the manual. + @item Contexts may now be changed locally for an isolated music expression. For example, @@ -70,7 +73,7 @@ attached to the lyric syllable. @item When redefining a context, the associated identifier is also -updated. For example, after reading following the snippet, +updated. For example, after reading the following snippet, @example \translator @{ \ScoreContext diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 51eae7e7f5..9c35db9169 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -2163,6 +2163,9 @@ to note heads: @subsection Text scripts @cindex Text scripts +@cindex text items, non-empty +@cindex non-empty texts + It is possible to place arbitrary strings of text or markup text (see @ref{Text markup}) above or below notes by using a string: @code{c^"text"}. By default, these indications do not influence the @@ -2177,11 +2180,17 @@ It is possible to use @TeX{} commands in the strings, but this should be avoided because the exact dimensions of the string can then no longer be computed. +@refcommands + +@refcommand{fatText}, @refcommand{emptyText}. + @seealso -@internalsref{TextScriptEvent}, @internalsref{TextScript}, and -@ref{Text markup}. +In this manual: @ref{Text markup}. + +Internals: @internalsref{TextScriptEvent}, @internalsref{TextScript} + diff --git a/input/regression/tablature.ly b/input/regression/tablature.ly new file mode 100644 index 0000000000..f11eec0062 --- /dev/null +++ b/input/regression/tablature.ly @@ -0,0 +1,34 @@ +\version "2.1.7" + +\header{ texidoc = "@cindex Tabulature +A sample tablature, with both normal staff and tab. + +Tablature is done by overriding the note-head formatting function, and +putting it on a 6-line staff. A special engraver takes care of going +from string-number + pitch to number. + +String numbers can be entered as note articulations (inside a chord) and +chord articulations (outside a chord) +" +} + +partition = \notes { + \key e \major + + + <> + \5\4 +} + +\score { + \context StaffGroup << + \context Staff << + \clef "G_8" + \partition + >> + \context TabStaff << + \partition + >> + >> +} + diff --git a/lily/string-number-engraver.cc b/lily/string-number-engraver.cc index ba527cc8fe..5fdc4e79f1 100644 --- a/lily/string-number-engraver.cc +++ b/lily/string-number-engraver.cc @@ -11,7 +11,6 @@ public: TRANSLATOR_DECLARATIONS(String_number_engraver); protected: virtual bool try_music (Music* m); - }; diff --git a/lily/tab-note-heads-engraver.cc b/lily/tab-note-heads-engraver.cc index 91513e4485..e0ba6ec18e 100644 --- a/lily/tab-note-heads-engraver.cc +++ b/lily/tab-note-heads-engraver.cc @@ -17,21 +17,21 @@ #include "warn.hh" /** - make (guitar-like) tablature note - */ + make (guitar-like) tablature note +*/ class Tab_note_heads_engraver : public Engraver { Link_array notes_; Link_array dots_; - Link_array note_reqs_; - Link_array tabstring_reqs_; + Link_array note_events_; + Link_array tabstring_events_; public: TRANSLATOR_DECLARATIONS(Tab_note_heads_engraver); protected: virtual void start_translation_timestep (); - virtual bool try_music (Music *req) ; + virtual bool try_music (Music *event) ; virtual void process_music (); virtual void stop_translation_timestep (); @@ -47,20 +47,17 @@ Tab_note_heads_engraver::try_music (Music *m) { if (m->is_mus_type ("note-event")) { - note_reqs_.push (m); + note_events_.push (m); return true; } else if (m->is_mus_type ("string-number-event")) { - while(tabstring_reqs_.size () < note_reqs_.size ()-1) - tabstring_reqs_.push(0); - - tabstring_reqs_.push (m); + tabstring_events_.push (m); return true; } else if (m->is_mus_type ("busy-playing-event")) { - return note_reqs_.size (); + return note_events_.size (); } return false; @@ -70,37 +67,55 @@ Tab_note_heads_engraver::try_music (Music *m) void Tab_note_heads_engraver::process_music () { - for (int i=0; i < note_reqs_.size (); i++) + int j = 0; + for (int i=0; i < note_events_.size (); i++) { + + + SCM stringTunings = get_property ("stringTunings"); int number_of_strings = ((int) gh_length(stringTunings)); bool high_string_one = to_boolean(get_property ("highStringOne")); Item * note = new Item (get_property ("TabNoteHead")); - Music * req = note_reqs_[i]; + Music * event = note_events_[i]; + - Music * tabstring_req = 0; - if(tabstring_reqs_.size()>i) - tabstring_req = tabstring_reqs_[i]; - // printf("%d %d\n",tabstring_reqs_.size(),i); - // size_t lenp; + Music * tabstring_event=0; + + for (SCM s =event->get_mus_property ("articulations"); + !tabstring_event && gh_pair_p (s); s = gh_cdr (s)) + { + Music * art = unsmob_music (gh_car (s)); + + if (art->is_mus_type ("string-number-event")) + tabstring_event = art; + } + + if (!tabstring_event && j < tabstring_events_.size ()) + { + tabstring_event = tabstring_events_[j]; + if (j +1 < tabstring_events_.size()) + j++; + } + int tab_string; bool string_found; - if (tabstring_req) { - //char* tab_string_as_string = gh_scm2newstr(tabstring_req->get_mus_property ("text"), &lenp); - //tab_string = atoi(tab_string_as_string); - tab_string = gh_scm2int(tabstring_req->get_mus_property ("string-number")); - string_found = true; - } - else { - tab_string = high_string_one ? 1 : number_of_strings; - string_found = false; - } - - Duration dur = *unsmob_duration (req->get_mus_property ("duration")); + if (tabstring_event) + { + tab_string = gh_scm2int(tabstring_event->get_mus_property ("string-number")); + string_found = true; + } + else + { + tab_string = high_string_one ? 1 : number_of_strings; + string_found = false; + } - note->set_grob_property ("duration-log", gh_int2scm (dur.duration_log ())); + Duration dur = *unsmob_duration (event->get_mus_property ("duration")); + note->set_grob_property ("duration-log", + gh_int2scm (dur.duration_log ())); if (dur.dot_count ()) { @@ -117,19 +132,20 @@ Tab_note_heads_engraver::process_music () } - SCM scm_pitch = req->get_mus_property ("pitch"); + SCM scm_pitch = event->get_mus_property ("pitch"); SCM proc = get_property ("tablatureFormat"); SCM min_fret_scm = get_property ("minimumFret"); int min_fret = gh_number_p(min_fret_scm) ? gh_scm2int(min_fret_scm) : 0; - while(!string_found) { - int fret = unsmob_pitch(scm_pitch)->semitone_pitch() - - gh_scm2int(gh_list_ref(stringTunings,gh_int2scm(tab_string-1))); - if(fretsemitone_pitch() + - gh_scm2int(gh_list_ref(stringTunings,gh_int2scm(tab_string-1))); + if(fretset_grob_property ("text", text); note->set_grob_property ("staff-position", gh_int2scm (pos)); - announce_grob (note, req->self_scm()); + announce_grob (note, event->self_scm()); notes_.push (note); } } @@ -158,11 +174,10 @@ Tab_note_heads_engraver::stop_translation_timestep () { typeset_grob (dots_[i]); } - dots_.clear (); - - note_reqs_.clear (); - tabstring_reqs_.clear (); + dots_.clear (); + note_events_.clear (); + tabstring_events_.clear (); } void @@ -172,7 +187,7 @@ Tab_note_heads_engraver::start_translation_timestep () ENTER_DESCRIPTION(Tab_note_heads_engraver, -/* descr */ "Generate one or more tablature noteheads from Music of type Note_req.", +/* descr */ "Generate one or more tablature noteheads from Music of type NoteEvent.", /* creats*/ "TabNoteHead Dots", /* accepts */ "note-event string-number-event busy-playing-event", /* acks */ "", diff --git a/stepmake/bin/add-html-footer.py b/stepmake/bin/add-html-footer.py index 5f659c8da0..22e5875c55 100644 --- a/stepmake/bin/add-html-footer.py +++ b/stepmake/bin/add-html-footer.py @@ -263,6 +263,7 @@ def do_file (f): wiki_page = ('v%s.%s-' % (versiontup[0], versiontup[1]) + f) wiki_page = re.sub ('out-www/', '', wiki_page) wiki_page = re.sub ('/', '-', wiki_page) + wiki_page = re.sub (r'\.-', '', wiki_page) wiki_page = re.sub ('.html', '', wiki_page) subst = globals ()