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 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
@refcommands
-@cindex{textSpannerUp}
+@cindex textSpannerUp
@code{textSpannerUp},
-@cindex{textSpannerDown}
+@cindex textSpannerDown
@code{textSpannerDown},
-@cindex{textSpannerNeutral}
+@cindex textSpannerNeutral
@code{textSpannerNeutral}.
@seealso
@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
translator_mods_ = SCM_EOL;
property_ops_ = SCM_EOL;
context_name_ = SCM_EOL;
+ default_child_ = SCM_EOL;
description_ = SCM_EOL;
smobify_self ();
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_;
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_;
}
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)
{
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
{
}
}
+
+ /*
+ 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 ();
scm_gc_unprotect_object (g->self_scm ());
tg->accepts_list_ = get_accepted (ops);
-
+
return tg;
}
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;
}
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);
Object_key const *key_;
Context *daddy_context_;
SCM definition_;
+
SCM properties_scm_;
SCM context_list_;
SCM accepts_list_;
{"consists", CONSISTS},
{"context", CONTEXT},
{"default", DEFAULT},
+ {"defaultchild", DEFAULTCHILD},
{"denies", DENIES},
{"description", DESCRIPTION},
{"drummode", DRUMMODE},
}
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))
%token CONSISTS "\\consists"
%token CONTEXT "\\context"
%token DEFAULT "\\default"
+%token DEFAULTCHILD "\\defaultchild"
%token DENIES "\\denies"
%token DESCRIPTION "\\description"
%token DRUMMODE "\\drummode"
| REMOVE { $$ = ly_symbol2scm ("remove"); }
| ACCEPTS { $$ = ly_symbol2scm ("accepts"); }
+ | DEFAULTCHILD { $$ = ly_symbol2scm ("default-child"); }
| DENIES { $$ = ly_symbol2scm ("denies"); }
| ALIAS { $$ = ly_symbol2scm ("alias"); }
\name Global
\accepts Score
+ \defaultchild Score
\description "Hard coded entry point for LilyPond. Cannot be tuned."
\grobdescriptions #all-grob-descriptions
}
instrument = #'()
instr = #'()
+ \defaultchild "Voice"
\accepts "Voice"
\accepts "CueVoice"
\type "Engraver_group_engraver"
\name DrumStaff
\alias Staff
-
\remove "Accidental_engraver"
\remove "Ottava_spanner_engraver"
\remove "Key_engraver"
\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
\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.
\consists "Bar_number_engraver"
\consists "Span_arpeggio_engraver"
+ \defaultchild "Staff"
\accepts "Staff"
\accepts "TabStaff"
\accepts "VaticanaStaff"
\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"
}
\description "Context for generating tablature. [DOCME]"
\accepts "TabVoice"
+ \defaultchild "TabVoice"
%% 6 strings
\override StaffSymbol #'staff-space = #1.5
\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"
\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.
\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."