* lily/translator-group.cc (apply_property_operations): new function.
+2004-01-07 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * input/test/slur-shape.ly (x): remove file.
+
+ * lily/translator-group.cc (apply_property_operations): new function.
+
2004-01-06 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/parser.yy (optional_prop_ops): allow \with {
+ PROPERTYSETTINGS } following \context or \new.
+
+ * lily/my-lily-lexer.cc: add \with.
+
+ * lily/parser.yy (property_operation): clean up definition of
+ property operations.
+ (property_op_to_music): new function.
+ (context_spec_music): new function
+
+ * VERSION: 2.1.7 released.
+
* input/regression/collision-merge-dots.ly: new file.
* lily/note-collision.cc (check_meshing_chords): if merging heads,
@chapter New features in 2.1 since 2.0
@itemize
+@item Features of spanner contexts, like Staff, can now be changed easily:
+
+@example
+ \new Staff \with {
+ StaffSymbol \set #'line-count = #4
+ }
+ { c'4 }
+@end example
+
+@noindent
+puts a quarter note C on a staff with 4 lines.
+
+
+
@item Multi measure rests are now truly centered between the
clefs/barlines of the staff, independent of symbols on the other staffs.
}
-%
+#(define (set-page-break grob grob-c context)
+ (let*
+ ((meta (ly:get-grob-property grob 'meta))
+ (name (cdr (assoc 'name meta))))
+
+ (if (equal? 'NonMusicalPaperColumn name)
+ (ly:set-grob-property! grob 'between-system-string "(pagebreak)\n\n"))
+))
\score {
-\notes \relative c' { c1
-
- \context Score \applyoutput #(outputproperty-compatibility (make-type-checker 'paper-column-interface) 'between-system-string "(pagebreak)\n\n")
+ \notes \relative c' {
+ c1
+ \context Score \applyoutput #set-page-break
\break
-
-c1 }
-
+
+ c1
+ }
}
\clef "varbaritone"c'1^"{varbaritone}" \bar "||"
\clef "bass"c'1^"{bass}" \bar "||"
\clef "subbass"c'1^"{subbass}" \bar "||"
- \property Staff.Clef \override #'transparent = ##t
- \clef "treble" c'1^"transparent=\#t" \bar "||"
- \property Staff.Clef \override #'transparent = ##f
- \context Staff \applyoutput #(outputproperty-compatibility (make-type-checker 'clef-interface) 'full-size-change #t)
- \clef "french" c'1^"full-size-change = \#t" \bar "|."
+ \property Staff.Clef \override #'full-size-change = ##t
+ \clef "treble" c'1^"full-size-change = \#t" \bar "|."
}
\paper{
- \translator{
- \StaffContext
-% Clef \override #'full-size-change = ##t
- }
+ raggedright = ##t
}
}
\header {
texidoc = "The staff is a grob, and may be adjusted as well: this one
shows a staff with 6 thick line, and a slightly large staffspace.
-Beams remain correctly quantized.
-
-"
+Beams remain correctly quantized."
}
-\score { \notes {
- \property Score.StaffSymbol \set #'thickness = #2.0
- \property Score.StaffSymbol \set #'line-count = #6
- \property Score.StaffSymbol \set #'staff-space = #1.1
- c'4 g'4 b'8 b'8 b'8 b'8
-}
-
-\paper { raggedright = ##t
+mus = \notes \relative c' { c4 g' d'8 d d d }
- }
- }
+\score {
+ \notes <<
+ \new Staff \mus
+ \new Staff \with {
+ StaffSymbol \set #'thickness = #2.0
+ StaffSymbol \set #'line-count = #6
+ StaffSymbol \set #'staff-space = #1.1
+ } \mus
+ >>
+ \paper {
+ raggedright = ##t
+ }
+}
+++ /dev/null
-#(ly:set-option 'old-relative)
-\version "1.9.8"
-\header {
- texidoc = "Slurs become flatter as they grow longer. "
-
-}
-
-x = {
- \applyoutput #(outputproperty-compatibility (make-type-checker 'note-head-interface)
- 'extra-offset '(-1 . 0))
-}
-
-\score {
- \context Staff \notes\relative c <<
- \new Voice { \x f(f) }
- \new Voice { \x g(s4g) }
- \new Voice { \x a(s4*2a) }
- \new Voice { \x b(s4*3b) }
- \new Voice { \x c(s4*4c) }
- \new Voice { \x d(s4*5d) }
- \new Voice { \x e(s4*6e) }
- \new Voice { \x f(s4*7f) }
- \new Voice { \x g(s4*8g) }
- \new Voice { \x a(s4*9a) }
- \new Voice { \x b(s4*10b) }
- \new Voice { \x c(s4*11c) }
- \new Voice { \x d(s4*12d) }
- \new Voice { \x e(s4*13e) }
- \new Voice { \x f(s4*14f) }
- \new Voice { \x g(s4*15g) }
- \new Voice { \x a(s4*16a) }
- \new Voice { \x b(s4*17b) }
- \new Voice { \x c(s4*18c) }
- \new Voice { \x d(s4*19d) }
- \new Voice { \x e(s4*20e) }
- \new Voice { \x f(s4*21f) }
- \new Voice { \x g(s4*22g) }
- \new Voice { \x a(s4*23a) }
- \new Voice { \x b(s4*24b) }
- \new Voice { \x c(s4*25c) }
- \new Voice { \x d(s4*26d) }
- >>
- \paper {
- raggedright = ##t
- \translator{
- \VoiceContext
- Slur \override #'direction = #1
- Stem \override #'direction = #-1
- }
- }
-}
-
\version "1.9.8"
\header { texidoc="@cindex Staff Lines
-Staff symbol property set workaround. "
+Set staff symbol property. "
}
upper = \notes\relative c'' {
- c1-"x" d-"x" e-"x" f-"x"
+ c1 d e f
}
lower = \notes\relative c {
- c1-"x" b-"x" a-"x" g-"x"
+ c1 b a g
}
\score {
\context PianoStaff <<
- %\time 4/4
\new Staff <<
\upper
>>
- \new Staff <<
+ \new Staff \with { StaffSymbol \set #'line-count = #4 } <<
\clef bass
\lower
- \applyoutput #(outputproperty-compatibility
- (make-type-checker 'staff-symbol-interface)
- 'line-count 4)
>>
>>
\paper { raggedright=##t}
#(ly:set-option 'old-relative)
-\version "1.9.8"
+\version "2.1.6"
\header { texidoc = "@cindex Staff Size
Setting staff sizes is a little clumsy. There are two options: using
@code{StaffContainer} and override/revert, or
-@code{\applyoutput}. Both methods are shown in this example. "
+@code{\applyoutput}. Both methods are shown in this example."
}
\score {
- \notes \relative c' << \new StaffContainer {
- \property StaffContainer.StaffSymbol \set #'staff-space = #(/ 16 20)
-
- \property Staff.fontSize = #-1
- \property Voice.fontSize = #-1
+ \notes \relative c' <<
+ \new StaffContainer {
+ \property StaffContainer.StaffSymbol \set #'staff-space = #(/ (* magstep magstep))
+ \property Staff.fontSize = #-2
- \dynamicUp\stemDown
-
- %\key gis \major
- c8 d e[ f g a] b c \ff
- }
-
-\new Staff \relative c'' { \dynamicDown c,,4 \ff c c c }
-\new Staff {
- \context Staff \applyoutput #(outputproperty-compatibility (make-type-checker 'staff-symbol-interface) 'staff-space 0.8)
- \property Staff.fontSize = #-1
- \clef bass
- c8 c c c c c c c
-}
->>
-\paper { raggedright = ##t}
+ \dynamicUp\stemDown
+
+ %\key gis \major
+ c8 d e[ f g a] b c \ff
+ }
+
+ \new Staff \relative c'' {
+ \dynamicDown c,,4 \ff c c c
+ }
+ \new Staff \with {
+ fontSize = #-1
+ StaffSymbol \set #'staff-space = #(/ magstep)
+ } {
+ \clef bass
+ c8 c c c c c c c
+ }
+ >>
+ \paper { raggedright = ##t}
}
if (last)
{
Translator_group * dest =
- it->report_to ()->find_create_translator (to_type_sym, to_id);
+ it->report_to ()->find_create_translator (to_type_sym, to_id, SCM_EOL);
current->remove_translator (last);
dest->add_used_group_translator (last);
}
if (last)
{
Translator_group * dest =
- report_to ()->find_create_translator (to_type, to_id);
+ report_to ()->find_create_translator (to_type, to_id, SCM_EOL);
current->remove_translator (last);
dest->add_used_group_translator (last);
}
SCM ci = get_music ()->get_mus_property ("context-id");
if (gh_string_p (ci))
c_id = ly_scm2string (ci);
+ SCM ops = get_music ()->get_mus_property ("property-operations");
Translator_group* a
- = report_to ()->find_create_translator (ct, c_id);
+ = report_to ()->find_create_translator (ct, c_id, ops);
if (a)
set_translator (a);
void add_element (SCM name);
void remove_element (SCM name);
void add_last_element (SCM name);
+ void add_property_operation (SCM);
- void add_push_property (SCM,SCM,SCM);
- void add_pop_property (SCM,SCM);
- void add_property_assign (SCM, SCM);
Link_array<Translator_def> path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const;
Translator_group * instantiate (Music_output_def*);
static SCM make_scm () ;
SCM clone_scm ()const;
- void apply_property_operations (Translator_group*);
+ void apply_default_property_operations (Translator_group*);
private:
DECLARE_SMOBS (Translator_def,foo);
VIRTUAL_COPY_CONS (Translator);
Translator_group (Translator_group const &);
Translator_group ();
- void add_fresh_group_translator (Translator *trans);
+ void add_fresh_group_translator (Translator *trans, SCM ops);
void add_used_group_translator (Translator *trans);
/// Score_register = 0, Staff_registers = 1, etc)
void check_removal ();
// Translator *get_simple_translator (String) const;
Translator_group *find_existing_translator (SCM context_name, String id);
- Translator_group *find_create_translator (SCM context_name, String id);
+ Translator_group *find_create_translator (SCM context_name, String id, SCM ops);
Link_array<Translator_group> path_to_acceptable_translator (SCM alias,
Music_output_def*) const;
Translator_group*get_default_interpreter ();
bool melisma_busy (Translator* tr); // where to put this? --hwn
-
+void apply_property_operations (Translator_group*tg, SCM pre_init_ops);
#endif // TRANSLATOR_GROUP_HH
{"transpose", TRANSPOSE},
{"type", TYPE},
{"unset", UNSET},
+ {"with", WITH},
{0,0}
};
#define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x))
+Music *property_op_to_music (SCM op);
+Music *context_spec_music (SCM type, SCM id, Music * m, SCM ops_);
#define YYERROR_VERBOSE 1
%token TRANSPOSE
%token TYPE
%token UNSET
-
+%token WITH
/* escaped */
%token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
%type <i> exclamations questions dots optional_rest
%type <i> bass_mod
%type <scm> grace_head
+%type <scm> prop_ops_body optional_prop_ops
%type <scm> lyric_element
%type <scm> bass_number br_bass_figure bass_figure figure_list figure_spec
%token <i> DIGIT
%type <scm> embedded_scm scalar
%type <music> Music Sequential_music Simultaneous_music
%type <music> relative_music re_rhythmed_music part_combined_music
-%type <music> property_def translator_change simple_property_def
-%type <scm> Music_list
+%type <music> music_property_def translator_change
+%type <scm> Music_list property_operation
%type <outputdef> music_output_def_body
%type <music> shorthand_command_req
%type <music> post_event tagged_post_event
| translator_spec_body DESCRIPTION string {
unsmob_translator_def ($$)->description_ = $3;
}
- | translator_spec_body STRING '=' embedded_scm {
- unsmob_translator_def ($$)->add_property_assign ($2, $4);
- }
- | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
- unsmob_translator_def ($$)
- ->add_push_property (scm_string_to_symbol ($2), $4, $6);
- }
- | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
- unsmob_translator_def ($$)
- ->add_push_property (scm_string_to_symbol ($2), $4, $6);
- }
- | translator_spec_body STRING REVERT embedded_scm {
- unsmob_translator_def ($$)->add_pop_property (
- scm_string_to_symbol ($2), $4);
+ | translator_spec_body property_operation {
+ unsmob_translator_def ($$)->add_property_operation ($2);
}
| translator_spec_body NAME STRING {
unsmob_translator_def ($$)->type_name_ = scm_string_to_symbol ($3);
}
| translator_spec_body GROBDESCRIPTIONS embedded_scm {
Translator_def*td = unsmob_translator_def($$);
- // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
- for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
- td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
+
+ for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p)) {
+ SCM tag = gh_caar (p);
+ if (tag == ly_symbol2scm ("poppush"))
+ tag = ly_symbol2scm ("push");
+ td->add_property_operation (scm_list_n (ly_symbol2scm ("assign"),
+ tag, ly_cdar (p), SCM_UNDEFINED));
+ }
}
| translator_spec_body CONSISTSEND STRING {
unsmob_translator_def ($$)->add_last_element ( $3);
| MUSIC_IDENTIFIER {
$$ = unsmob_music ($1);
}
- | property_def
+ | music_property_def
| translator_change
;
| APPOGGIATURA { $$ = scm_makfrom0str ("Appoggiatura"); }
;
-Composite_music:
- CONTEXT STRING Music {
- Music*csm =MY_MAKE_MUSIC("ContextSpeccedMusic");
-
- csm->set_mus_property ("element", $3->self_scm ());
- scm_gc_unprotect_object ($3->self_scm ());
-
- csm->set_mus_property ("context-type", scm_string_to_symbol ($2));
- csm->set_mus_property ("context-id", scm_makfrom0str (""));
+optional_prop_ops:
+ /* */ {
+ $$ = SCM_EOL;
+ }
+ | WITH '{' prop_ops_body '}' {
+ $$ = $3;
+ }
+ ;
- $$ = csm;
+prop_ops_body:
+ /* */ { $$ = SCM_EOL; }
+ | prop_ops_body property_operation {
+ $$ = gh_cons ($2, $1);
}
- | AUTOCHANGE STRING Music {
+ ;
+
+
+Composite_music:
+ AUTOCHANGE STRING Music {
Music*chm = MY_MAKE_MUSIC("AutoChangeMusic");
chm->set_mus_property ("element", $3->self_scm ());
chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_proc);
scm_gc_unprotect_object ($2->self_scm ());
#endif
}
- | CONTEXT string '=' string Music {
- Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-
- csm->set_mus_property ("element", $5->self_scm ());
- scm_gc_unprotect_object ($5->self_scm ());
+ | CONTEXT string '=' string optional_prop_ops Music {
+ $$ = context_spec_music ($2, $4, $6, $5);
- csm->set_mus_property ("context-type", scm_string_to_symbol ($2));
- csm->set_mus_property ("context-id", $4);
-
- $$ = csm;
}
- | NEWCONTEXT string Music {
+ | CONTEXT STRING optional_prop_ops Music {
+ $$ = context_spec_music ($2, SCM_UNDEFINED, $4, $3);
+ }
+ | NEWCONTEXT string optional_prop_ops Music {
static int new_context_count;
- Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-
- csm->set_mus_property ("element", $3->self_scm ());
- scm_gc_unprotect_object ($3->self_scm ());
-
- csm->set_mus_property ("context-type", scm_string_to_symbol ($2));
-
char s[1024];
snprintf (s, 1024, "uniqueContext%d", new_context_count ++);
SCM new_id = scm_makfrom0str (s);
- csm->set_mus_property ("context-id", new_id);
- $$ = csm;
+ $$ = context_spec_music ($2, new_id, $4, $3);
}
| TIMES {
THIS->push_spot ();
}
;
-property_def:
- simple_property_def
- | ONCE simple_property_def {
- $$ = $2;
- SCM e = $2->get_mus_property ("element");
- unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
- }
- ;
-
-simple_property_def:
- PROPERTY STRING '.' STRING '=' scalar {
- Music *t = set_property_music (scm_string_to_symbol ($4), $6);
- Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-
- csm->set_mus_property ("element", t->self_scm ());
- scm_gc_unprotect_object (t->self_scm ());
- $$ = csm;
- $$->set_spot (THIS->here_input ());
- csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
+property_operation:
+ STRING '=' scalar {
+ $$ = scm_list_n (ly_symbol2scm ("assign"),
+ scm_string_to_symbol ($1), $3, SCM_UNDEFINED);
}
- | PROPERTY STRING '.' STRING UNSET {
-
- Music *t = MY_MAKE_MUSIC("PropertyUnset");
- t->set_mus_property ("symbol", scm_string_to_symbol ($4));
-
- Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
- csm->set_mus_property ("element", t->self_scm ());
- scm_gc_unprotect_object (t->self_scm ());
-
- $$ = csm;
- $$->set_spot (THIS->here_input ());
-
- csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
+ | STRING UNSET {
+ $$ = scm_list_n (ly_symbol2scm ("unset"),
+ scm_string_to_symbol ($1), SCM_UNDEFINED);
}
- | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
- bool autobeam
- = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
- bool itc = internal_type_checking_global_b;
- Music *t = MY_MAKE_MUSIC("OverrideProperty");
- t->set_mus_property ("symbol", scm_string_to_symbol ($4));
- t->set_mus_property ("pop-first", SCM_BOOL_T);
- if (autobeam)
- internal_type_checking_global_b = false;
- t->set_mus_property ("grob-property", $6);
- if (autobeam)
- internal_type_checking_global_b = itc;
- t->set_mus_property ("grob-value", $8);
-
- Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
- csm->set_mus_property ("element", t->self_scm ());
- scm_gc_unprotect_object (t->self_scm ());
- $$ = csm;
- $$->set_spot (THIS->here_input ());
-
- csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
+ | STRING SET embedded_scm '=' embedded_scm {
+ $$ = scm_list_n (ly_symbol2scm ("poppush"),
+ scm_string_to_symbol ($1), $3, $5, SCM_UNDEFINED);
}
- | PROPERTY STRING '.' STRING OVERRIDE
- embedded_scm '=' embedded_scm
- {
- /*
- UGH UGH UGH UGH.
- */
- bool autobeam
- = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
- bool itc = internal_type_checking_global_b;
-
- Music *t = MY_MAKE_MUSIC("OverrideProperty");
- t->set_mus_property ("symbol", scm_string_to_symbol ($4));
- if (autobeam)
- internal_type_checking_global_b = false;
- t->set_mus_property ("grob-property", $6);
- t->set_mus_property ("grob-value", $8);
- if (autobeam)
- internal_type_checking_global_b = itc;
-
- Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
- csm->set_mus_property ("element", t->self_scm ());
- scm_gc_unprotect_object (t->self_scm ());
-
- $$ = csm;
- $$->set_spot (THIS->here_input ());
-
- csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
-
+ | STRING OVERRIDE embedded_scm '=' embedded_scm {
+ $$ = scm_list_n (ly_symbol2scm ("push"),
+ scm_string_to_symbol ($1), $3, $5, SCM_UNDEFINED);
}
- | PROPERTY STRING '.' STRING REVERT embedded_scm {
- Music *t = MY_MAKE_MUSIC("RevertProperty");
-
- /*
- UGH.
- */
- bool autobeam
- = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
- bool itc = internal_type_checking_global_b;
+ | STRING REVERT embedded_scm {
+ $$ = scm_list_n (ly_symbol2scm ("pop"),
+ scm_string_to_symbol ($1), $3, SCM_UNDEFINED);
+ }
+ ;
- t->set_mus_property ("symbol", scm_string_to_symbol ($4));
- if (autobeam)
- internal_type_checking_global_b = false;
- t->set_mus_property ("grob-property", $6);
- if (autobeam)
- internal_type_checking_global_b = itc;
-
+music_property_def:
+ PROPERTY STRING '.' property_operation {
+ Music * t = property_op_to_music ($4);
Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
- csm->set_mus_property ("element", t->self_scm ());
+
+ csm->set_mus_property ("element", t->self_scm ());
scm_gc_unprotect_object (t->self_scm ());
$$ = csm;
csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
}
+ | ONCE music_property_def {
+ $$ = $2;
+ SCM e = $2->get_mus_property ("element");
+ unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
+ }
;
return -1;
}
+
+Music *
+property_op_to_music (SCM op)
+{
+ Music * m = 0;
+ SCM tag = gh_car (op);
+ SCM symbol = gh_cadr (op);
+ SCM args = gh_cddr (op);
+ SCM grob_val = SCM_UNDEFINED;
+ SCM grob_sym = SCM_UNDEFINED;
+ SCM val = SCM_UNDEFINED;
+
+ if (tag == ly_symbol2scm ("assign"))
+ {
+ m = MY_MAKE_MUSIC("PropertySet");
+ val = gh_car (args);
+ }
+ else if (tag == ly_symbol2scm ("unset"))
+ m = MY_MAKE_MUSIC("PropertyUnset");
+ else if (tag == ly_symbol2scm ("poppush")
+ || tag == ly_symbol2scm ("push"))
+ {
+ m = MY_MAKE_MUSIC("OverrideProperty");
+ grob_sym = gh_car (args);
+ grob_val = gh_cadr (args);
+ }
+ else if (tag == ly_symbol2scm ("pop")) {
+ m = MY_MAKE_MUSIC("RevertProperty");
+ grob_sym = gh_car (args);
+ }
+
+ m->set_mus_property ("symbol", symbol);
+ if (val != SCM_UNDEFINED)
+ m->set_mus_property ("value", val);
+ if (grob_val != SCM_UNDEFINED)
+ m->set_mus_property ("grob-value", grob_val);
+
+ if (grob_sym != SCM_UNDEFINED)
+ {
+ bool itc = internal_type_checking_global_b;
+ bool autobeam = gh_equal_p (symbol, ly_symbol2scm ("autoBeamSettings"));
+ if (autobeam)
+ internal_type_checking_global_b = false;
+ m->set_mus_property ("grob-property", grob_sym);
+ if (autobeam)
+ internal_type_checking_global_b = itc;
+ }
+ if (op == ly_symbol2scm ("poppush"))
+ m->set_mus_property ("pop-first", SCM_BOOL_T);
+
+
+ return m;
+}
+
+Music*
+context_spec_music (SCM type, SCM id, Music * m, SCM ops)
+{
+ Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
+
+ csm->set_mus_property ("element", m->self_scm ());
+ scm_gc_unprotect_object (m->self_scm ());
+
+ csm->set_mus_property ("context-type", scm_string_to_symbol (type));
+ csm->set_mus_property ("property-operations", ops);
+ csm->set_mus_property ("context-id", id);
+ return csm;
+}
+
if (last)
{
Translator_group * dest =
- it->report_to ()->find_create_translator (to_type, to_id);
+ it->report_to ()->find_create_translator (to_type, to_id, SCM_EOL);
current->remove_translator (last);
dest->add_used_group_translator (last);
}
SCM w = p->get_mus_property ("what");
- Translator_group *first_translator = first_iter_->report_to ()->find_create_translator (w, "one" + suffix_);
+ Translator_group *first_translator = first_iter_->report_to ()->find_create_translator (w, "one" + suffix_, SCM_EOL);
SCM s = first_translator->get_property ("changeMoment");
if (!gh_pair_p (s))
change_to (second_iter_, w, (combine_b ? "one" : "two")
+ suffix_);
- Translator_group *first_translator = first_iter_->report_to ()->find_create_translator (w, "one" + suffix_);
- Translator_group *second_translator = second_iter_->report_to ()->find_create_translator (w, "two" + suffix_);
+ Translator_group *first_translator = first_iter_->report_to ()->find_create_translator (w, "one" + suffix_, SCM_EOL);
+ Translator_group *second_translator = second_iter_->report_to ()->find_create_translator (w, "two" + suffix_, SCM_EOL);
/* Hmm */
error (_f ("can't find `%s'", "feta20.afm")
+ "\n" +_ ("Fonts have not been installed properly. Aborting"));
- unsmob_translator_def (definition_)->apply_property_operations (this);
+ unsmob_translator_def (definition_)->apply_default_property_operations (this);
assert (dynamic_cast<Paper_def *> (output_def_));
assert (!daddy_trans_);
void
Score_performer::initialize ()
{
- unsmob_translator_def (definition_)->apply_property_operations (this);
+ unsmob_translator_def (definition_)->apply_default_property_operations (this);
assert (dynamic_cast<Midi_def *> (output_def_));
performance_ = new Performance;
performance_->midi_ = dynamic_cast<Midi_def*> (output_def_);
SCM name = unsmob_translator_def (report_to ()->definition_)->type_name_;
Translator_group * t = (j && separate_contexts_b_)
- ? report_to ()->find_create_translator (name, to_string (j))
+ ? report_to ()->find_create_translator (name, to_string (j), SCM_EOL)
: report_to ();
if (!t)
description_ = SCM_EOL;
smobify_self();
-
}
Translator_def::~Translator_def ()
{
this->end_consists_name_list_ = modify_definition (this->end_consists_name_list_, s, true);
}
-void
-Translator_def::add_push_property (SCM props, SCM syms, SCM vals)
-{
- this->property_ops_ = gh_cons (scm_list_n (ly_symbol2scm ("push"), props, syms, vals, SCM_UNDEFINED),
- this->property_ops_);
-}
void
-Translator_def::add_pop_property (SCM props, SCM syms)
+Translator_def::add_property_operation (SCM what)
{
- this->property_ops_ = gh_cons (scm_list_n (ly_symbol2scm ("push"), props, syms, SCM_UNDEFINED),
- this->property_ops_);
+ this->property_ops_ = gh_cons (what, this->property_ops_);
}
-
Link_array<Translator_def>
Translator_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef) const
{
Link_array<Translator_def> best_result;
for (int i=0; i < accepteds.size (); i++)
{
-
/*
don't check aliases, because \context Staff should not create RhythmicStaff.
*/
return tg;
}
-
void
-Translator_def::apply_property_operations (Translator_group*tg)
+Translator_def::apply_default_property_operations (Translator_group*tg)
{
- SCM correct_order = scm_reverse (property_ops_); // pity of the mem.
- for (SCM s = correct_order; gh_pair_p (s); s = ly_cdr (s))
- {
- SCM entry = ly_car (s);
- SCM type = ly_car (entry);
- entry = ly_cdr (entry);
-
- if (type == ly_symbol2scm ("push"))
- {
- SCM val = ly_cddr (entry);
- val = gh_pair_p (val) ? ly_car (val) : SCM_UNDEFINED;
-
- tg->execute_pushpop_property (ly_car (entry), ly_cadr (entry), val);
- }
- else if (type == ly_symbol2scm ("assign"))
- {
- tg->internal_set_property (ly_car (entry), ly_cadr (entry));
- }
- }
+ apply_property_operations (tg, property_ops_);
}
+
SCM
Translator_def::clone_scm () const
{
return t->self_scm();
}
-void
-Translator_def::add_property_assign (SCM nm, SCM val)
-{
- this->property_ops_ = gh_cons (scm_list_n (ly_symbol2scm ("assign"), scm_string_to_symbol (nm), val, SCM_UNDEFINED),
- this->property_ops_);
-}
/*
Default child context as a SCM string, or something else if there is
void
-Translator_group::add_fresh_group_translator (Translator*t)
+Translator_group::add_fresh_group_translator (Translator*t, SCM pre_init_ops)
{
Translator_group*tg = dynamic_cast<Translator_group*> (t);
assert (tg);
trans_group_list_ = add_translator (trans_group_list_,t);
- unsmob_translator_def (tg->definition_)->apply_property_operations (tg);
+ unsmob_translator_def (tg->definition_)->apply_default_property_operations (tg);
+ apply_property_operations (tg, pre_init_ops);
t->initialize ();
-
}
Translator_group*
-Translator_group::find_create_translator (SCM n, String id)
+Translator_group::find_create_translator (SCM n, String id, SCM operations)
{
Translator_group * existing = find_existing_translator (n,id);
if (existing)
{
Translator_group * new_group = path[i]->instantiate (output_def_);
+ SCM ops = SCM_EOL;
if (i == path.size () -1)
- new_group->id_string_ = id;
- current->add_fresh_group_translator (new_group);
+ {
+ new_group->id_string_ = id;
+ ops = operations;
+ }
+
+ current->add_fresh_group_translator (new_group, ops);
current = new_group;
}
Translator_group *ret = 0;
if (daddy_trans_)
- ret = daddy_trans_->find_create_translator (n,id);
+ ret = daddy_trans_->find_create_translator (n, id, operations);
else
{
warning (_f ("can't find or create `%s' called `%s'", ly_symbol2string (n).to_str0 (), id));
t = unsmob_translator_def (this->definition_);
}
Translator_group *tg = t->instantiate (output_def_);
- add_fresh_group_translator (tg);
+ add_fresh_group_translator (tg, SCM_EOL);
if (!tg->is_bottom_translator_b ())
return tg->get_default_interpreter ();
Translator_def * td = unsmob_translator_def (definition_ );
return ly_symbol2string (td->type_name_);
}
+
+void
+apply_property_operations (Translator_group*tg, SCM pre_init_ops)
+{
+ SCM correct_order = scm_reverse (pre_init_ops);
+ for (SCM s = correct_order; gh_pair_p (s); s = ly_cdr (s))
+ {
+ SCM entry = ly_car (s);
+ SCM type = ly_car (entry);
+ entry = ly_cdr (entry);
+
+ if (type == ly_symbol2scm ("push") || type == ly_symbol2scm ("poppush"))
+ {
+ SCM val = ly_cddr (entry);
+ val = gh_pair_p (val) ? ly_car (val) : SCM_UNDEFINED;
+
+ tg->execute_pushpop_property (ly_car (entry), ly_cadr (entry), val);
+ }
+ else if (type == ly_symbol2scm ("assign"))
+ {
+ tg->internal_set_property (ly_car (entry), ly_cadr (entry));
+ }
+ }
+}
(music-property-description 'pop-first boolean? "Do a revert before we try to do a override on some grob property.")
(music-property-description 'procedure procedure?
"The function to run with \\applycontext. It must take a single argument, being the context.")
+(music-property-description 'property-operations list?
+ "Do these operations for instantiating the context.")
(music-property-description 'predicate procedure? "the predicate of a \outputproperty")
(music-property-description 'type symbol? "The type of this music object. Determines iteration in some cases.")
(music-property-description 'types list? "The types of this music object. Determines iteration in some cases.")
(translator-property-description 'stringTunings list? "The tablature strings tuning. Must be a list of the different semitons pitch of each string (starting by the lower one).")
(translator-property-description 'subdivideBeams boolean? "If set, multiple beams will be subdivided at beat
positions - by only drawing one beam over the beat.")
-(translator-property-description 'systemStartDelimiter symbol? "Which grob to make for the start of the system/staff?")
+(translator-property-description 'systemStartDelimiter symbol? "Which grob to make for the start of the system/staff? Set to @code{SystemStartBrace}, @code{SystemStartBracket} or @code{SystemStartBar}.")
(translator-property-description 'tablatureFormat procedure?
"Function formatting a tab notehead; it takes
a string number, a list of string tunings and Pitch object. It returns the text as a string.")
"
+(define-public magstep (exp (* (/ 1 6) (log 2))))
+
(define-public paper20-font-vector
'((#(medium upright number) .