From: Rune Zedeler Date: Sat, 7 Sep 2002 16:46:13 +0000 (+0000) Subject: 2002-09-07 Rune Zedeler X-Git-Tag: release/1.6.3~36 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1a227d816c188abaa788ee3c2b593b884667db11;p=lilypond.git 2002-09-07 Rune Zedeler * 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 --- diff --git a/ChangeLog b/ChangeLog index 214fede90a..3efc068cdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,33 @@ +2002-09-07 Rune Zedeler + + * 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 * scripts/lilypond-book.py: revert pre use for python 2.2. Document why. -2002-09-07 Jérémie Lumbroso +2002-09-07 Jeremie Lumbroso * 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ŽérŽémie Lumbroso +2002-09-06 Jeremie Lumbroso * Documentation/user/refman.itely: minor corrections (replacing `grob' by `object'), addition of an example in the tablature diff --git a/input/test/bar-number-every-fifth.ly b/input/test/bar-number-every-fifth.ly index b025288075..fbcde9ac7d 100644 --- a/input/test/bar-number-every-fifth.ly +++ b/input/test/bar-number-every-fifth.ly @@ -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 diff --git a/input/test/tablature.ly b/input/test/tablature.ly index 0abc88d5ee..93c4b5614c 100644 --- a/input/test/tablature.ly +++ b/input/test/tablature.ly @@ -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 > > } diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index f7f62efc35..d9b67bb9b6 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -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 diff --git a/lily/lexer.ll b/lily/lexer.ll index 53bae6edef..48d8c35640 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -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; } diff --git a/lily/musical-request.cc b/lily/musical-request.cc index ac24a4c917..8c66bd9396 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -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 (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 { diff --git a/lily/parser.yy b/lily/parser.yy index 6de60181d2..8586fe3d01 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -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 E_UNSIGNED %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH %token FIGURE_SPACE - %type exclamations questions dots optional_rest %type bass_number bass_mod %type 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 diff --git a/lily/tab-note-heads-engraver.cc b/lily/tab-note-heads-engraver.cc index 04c07675e8..9e8062a42f 100644 --- a/lily/tab-note-heads-engraver.cc +++ b/lily/tab-note-heads-engraver.cc @@ -25,7 +25,7 @@ class Tab_note_heads_engraver : public Engraver Link_array dots_; Link_array note_reqs_; - Link_array tabstring_reqs_; + Link_array 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 (m)) + else if (String_number_req * ts = dynamic_cast (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(fretset_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 */ ""); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 5929aaec4d..c8127652da 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -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 } diff --git a/scm/grob-description.scm b/scm/grob-description.scm index 10851a8a53..d3f8f6149f 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -1026,6 +1026,7 @@ (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 diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 4a51871356..32ef10d7be 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -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)))) diff --git a/scm/translator-property-description.scm b/scm/translator-property-description.scm index 48b4d6eedd..bdfb666b53 100644 --- a/scm/translator-property-description.scm +++ b/scm/translator-property-description.scm @@ -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.")