]> git.donarmstrong.com Git - lilypond.git/commitdiff
2002-09-07 Rune Zedeler <rune@zedeler.dk>
authorRune Zedeler <rune@lilypond.org>
Sat, 7 Sep 2002 16:46:13 +0000 (16:46 +0000)
committerRune Zedeler <rune@lilypond.org>
Sat, 7 Sep 2002 16:46:13 +0000 (16:46 +0000)
* lily/parser.yy and lily/lexer.ll: Use E_UNSIGNED instead of E_DIGIT

* lily/musical-request.cc (String_number_req): Added

* lily/tab-note-heads-engraver.cc: Use String_number_req instead of Text_script_req;
read properties stringOneTopmost and highStringOne.

* ly/engraver-init.ly (tabStaffContext): Bugfix: remove Key_engraver
set stringOneTopmost and highStringOne to #t

* scm/output-lib.scm (tablature-stem-attachment-function): Changed
(guitar-tunings): List added
((every-nth-bar-number-visible n) barnum): Instead of default-bar-number-visibility

* scm/grob-description.scm (TabNoteHead): Extra-offset added (UGH!)

* scm/translator-property-description.scm: Added new functions

* input/test/tablature.ly: Changed to better demonstrate possibilities.

* input/test/bar-number-every-fifth: Use new function

12 files changed:
ChangeLog
input/test/bar-number-every-fifth.ly
input/test/tablature.ly
lily/include/musical-request.hh
lily/lexer.ll
lily/musical-request.cc
lily/parser.yy
lily/tab-note-heads-engraver.cc
ly/engraver-init.ly
scm/grob-description.scm
scm/output-lib.scm
scm/translator-property-description.scm

index 214fede90a2d85b50738a8620cab73b44ad4ddb8..3efc068cdf48a3e76a8713555296ad13d5f27295 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,33 @@
+2002-09-07  Rune Zedeler  <rune@zedeler.dk>
+
+       * lily/parser.yy and lily/lexer.ll: Use E_UNSIGNED instead of E_DIGIT
+       
+       * lily/musical-request.cc (String_number_req): Added
+
+       * lily/tab-note-heads-engraver.cc: Use String_number_req instead of Text_script_req;
+       read properties stringOneTopmost and highStringOne.
+       
+       * ly/engraver-init.ly (tabStaffContext): Bugfix: remove Key_engraver
+       set stringOneTopmost and highStringOne to #t
+       
+       * scm/output-lib.scm (tablature-stem-attachment-function): Changed
+       (guitar-tunings): List added
+       ((every-nth-bar-number-visible n) barnum): Instead of default-bar-number-visibility
+
+       * scm/grob-description.scm (TabNoteHead): Extra-offset added (UGH!)
+       
+       * scm/translator-property-description.scm: Added new functions
+
+       * input/test/tablature.ly: Changed to better demonstrate possibilities.
+
+       * input/test/bar-number-every-fifth: Use new function
+       
 2002-09-07  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
        * scripts/lilypond-book.py: revert pre use for python
        2.2. Document why.
 
-2002-09-07  J\81ér\81émie Lumbroso  <jeremie@lumbroso.fr>
+2002-09-07 Jeremie Lumbroso  <jeremie@lumbroso.fr>
 
         * Documentation/user/refman.itely: very minor corrections and
        rephrasing of the reference manual -- revision up to line #400.
@@ -48,7 +72,7 @@
        * lily/parser.yy (chord_inversion): use CHORD_SLASH for '/'
        (command_element): use Timing as alias for Score.
 
