]> git.donarmstrong.com Git - lilypond.git/commitdiff
* Documentation/user/basic-notation.itely (Explicitly
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 3 May 2005 12:13:28 +0000 (12:13 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 3 May 2005 12:13:28 +0000 (12:13 +0000)
instantiating voices): idem.

* Documentation/user/advanced-notation.itely (Text spanners):
remove stray { }

* lily/context.cc (default_child_context_name): the default child
is now first in accepts_list_.

* ly/engraver-init.ly (RemoveEmptyRhythmicStaffContext): add
\defaultchild to all relevant contexts.  This fixes default voices
for \drums { } . Most probably, this also fixes similar problems
with ancient transcriptions getting CueVoices instead of the
desired voices.

* lily/context-def.cc (get_default_child): new function.
(get_accepted): place default child in front of list.

* lily/parser.yy (FIXME): add DEFAULTCHILD token.

* lily/include/context-def.hh (struct Context_def): add
default_accept_

ChangeLog
Documentation/user/advanced-notation.itely
Documentation/user/basic-notation.itely
lily/context-def.cc
lily/context.cc
lily/include/context-def.hh
lily/include/context.hh
lily/lily-lexer.cc
lily/note-heads-engraver.cc
lily/parser.yy
ly/engraver-init.ly

index 621feac57aa8642212d0d7e677070550b0ebe710..8e2d08de703ad58a502234229e80c000ee151f19 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2005-05-03  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * Documentation/user/basic-notation.itely (Explicitly
+       instantiating voices): idem.
+
+       * Documentation/user/advanced-notation.itely (Text spanners):
+       remove stray { } 
+
+       * lily/context.cc (default_child_context_name): the default child
+       is now first in accepts_list_.
+
+       * ly/engraver-init.ly (RemoveEmptyRhythmicStaffContext): add
+       \defaultchild to all relevant contexts.  This fixes default voices
+       for \drums { } . Most probably, this also fixes similar problems
+       with ancient transcriptions getting CueVoices instead of the
+       desired voices.
+       * lily/context-def.cc (get_default_child): new function.
+       (get_accepted): place default child in front of list.
+
+       * lily/parser.yy (FIXME): add DEFAULTCHILD token.
+
+       * lily/include/context-def.hh (struct Context_def): add
+       default_accept_
+
 2005-05-03  Graham Percival  <gperlist@shaw.ca>
 
        * scm/define-grobs.scm: remove "remove-first" line, since
index e22b0272d7a9930bc377eeba33ca096284ae3fd1..2b3c258dcad18bd3626997f0c1253748bf4391f6 100644 (file)
@@ -103,11 +103,11 @@ c2\startTextSpan b c\stopTextSpan a
 
 @refcommands
 
-@cindex{textSpannerUp}
+@cindex textSpannerUp
 @code{textSpannerUp},
-@cindex{textSpannerDown}
+@cindex textSpannerDown 
 @code{textSpannerDown},
-@cindex{textSpannerNeutral}
+@cindex textSpannerNeutral
 @code{textSpannerNeutral}.
 
 @seealso
index 6eb5060eef5ac0ccebe1476de7122d650ad9bf40..e2ff5f3a9aef9e30a65d7504214887cb2f00041a 100644 (file)
@@ -2267,7 +2267,7 @@ voice in the first @code{<< \\ >>} construct is effective in the second
 @end lilypond
 
 Polyphony does not change the relationship of notes within a
-@code{\relative}} block.  Each note is calculated relative
+@code{\relative @{ @}} block.  Each note is calculated relative
 to the note immediately preceding it.
 
 @example
index 67e5f2a21d1185dd6924d0c5ce33960515f0edf4..cf01d38dcda0900b8b10f7d1b11bc4b26a99fb6f 100644 (file)
@@ -26,6 +26,7 @@ Context_def::Context_def ()
   translator_mods_ = SCM_EOL;
   property_ops_ = SCM_EOL;
   context_name_ = SCM_EOL;
+  default_child_ = SCM_EOL;
   description_ = SCM_EOL;
 
   smobify_self ();
@@ -43,10 +44,12 @@ Context_def::Context_def (Context_def const &s)
   property_ops_ = SCM_EOL;
   context_name_ = SCM_EOL;
   description_ = SCM_EOL;
+  default_child_ = SCM_EOL;
 
   smobify_self ();
   description_ = s.description_;
 
+  default_child_ = s.default_child_;
   accept_mods_ = s.accept_mods_;
   property_ops_ = s.property_ops_;
   translator_mods_ = s.translator_mods_;
@@ -85,6 +88,7 @@ Context_def::mark_smob (SCM smob)
   scm_gc_mark (me->translator_mods_);
   scm_gc_mark (me->property_ops_);
   scm_gc_mark (me->translator_group_type_);
+  scm_gc_mark (me->default_child_);
 
   return me->context_name_;
 }
@@ -99,11 +103,18 @@ Context_def::add_context_mod (SCM mod)
       return;
     }
 
