]> git.donarmstrong.com Git - lilypond.git/commitdiff
* Documentation/user/appendices.itely (scheme): update for new syntax.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 4 Jan 2003 17:51:06 +0000 (17:51 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 4 Jan 2003 17:51:06 +0000 (17:51 +0000)
* 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.

12 files changed:
ChangeLog
Documentation/user/appendices.itely
input/regression/chord-name-styles.ly [new file with mode: 0644]
input/regression/instrument-name-markup.ly [new file with mode: 0644]
input/regression/instrument-name.ly [new file with mode: 0644]
input/regression/staff-margin.ly [deleted file]
input/test/chord-names-jazz.ly
input/test/instrument-name.ly [deleted file]
lily/includable-lexer.cc
lily/instrument-name-engraver.cc
lily/text-item.cc
scm/new-markup.scm

index bf5bfc34f3fae920a0ba90e7f2ad444cc15b81d9..fbb6e5e8723481e4cdb54619057fcf67c8df5429 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2003-01-04  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * 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  <janneke@gnu.org>
 
        * scm/chord-name.scm: Super/raise changes and fixes for Banter.
index ac8a2d91e6b551fdcaf402d0a5575005ca31d0c5..7920b2a8069ba45fe9c194a82e52b97e0d11a774 100644 (file)
@@ -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 (file)
index 0000000..46c15b3
--- /dev/null
@@ -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 (file)
index 0000000..dce7f0f
--- /dev/null
@@ -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 (file)
index 0000000..6f0f6f0
--- /dev/null
@@ -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 (file)
index 6f0f6f0..0000000
+++ /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 %%
index fd996ce836a5ed9056ee5aa6f26d514d942bbdfe..cff6c0320e6bb85b9a67226811c89c68664c7306 100644 (file)
@@ -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 (file)
index 79f8129..0000000
+++ /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 %%
index 34c33a3b44c485834e3c46736b432e3a85b7c961..440b9d507acbdc2aa3c17aeedb253ba3675f6378 100644 (file)
@@ -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));
-
 }
 
 /*
index 593de87001cdf08b09e8b1a981d04c617a5424ec..1b94c20a4f508e98bcb75e20caf6e9942fa78345 100644 (file)
@@ -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<Spanner*> (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<Spanner*> (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 "
index 916185be148c61fb244618314f1f865969c224a9..6a6fa9f42ddb0b11d9919727d4d59bb7136ae18a 100644 (file)
@@ -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
index b94065358636297b5663b7133b63eff9c088f5f2..f20fdf806a967b33af549fdcf124415093d65b2f 100644 (file)
@@ -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)) )
+       )))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;