-2002-09-06  J\8eér\8eémie Lumbroso  <jeremie@lumbroso.fr>
+2002-09-06  Jeremie Lumbroso  <jeremie@lumbroso.fr>
 
        * Documentation/user/refman.itely: minor corrections (replacing
        `grob' by `object'), addition of an example in the tablature
index b025288075b2ebdca76df5d393a00d10eabba0b8..fbcde9ac7d312fddbed0a2bf3d34a327859a2b4e 100644 (file)
@@ -1,7 +1,7 @@
 \score {
     \context Staff \notes \transpose c'' {
        \property Score.BarNumber \override #'break-visibility = #end-of-line-invisible
-       \property Score.barNumberVisibility = #(lambda(n) (= 0 (modulo n 5)))
+       \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
        \property Score.BarNumber \override #'molecule-callback =
        #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
        \property Score.BarNumber \override #'font-relative-size = #1
index 0abc88d5ee514ae692154b2fb6546e0d3c929589..93c4b5614c40599d67b10a09eede3efe5588da53 100644 (file)
@@ -1,4 +1,4 @@
-\version "1.5.68"
+\version "1.6.2"
 
 %{
 
@@ -11,20 +11,22 @@ from string-number + pitch to number.
 %}
 
 partition = \notes {
-    a,4-2 c'-5 a-4 e'-6
-    e-3 c'-5 a-4 e'-6
-  }
+    \key e \major
+    e8\5 fis\5 gis\5 a\5 b\5 cis'\5 dis'\5 e'\5
+    e8\4 fis\4 gis\4 a\4 b\4 cis'\4 dis'\4 e'\4
+    e8 fis gis a b cis' dis' e'
+    \property Score.minimumFret = #5
+    e8 fis gis a b cis' dis' e'
+}
 
 \score {
   \context StaffGroup <
     \context Staff <
-      % Hide fingering number (used for string number) for the "normal" staff
-      \property Staff.Fingering \override #'transparent = ##t
-      
-      \partition
+       \clef "G_8"
+       \partition
     >
     \context TabStaff <
-      \partition
+       \partition
     >
   >
 }
index f7f62efc35473114b8499ced7e27af6d36b19cea..d9b67bb9b6a4f0a137c1e0aa8fde957b8334ef48 100644 (file)
@@ -75,6 +75,12 @@ protected:
   virtual bool do_equal_b (Request const*) const;
 };
 
+class String_number_req : public Script_req
+{
+protected:
+  VIRTUAL_COPY_CONS (Music);
+  virtual bool do_equal_b (Request const*) const;
+};
 
 /// request which has some kind of pitch
 struct Melodic_req :virtual Request
index 53bae6edef3ecd8bf5496b5d74ec919abfcd76f9..48d8c3564048cdac9e594947b7161ebfac8c5bd8 100644 (file)
@@ -113,6 +113,7 @@ WORD                {A}{AN}*
 ALPHAWORD      {A}+
 DIGIT          {N}
 UNSIGNED       {N}+
+E_UNSIGNED     \\{N}+
 FRACTION       {N}+\/{N}+
 INT            -?{UNSIGNED}
 REAL           ({INT}\.{N}*)|(-?\.{N}+)
@@ -303,6 +304,10 @@ HYPHEN             --
                yylval.i = String_convert::dec2int (String (YYText ()));
                return UNSIGNED;
        }
+       {E_UNSIGNED}    {
+               yylval.i = String_convert::dec2int (String (YYText () +1));
+               return E_UNSIGNED;
+       }
 
        \" {
                start_quote ();
@@ -438,6 +443,7 @@ HYPHEN              --
        return UNSIGNED;
 }
 
+
 [{}]   {
 
        return YYText ()[0];
@@ -475,11 +481,6 @@ HYPHEN             --
     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;
     }
index ac24a4c9172f6e55a23e63854770088fe406bcfc..8c66bd9396507a78a25b55514be5f00538163887 100644 (file)
@@ -85,6 +85,15 @@ Text_script_req::do_equal_b (Request const* r) const
                          t->get_mus_property ("text"));
 }
 