+  /*
+    other modifiers take symbols as argument. 
+  */
   SCM sym = scm_cadr (mod);
   if (scm_is_string (sym))
     sym = scm_string_to_symbol (sym);
 
-  if (ly_symbol2scm ("consists") == tag
+  if (ly_symbol2scm ("default-child") == tag)
+    {
+      default_child_ = scm_cadr (mod);
+    }
+  else if (ly_symbol2scm ("consists") == tag
       || ly_symbol2scm ("consists-end") == tag
       || ly_symbol2scm ("remove") == tag)
     {
@@ -152,9 +163,36 @@ Context_def::get_accepted (SCM user_mod) const
       else if (tag == ly_symbol2scm ("denies"))
        acc = scm_delete_x (sym, acc);
     }
+
+  SCM def = get_default_child (user_mod);
+  if (scm_is_symbol (def))
+    {
+      if (scm_memq (def, acc))
+       acc = scm_delete_x (def, acc);
+      acc = scm_cons (def, acc);
+    }
+  
   return acc;
 }
 
+
+SCM
+Context_def::get_default_child (SCM user_mod) const
+{
+  SCM name = default_child_;
+  for (SCM s = user_mod; scm_is_pair (s); s = scm_cdr (s))
+    {
+      SCM entry = scm_car (s);
+      if (scm_car (entry) == ly_symbol2scm ("default-child"))
+       {
+         name = scm_cadr (entry);
+         break;
+       }
+    }
+
+  return name;
+}
+
 Link_array<Context_def>
 Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef) const
 {
@@ -306,6 +344,12 @@ Context_def::instantiate (SCM ops, Object_key const *key)
        }
     }
 
+
+  /*
+    Ugh,  todo: should just make a private
+    copy of Context_def with the user mods.
+  */
+
   g->simple_trans_list_ = trans_list;
 
   tg->implementation_ = g->self_scm ();
@@ -320,7 +364,7 @@ Context_def::instantiate (SCM ops, Object_key const *key)
   scm_gc_unprotect_object (g->self_scm ());
 
   tg->accepts_list_ = get_accepted (ops);
-
+    
   return tg;
 }
 
index a14b25e8367b3b66fcc34bdec8689c3b2b0919d8..dc387961586d312170936075752348cfd7460426 100644 (file)
@@ -276,7 +276,7 @@ SCM
 Context::default_child_context_name () const
 {
   return scm_is_pair (accepts_list_)
-    ? scm_car (scm_last_pair (accepts_list_))
+    ? scm_car (accepts_list_) 
     : SCM_EOL;
 }
 
index 5d45e6c0883651fb363e389bea87ae6c9bc2ae9a..22a4c63995147b2ed602698197d261533b81ee8a 100644 (file)
@@ -30,12 +30,13 @@ private:
   SCM context_name_;
   SCM context_aliases_;
   SCM translator_group_type_;
-
+  SCM default_child_;
+  
 public:
   void add_context_mod (SCM);
-  SCM default_child_context_name ();
+  SCM get_default_child (SCM user_mods) const;
   SCM get_context_name () const;
-  SCM get_accepted (SCM) const;
+  SCM get_accepted (SCM user_mods) const;
   SCM get_property_ops () const { return property_ops_; }
   SCM get_translator_names (SCM) const;
   void set_acceptor (SCM accepts, bool add);
index e17af62e1e2fa5975b34c7ff90b34bf13374833c..db69518d271d07fe8ea258d2b284e2d881e9fd75 100644 (file)
@@ -35,6 +35,7 @@ protected:
   Object_key const *key_;
   Context *daddy_context_;
   SCM definition_;
+
   SCM properties_scm_;
   SCM context_list_;
   SCM accepts_list_;
index c81f27ef3e9f3eb91f0c26d8be0595d69c500237..a22086b6760e24b3a92b9ad09b6f99293db900a3 100644 (file)
@@ -36,6 +36,7 @@ static Keyword_ent the_key_tab[]
   {"consists", CONSISTS},
   {"context", CONTEXT},
   {"default", DEFAULT},
+  {"defaultchild", DEFAULTCHILD},
   {"denies", DENIES},
   {"description", DESCRIPTION},
   {"drummode", DRUMMODE},
index 73a467c1d7bc777e0370e5670f980510c1bef414..4d9c630b3dda560c39c30f1be1a1e6e2bd487acf 100644 (file)
@@ -74,7 +74,10 @@ Note_heads_engraver::process_music ()
        }
 
       Pitch *pit = unsmob_pitch (ev->get_property ("pitch"));
-
+      if (!pit)
+       {
+         ev->origin ()->warning (_ ("NoteEvent without pitch"));
+       }
       int pos = pit ? pit->steps () : 0;
       SCM c0 = get_property ("middleCPosition");
       if (scm_is_number (c0))
