From: Han-Wen Nienhuys Date: Sat, 4 Jan 2003 17:51:06 +0000 (+0000) Subject: * Documentation/user/appendices.itely (scheme): update for new syntax. X-Git-Tag: release/1.7.11~11 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=612098a4f2039883d75d2ced3e5003f3b665dd28;p=lilypond.git * Documentation/user/appendices.itely (scheme): update for new syntax. * input/regression/chord-name-styles.ly: new file * lily/instrument-name-engraver.cc: create instrument names without barline too. Allows instrument name on ChordNames * scm/new-markup.scm (interpret-markup): allow simple strings as markup too. --- diff --git a/ChangeLog b/ChangeLog index bf5bfc34f3..fbb6e5e872 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-01-04 Han-Wen Nienhuys + + * Documentation/user/appendices.itely (scheme): update for new syntax. + + * input/regression/chord-name-styles.ly: new file + + * lily/instrument-name-engraver.cc: create instrument names + without barline too. Allows instrument name on ChordNames + + * scm/new-markup.scm (interpret-markup): allow simple strings as + markup too. + 2003-01-04 Jan Nieuwenhuizen * scm/chord-name.scm: Super/raise changes and fixes for Banter. diff --git a/Documentation/user/appendices.itely b/Documentation/user/appendices.itely index ac8a2d91e6..7920b2a806 100644 --- a/Documentation/user/appendices.itely +++ b/Documentation/user/appendices.itely @@ -70,16 +70,13 @@ scheme = \chords { \score { \notes < - \context ChordNames \scheme + \context ChordNames { + #(set-chord-name-style 'american) + \scheme } \context Staff \transpose c c' \scheme > \paper { linewidth = 5.7\in - \translator { - \ChordNamesContext - ChordName \override #'word-space = #1 - ChordName \override #'style = #'american - } } } @end lilypond @@ -134,16 +131,13 @@ scheme = \chords { \score { \notes < - \context ChordNames \scheme + \context ChordNames { + #(set-chord-name-style 'jazz) + \scheme } \context Staff \transpose c c' \scheme > \paper { linewidth = 5.7\in - \translator { - \ChordNamesContext - ChordName \override #'word-space = #1 - ChordName \override #'style = #'jazz - } } } @end lilypond diff --git a/input/regression/chord-name-styles.ly b/input/regression/chord-name-styles.ly new file mode 100644 index 0000000000..46c15b356d --- /dev/null +++ b/input/regression/chord-name-styles.ly @@ -0,0 +1,74 @@ +\header { + texidoc = " show different naming conventions" +} + +\version "1.7.10" + +scheme = \chords { + % major chords + c + c:6 % 6 = major triad with added sixth + c:maj % triangle = maj + c:6.9^7 % 6/9 + c:9^7 % add9 + + % minor chords + c:m % m = minor triad + c:m.6 % m6 = minor triad with added sixth + c:m.7+ % m triangle = minor major seventh chord + c:3-.6.9^7 % m6/9 + c:m.7 % m7 + c:3-.9 % m9 + c:3-.9^7 % madd9 + + % dominant chords + c:7 % 7 = dominant + c:7.5+ % +7 = augmented dominant + c:7.5- % 7b5 = hard diminished dominant + c:9 % 7(9) + c:9- % 7(b9) + c:9+ % 7(#9) + c:13^9.11 % 7(13) + c:13-^9.11 % 7(b13) + c:13^11 % 7(9,13) + c:13.9-^11 % 7(b9,13) + c:13.9+^11 % 7(#9,13) + c:13-^11 % 7(9,b13) + c:13-.9-^11 % 7(b9,b13) + c:13-.9+^11 % 7(#9,b13) + + % half diminished chords + c:m5-.7 % slashed o = m7b5 + c:9.3-.5- % o/7(pure 9) + + % diminished chords + c:m5-.7- % o = diminished seventh chord +} + +\score { + \notes < + \context ChordNames { + #(set-chord-name-style 'jazz) + \property ChordNames.instrument = #"Jazz" + \property ChordNames.instr = #"Jz" + \scheme } + \context ChordNames = bn { + #(set-chord-name-style 'banter) + \property ChordNames.instrument = # "Banter" + \property ChordNames.instr = #"Bn" + \scheme } + \context ChordNames = am { + #(set-chord-name-style 'american) + \property ChordNames.instr = #"Am" + \property ChordNames.instrument = #"American" + \scheme } + \context Staff \transpose c c' \scheme + > +\paper { +linewidth = 16.0\cm + +\translator { + \ChordNamesContext \consists Instrument_name_engraver } +} +} +%% new-chords-done %% diff --git a/input/regression/instrument-name-markup.ly b/input/regression/instrument-name-markup.ly new file mode 100644 index 0000000000..dce7f0f23b --- /dev/null +++ b/input/regression/instrument-name-markup.ly @@ -0,0 +1,26 @@ +\header { + +texidoc = "Instrument names are set with Staff.instrument and +Staff.instr. You can enter markup texts to create more funky names, +including alterations. " + +} + + +\version "1.7.6" + + +\score { + \notes \context Staff = treble { + \property Staff.instrument + = \markup { \column << "Clarinetti" { "in B" \smaller \musicglyph #"accidentals--1" } >> } + \property Staff.instr + = \markup { \smaller { "Cl(B" \smaller \musicglyph #"accidentals--1" ")" } } + + { c''1 \break c'' } + + } + \paper { linewidth= 8.0\cm } +} + +%% new-chords-done %% diff --git a/input/regression/instrument-name.ly b/input/regression/instrument-name.ly new file mode 100644 index 0000000000..6f0f6f0bc3 --- /dev/null +++ b/input/regression/instrument-name.ly @@ -0,0 +1,25 @@ +\version "1.7.6" +\header{ +texidoc=" +Staff margins are also markings attached to barlines. They should be +left of the staff, and be centered vertically wrt the staff. They may +be on normal staves, but also on compound staves, like the PianoStaff +" +} + + + + +\score { + + \notes \context PianoStaff < + \context Staff = treble { + \property PianoStaff.instrument = "Piano " + \property Staff.instrument = "Right " { c''4 }} + \context Staff = bass { \property Staff.instrument = "Left " \clef bass c4 }> + +\paper { +linewidth=-1.0 +}} + +%% new-chords-done %% diff --git a/input/regression/staff-margin.ly b/input/regression/staff-margin.ly deleted file mode 100644 index 6f0f6f0bc3..0000000000 --- a/input/regression/staff-margin.ly +++ /dev/null @@ -1,25 +0,0 @@ -\version "1.7.6" -\header{ -texidoc=" -Staff margins are also markings attached to barlines. They should be -left of the staff, and be centered vertically wrt the staff. They may -be on normal staves, but also on compound staves, like the PianoStaff -" -} - - - - -\score { - - \notes \context PianoStaff < - \context Staff = treble { - \property PianoStaff.instrument = "Piano " - \property Staff.instrument = "Right " { c''4 }} - \context Staff = bass { \property Staff.instrument = "Left " \clef bass c4 }> - -\paper { -linewidth=-1.0 -}} - -%% new-chords-done %% diff --git a/input/test/chord-names-jazz.ly b/input/test/chord-names-jazz.ly index fd996ce836..cff6c0320e 100644 --- a/input/test/chord-names-jazz.ly +++ b/input/test/chord-names-jazz.ly @@ -1,6 +1,7 @@ \version "1.7.10" - - +\header { +texidoc = "Jazz notation for chord names." +} %% This should only be necessary if your kpathsea setup is broken % diff --git a/input/test/instrument-name.ly b/input/test/instrument-name.ly deleted file mode 100644 index 79f81296c5..0000000000 --- a/input/test/instrument-name.ly +++ /dev/null @@ -1,23 +0,0 @@ -\header { -texidoc = "Instrument names are -set with Staff.instrument and Staff.instr" -} - - -\version "1.7.6" - - -\score { - \notes \context Staff = treble { - \property Staff.instrument - = \markup { \column << "Clarinetti" { "in B" \smaller \musicglyph #"accidentals--1" } >> } - \property Staff.instr - = \markup { \smaller { "Cl(B" \smaller \musicglyph #"accidentals--1" ")" } } - - { c''1 \break c'' } - - } - \paper { linewidth= 8.0\cm } -} - -%% new-chords-done %% diff --git a/lily/includable-lexer.cc b/lily/includable-lexer.cc index 34c33a3b44..440b9d507a 100644 --- a/lily/includable-lexer.cc +++ b/lily/includable-lexer.cc @@ -73,7 +73,6 @@ Includable_lexer::new_input (String s, Sources * global_sources) */ yy_switch_to_buffer (yy_create_buffer (sl->get_istream (), YY_BUF_SIZE)); - } /* diff --git a/lily/instrument-name-engraver.cc b/lily/instrument-name-engraver.cc index 593de87001..1b94c20a4f 100644 --- a/lily/instrument-name-engraver.cc +++ b/lily/instrument-name-engraver.cc @@ -22,13 +22,14 @@ class Instrument_name_engraver : public Engraver Item *text_; Grob *delim_ ; - void create_text (SCM s); + void create_text (); public: TRANSLATOR_DECLARATIONS(Instrument_name_engraver); virtual void initialize (); virtual void acknowledge_grob (Grob_info); virtual void stop_translation_timestep (); + virtual void process_music (); }; @@ -59,10 +60,18 @@ Instrument_name_engraver::stop_translation_timestep () } void -Instrument_name_engraver::create_text (SCM txt) +Instrument_name_engraver::create_text () { - if (!text_) + if (!text_) { + SCM txt = get_property ("instrument"); + + if (now_mom () > Moment (0)) + txt = get_property ("instr"); + + if (!new_markup_p (txt)) + return ; + text_ = new Item (get_property ("InstrumentName")); if (text_->get_grob_property ("text") != txt) @@ -83,16 +92,7 @@ Instrument_name_engraver::acknowledge_grob (Grob_info i) { if (Bar_line::has_interface (i.grob_)) { - SCM s = get_property ("instrument"); - - if (now_mom () > Moment (0)) - s = get_property ("instr"); - - /* - FIXME: use get_markup () to check type. - */ - if (gh_string_p (s) || gh_pair_p (s)) - create_text (s); + create_text(); } if (dynamic_cast (i.grob_) @@ -104,11 +104,9 @@ Instrument_name_engraver::acknowledge_grob (Grob_info i) groups enclosing that staff. The alignment has no real location, but is only a vehicle for the placement routine it contains, and therefore the location of its refpoint won't be very useful. - We could also just use stavesFound, but lets keep this working without staffs as well. - */ if (dynamic_cast (i.grob_) && ((Axis_group_interface::has_interface (i.grob_) @@ -122,8 +120,16 @@ Instrument_name_engraver::acknowledge_grob (Grob_info i) } } - - +void +Instrument_name_engraver::process_music () +{ + /* + Also create text if barlines in other groups. This allows + a name to be attached to lyrics or chords. + */ + if (gh_string_p (get_property ("whichBar"))) + create_text(); +} ENTER_DESCRIPTION(Instrument_name_engraver, /* descr */ " Prints the name of the instrument (specified by " diff --git a/lily/text-item.cc b/lily/text-item.cc index 916185be14..6a6fa9f42d 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -253,11 +253,16 @@ ADD_INTERFACE (Text_item,"text-interface", "text axis baseline-skip extent lookup raise kern word-space"); +/* + Ugh. Duplicated from Scheme. + */ bool new_markup_p (SCM x) { - return gh_pair_p (x) - && SCM_BOOL_F != scm_object_property (gh_car (x), ly_symbol2scm ("markup-signature")); + return + gh_string_p (x) || + (gh_pair_p (x) + && SCM_BOOL_F != scm_object_property (gh_car (x), ly_symbol2scm ("markup-signature"))); } SCM diff --git a/scm/new-markup.scm b/scm/new-markup.scm index b940653586..f20fdf806a 100644 --- a/scm/new-markup.scm +++ b/scm/new-markup.scm @@ -316,18 +316,21 @@ for the reader. ;; full recursive typecheck. ;; (define (markup-typecheck? arg) - (and (pair? arg) + (or (string? arg) + (and (pair? arg) (markup-function? (car arg)) (markup-argument-list? (object-property (car arg) 'markup-signature) (cdr arg)) )) +) ;; ;; typecheck, and throw an error when something amiss. ;; (define (markup-thrower-typecheck arg) (cond + ((string? arg) #t) ((not (pair? arg)) (throw 'markup-format "Not a pair" arg) ) @@ -342,13 +345,13 @@ for the reader. #t ) - ;; ;; good enough if you only use make-XXX-markup functions. ;; (define (cheap-markup? x) - (and (pair? x) - (markup-function? (car x))) + (or (string? x) + (and (pair? x) + (markup-function? (car x)))) ) ;; @@ -528,14 +531,16 @@ against SIGNATURE, reporting MAKE-NAME as the user-invoked function. (define-public empty-markup `(,simple-markup "")) (define (interpret-markup grob props markup) - (let* - ( - (func (car markup)) - (args (cdr markup)) - ) - - (apply func (cons grob (cons props args)) ) - )) + (if (string? markup) + (simple-markup grob props markup) + (let* + ( + (func (car markup)) + (args (cdr markup)) + ) + + (apply func (cons grob (cons props args)) ) + ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;