+bool
+String_number_req::do_equal_b (Request const* r) const
+{
+  String_number_req const* s  = dynamic_cast<String_number_req const*> (r);
+  return s && gh_equal_p (get_mus_property ("string"),
+                         s->get_mus_property ("string"));
+}
+
+
 bool
 Articulation_req::do_equal_b (Request const* r) const
 {
index 6de60181d2b9c4e828c9ecbc5b921af5986bb5e0..8586fe3d01bec8aa1fa206ea624ac3d39451e943 100644 (file)
@@ -241,12 +241,12 @@ 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 E_DIGIT
+%token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
 %token E_BACKSLASH
+%token <i> E_UNSIGNED
 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET  CHORD_SLASH
 %token FIGURE_SPACE
 
-
 %type <i>      exclamations questions dots optional_rest
 %type <i>      bass_number bass_mod
 %type <scm>    br_bass_figure bass_figure figure_list figure_spec
@@ -1395,13 +1395,16 @@ post_request:
        ;
 
 
-/*
-TODO.
-*/
 string_request:
-       E_DIGIT  { $$ = new Text_script_req (); } 
+       E_UNSIGNED {
+               String_number_req* s = new String_number_req;
+               s->set_mus_property ("string-number",  gh_int2scm($1));
+               s->set_spot (THIS->here_input ());
+               $$ = s;
+       }
        ;
 
+
 request_that_take_dir:
        gen_text_def
        | verbose_request
index 04c07675e827e41b4258fda683771324dc908d83..9e8062a42fc93efd9b3cff0732466f34366cd4f8 100644 (file)
@@ -25,7 +25,7 @@ class Tab_note_heads_engraver : public Engraver
   
   Link_array<Item> dots_;
   Link_array<Note_req> note_reqs_;
-  Link_array<Text_script_req> tabstring_reqs_;
+  Link_array<String_number_req> tabstring_reqs_;
 public:
   TRANSLATOR_DECLARATIONS(Tab_note_heads_engraver);
 
@@ -50,10 +50,8 @@ Tab_note_heads_engraver::try_music (Music *m)
       note_reqs_.push (n);
       return true;
     }
-  else if (Text_script_req * ts = dynamic_cast<Text_script_req*> (m))
+  else if (String_number_req * ts = dynamic_cast<String_number_req*> (m))
     {
-      if (m->get_mus_property ("text-type") != ly_symbol2scm ("finger")) return false;
-      
       while(tabstring_reqs_.size () < note_reqs_.size ()-1)
        tabstring_reqs_.push(0);
       tabstring_reqs_.push(ts);
@@ -75,6 +73,7 @@ Tab_note_heads_engraver::process_music ()
     {
       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"));
       
@@ -84,16 +83,17 @@ Tab_note_heads_engraver::process_music ()
       if(tabstring_reqs_.size()>i)
        tabstring_req = tabstring_reqs_[i];
       // printf("%d %d\n",tabstring_reqs_.size(),i);
-      size_t lenp;
+      // size_t lenp;
       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);
+       //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 = number_of_strings;
+       tab_string = high_string_one ? 1 : number_of_strings;
        string_found = false;
       }
       
@@ -125,15 +125,16 @@ Tab_note_heads_engraver::process_music ()
        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--;
+         tab_string += high_string_one ? 1 : -1;
        else
          string_found = true;
       }
 
       SCM text = gh_call3 (proc, gh_int2scm (tab_string), stringTunings, scm_pitch);
 
-      int pos = 2 * (tab_string-1) - number_of_strings; // No tab-note between the string !!!
-      
+      int pos = 2 * tab_string - number_of_strings - 1; // No tab-note between the string !!!
+      if(to_boolean(get_property("stringOneTopmost")))
+       pos = -pos;
       
       note->set_grob_property ("text", text);      
       
@@ -173,6 +174,6 @@ ENTER_DESCRIPTION(Tab_note_heads_engraver,
 /* descr */       "Generate one or more tablature noteheads from Music of type Note_req.",
 /* creats*/       "TabNoteHead Dots",
 /* acks  */       "",
-/* reads */       "centralCPosition stringTunings minimumFret tablatureFormat",
+/* reads */       "centralCPosition stringTunings minimumFret tablatureFormat highStringOne stringOneTopmost",
 /* write */       "");
 