index db3f0ce8f9b20e0dfb07c844d1dada273f7d6846..b771f9bb4b60be1eae88c8c7c63b364ad0b640cb 100644 (file)
@@ -279,6 +279,7 @@ or
 %token CONSISTS "\\consists"
 %token CONTEXT "\\context"
 %token DEFAULT "\\default"
+%token DEFAULTCHILD "\\defaultchild"
 %token DENIES "\\denies"
 %token DESCRIPTION "\\description"
 %token DRUMMODE "\\drummode"
@@ -1423,6 +1424,7 @@ context_def_mod:
        | REMOVE { $$ = ly_symbol2scm ("remove"); }
 
        | ACCEPTS { $$ = ly_symbol2scm ("accepts"); }
+       | DEFAULTCHILD { $$ = ly_symbol2scm ("default-child"); }
        | DENIES { $$ = ly_symbol2scm ("denies"); }
 
        | ALIAS { $$ = ly_symbol2scm ("alias"); }
index 4091ec98fdabd10c53cd5062bf2a59386bb848e8..f0586242110051098dd51d7e36f4809596a0608c 100644 (file)
@@ -4,6 +4,7 @@
   \name Global
 
   \accepts Score
+  \defaultchild Score
   \description "Hard coded entry point for LilyPond. Cannot be tuned."
   \grobdescriptions #all-grob-descriptions    
 }
@@ -50,6 +51,7 @@
   instrument = #'()
   instr = #'()
   
+  \defaultchild "Voice"
   \accepts "Voice"
   \accepts "CueVoice"
   
@@ -63,7 +65,6 @@
   \type "Engraver_group_engraver"
   \name DrumStaff
   \alias Staff
-
   \remove "Accidental_engraver"
   \remove "Ottava_spanner_engraver"
   \remove "Key_engraver" 
@@ -74,6 +75,7 @@
 
   \denies Voice
   \accepts DrumVoice
+  \defaultchild DrumVoice
 
   clefGlyph = #"clefs.percussion"
   clefPosition = #0
   \accepts "PianoStaff"
   \accepts "Lyrics"
   \accepts "ChordNames"
+  \defaultchild "Staff"
 }
 
 \context {
   \InnerChoirStaff
   \name ChoirStaff
   
+  \defaultchild "InnerChoirStaff"
   \accepts "InnerChoirStaff"
   \accepts "InnerStaffGroup"
   \description "Identical to @code{StaffGroup} except that the
@@ -142,6 +146,7 @@ contained staves are not connected vertically."
   \consists "Axis_group_engraver"
   \accepts "Voice"
   \accepts "CueVoice"
+  \defaultchild "Voice"
   \description  "
     A context like @code{Staff} but for printing rhythms.  Pitches are
     ignored; the notes are printed on one line.  
@@ -428,6 +433,7 @@ AncientRemoveEmptyStaffContext = \context {
   \consists "Bar_number_engraver"
   \consists "Span_arpeggio_engraver"
 
+  \defaultchild "Staff"
   \accepts "Staff"
   \accepts "TabStaff"
   \accepts "VaticanaStaff"
@@ -579,12 +585,12 @@ EasyNotation = \context { %% TODO: why \context override?
 \context {
   \type "Engraver_group_engraver"
   \name FiguredBass 
+
   \consists "Figured_bass_engraver"
   \consists "Rest_swallow_translator"
   \consists "Note_swallow_translator"
   \consists "Skip_event_swallow_translator"
   \consists "Separating_line_group_engraver"
-  
   \consists "Hara_kiri_engraver"
 }
 
@@ -639,6 +645,7 @@ EasyNotation = \context {   %% TODO: why \context override?
   \description "Context for generating tablature. [DOCME]"
 
   \accepts "TabVoice"
+  \defaultchild "TabVoice"
   
   %% 6 strings
   \override StaffSymbol #'staff-space = #1.5
@@ -713,6 +720,8 @@ EasyNotation = \context {   %% TODO: why \context override?
   \alias "Staff"
   \denies "Voice"
   \accepts "VaticanaVoice"
+  \defaultchild "VaticanaVoice"
+
   \description "Same as @code{Staff} context, except that it is accommodated for tyepsetting Gregorian Chant in the notational style of Editio Vaticana."
 
   \remove "Time_signature_engraver"
@@ -787,6 +796,7 @@ EasyNotation = \context {   %% TODO: why \context override?
   \alias "Staff"
   \denies "Voice"
   \accepts "GregorianTranscriptionVoice"
+  \defaultchild "GregorianTranscriptionVoice"
 
   %% We can not remove Bar_engraver; otherwise clefs and custodes will
   %% not show up any more among other line breaking issues.
@@ -816,6 +826,7 @@ EasyNotation = \context {   %% TODO: why \context override?
   \name "MensuralStaff"
   \alias "Staff"
   \denies "Voice"
+  \defaultchild "MensuralVoice"
   \accepts "MensuralVoice"
   \description "Same as @code{Staff} context, except that it is accommodated for tyepsetting a piece in mensural style."