]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/tab-note-heads-engraver.cc: listen to string number events
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 10 Jan 2004 10:54:16 +0000 (10:54 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 10 Jan 2004 10:54:16 +0000 (10:54 +0000)
inside < > too. (backportme).

* Documentation/user/refman.itely (Text scripts): add fatText to
index.

ChangeLog
Documentation/topdocs/NEWS.texi
Documentation/user/refman.itely
input/regression/tablature.ly [new file with mode: 0644]
lily/string-number-engraver.cc
lily/tab-note-heads-engraver.cc
stepmake/bin/add-html-footer.py

index a0e7bd48c8bf1287377383040338a6c2886f13cb..44f51cdf5105f03d426c3521570b5d105c46bc54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
+2004-01-10  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * 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   <hanwen@xs4all.nl>
 
+       * VERSION: 2.1.8
+
        * stepmake/bin/add-html-footer.py (built): add Wiki links to
        footer.
 
index 03b9b96f450c1349b41e33b05ef1329956dc8c04..e1641e0c4a6bd5bd90c4f58d302f9818a895c9b7 100644 (file)
@@ -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
index 51eae7e7f5d752f2eb3e8351c99d5dddf3506a28..9c35db9169cc875b090ecc02f27fa160713301b2 100644 (file)
@@ -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 (file)
index 0000000..f11eec0
--- /dev/null
@@ -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
+    <e\5 dis'\4>
+    <e dis'>
+    <<e\5 dis'\4>>
+    <e dis'>\5\4
+}
+
+\score {
+  \context StaffGroup <<
+    \context Staff <<
+       \clef "G_8"
+       \partition
+    >>
+    \context TabStaff <<
+       \partition
+    >>
+  >>
+}
+
index ba527cc8fe3e2097925e8334a2f6396adfabbbce..5fdc4e79f14f8c64631d40f76f8262b269937ed1 100644 (file)
@@ -11,7 +11,6 @@ public:
   TRANSLATOR_DECLARATIONS(String_number_engraver);
 protected:
   virtual bool try_music (Music* m);
-
 };
 
 
index 91513e4485373f350ed523711bc3fee427d36a34..e0ba6ec18efc48126ef1a627c911b8f87e2b710c 100644 (file)
 #include "warn.hh"
 
 /**
-  make (guitar-like) tablature note
- */
+   make (guitar-like) tablature note
+*/
 class Tab_note_heads_engraver : public Engraver
 {
   Link_array<Item> notes_;
   
   Link_array<Item> dots_;
-  Link_array<Music> note_reqs_;
-  Link_array<Music> tabstring_reqs_;
+  Link_array<Music> note_events_;
+  Link_array<Music> 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(fret<min_fret)
-         tab_string += high_string_one ? 1 : -1;
-       else
-         string_found = true;
-      }
+      while(!string_found)
+       {
+         int fret = unsmob_pitch(scm_pitch)->semitone_pitch()
+           - gh_scm2int(gh_list_ref(stringTunings,gh_int2scm(tab_string-1)));
+         if(fret<min_fret)
+           tab_string += high_string_one ? 1 : -1;
+         else
+           string_found = true;
+       }
 
       SCM text = gh_call3 (proc, gh_int2scm (tab_string), stringTunings, scm_pitch);
 
@@ -140,7 +156,7 @@ Tab_note_heads_engraver::process_music ()
       note->set_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  */      "",
index 5f659c8da0a49d154a1f1c259f3a00861c4db299..22e5875c55c5b79feb663a49ee6e2744ec255b15 100644 (file)
@@ -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 ()