index 5929aaec4d5415b817f84eb1e93638e77c1abdd6..c8127652da45e4b2e1d65fd1d366beac00bf569d 100644 (file)
@@ -397,7 +397,7 @@ ScoreContext = \translator {
        automaticMelismata = ##t
        
        defaultBarType = #"|"
-       barNumberVisibility = #default-bar-number-visibility
+       barNumberVisibility = #(every-nth-bar-number-visible 1)
 
        explicitClefVisibility = #all-visible
        explicitKeySignatureVisibility = #all-visible
@@ -495,6 +495,10 @@ TabStaffContext = \translator {
       % 6 strings
       StaffSymbol \override #'line-count  = #6
       StaffSymbol \override #'staff-space = #1.5
+
+      stringOneTopmost = ##t
+      highStringOne = ##t
+
       % One may change the strings tuning as following :
       % The lenght of the list must be equal to the number of string
       %TabNoteHead \override #'string-tunings = #'(10 10 10 10 10 10)
@@ -503,12 +507,13 @@ TabStaffContext = \translator {
       clefGlyph = #"clefs-tab"
       clefPosition = #0
       
-      % Don't draw stems over the tabature figures !
+      % Don't draw stems over the tablature figures !
       Stem \override #'avoid-note-head = ##t
       
       % No accidental in tablature !
       \remove Accidental_engraver
-      stringTunings   = #'(-20 -15 -10 -5 -1 4)
+      \remove Key_engraver
+      stringTunings   = #guitar-tunings
       tablatureFormat = #fret-number-tablature-format
 }
    
index 10851a8a5327469e84e6e2681cd6ac97624fd33b..d3f8f6149f79f5fb8a7d61591336ee20877c9fd4 100644 (file)
        (style . default)
        (molecule-callback . ,tablature-molecule-callback)
        (Y-offset-callbacks  . (,Staff_symbol_referencer::callback))
+       (extra-offset . (0 . -0.65)) ;; UGH! TODO: Clean this up!
        (stem-attachment-function . ,tablature-stem-attachment-function)
        (meta . ((interfaces
                  . (rhythmic-head-interface
index 4a51871356bf4752b9e6cd1f7d3125ee8dfc16fc..32ef10d7be8719c73ff3578848417e6e6218b3cc 100644 (file)
@@ -9,7 +9,7 @@
 
 ; The TabNoteHead stem attachment function.
 (define (tablature-stem-attachment-function style duration)
-  (cons 0.0 1.0)
+  (cons 0.0 0.5) ;; UGH!
 )
 
 ; The TabNoteHead molecule callback.
@@ -66,6 +66,7 @@
 
 
 
+(define guitar-tunings '(4 -1 -5 -10 -15 -20))
 
 ; end of tablature functions
 
@@ -221,4 +222,4 @@ centered, X==1 is at the right, X == -1 is at the left."
          (string-encode-integer (quotient i 26))))))
 
 
-(define (default-bar-number-visibility n) (> n 1))
+(define ((every-nth-bar-number-visible n) barnum) (and (> barnum 1) (= 0 (modulo barnum n))))
index 48b4d6eedd18318519c6686eb912a418a8863f05..bdfb666b53bed711ceedc4b982be27d8a2867a65 100644 (file)
@@ -223,6 +223,8 @@ in a context. This is done using the @code{Font_size_engraver}.")
 (translator-property-description 'forceClef boolean? "Show clef symbol, even if it hasn't changed. Only active for the first clef after the property is set, not for the full staff.")
 (translator-property-description 'graceAccidentalSpace number? "amount space to alot for an accidental")
 (translator-property-description 'graceAlignPosition dir? "put the grace note before or after the main note?")
+(translator-property-description 'highStringOne boolean? "Whether the 1st string is the string with
+highest pitch on the instrument (used by the automatic string selector).")
 (translator-property-description 'instr markup? "see @code{instrument}")
 (translator-property-description 'instrument markup? " If @code{Instrument_name_engraver}
 @cindex Instrument_name_engraver
@@ -323,6 +325,8 @@ help with debugging large scores.")
 (translator-property-description 'split-interval boolean? "set if part-combiner separated voices based on splitInterval.")
 (translator-property-description 'squashedPosition integer? " Vertical position of
 squashing for Pitch_squash_engraver.")
+(translator-property-description 'stringOneTopmost boolean? "Whether the 1st string is printed on the
+top line of the tablature.")
 (translator-property-description 'stavesFound list? "list of all staff-symbols found.")
 (translator-property-description 'stanza markup? "Stanza `number' to print at start of a verse. Use in LyricsVoice context.")