extern Variable music_function_call_error;
extern Variable partial_markup;
extern Variable partial_music_function;
- extern Variable property_operation;
+ extern Variable property_override;
+ extern Variable property_revert;
+ extern Variable property_set;
+ extern Variable property_unset;
extern Variable repeat;
extern Variable repetition_chord;
extern Variable sequential_music;
Variable music_function_call_error ("music-function-call-error");
Variable partial_markup ("partial-markup");
Variable partial_music_function ("partial-music-function");
- Variable property_operation ("property-operation");
+ Variable property_override ("property-override");
+ Variable property_revert ("property-revert");
+ Variable property_set ("property-set");
+ Variable property_unset ("property-unset");
Variable repeat ("repeat");
Variable repetition_chord ("repetition-chord");
Variable sequential_music ("sequential-music");
OVERRIDE grob_prop_path '=' scalar {
if (SCM_UNBNDP ($2))
$$ = MAKE_SYNTAX (void_music, @$);
- else {
- $$ = MAKE_SYNTAX (property_operation, @$,
+ else
+ $$ = MAKE_SYNTAX (property_override, @$,
scm_car ($2),
- ly_symbol2scm ("OverrideProperty"),
- scm_cadr ($2),
- $4,
- scm_cddr ($2));
- }
+ scm_cdr ($2),
+ $4);
}
| REVERT simple_revert_context revert_arg {
- $$ = MAKE_SYNTAX (property_operation, @$,
- $2,
- ly_symbol2scm ("RevertProperty"),
- scm_car ($3),
- scm_cdr ($3));
+ $$ = MAKE_SYNTAX (property_revert, @$, $2, $3);
}
| SET context_prop_spec '=' scalar {
if (SCM_UNBNDP ($2))
$$ = MAKE_SYNTAX (void_music, @$);
else
- $$ = MAKE_SYNTAX (property_operation, @$,
+ $$ = MAKE_SYNTAX (property_set, @$,
scm_car ($2),
- ly_symbol2scm ("PropertySet"),
scm_cadr ($2),
$4);
}
if (SCM_UNBNDP ($2))
$$ = MAKE_SYNTAX (void_music, @$);
else
- $$ = MAKE_SYNTAX (property_operation, @$,
+ $$ = MAKE_SYNTAX (property_unset, @$,
scm_car ($2),
- ly_symbol2scm ("PropertyUnset"),
scm_cadr ($2));
}
;
(set-object-property! chain 'markup-signature (list markup?))
chain))
-(define-public (property-operation ctx music-type symbol . args)
- (let* ((props (case music-type
- ((PropertySet) (list 'value (car args)))
- ((PropertyUnset) '())
- ((OverrideProperty) (list 'grob-value (car args)
- 'grob-property-path (if (list? (cadr args))
- (cadr args)
- (cdr args))
- 'pop-first #t))
- ((RevertProperty)
- (if (list? (car args))
- (list 'grob-property-path (car args))
- (list 'grob-property-path args)))
- (else (ly:error (_ "Invalid property operation ~a") music-type))))
- (m (ly:set-origin! (apply make-music music-type
- 'symbol symbol
- props))))
- (ly:set-origin! (make-music 'ContextSpeccedMusic
- 'element m
- 'context-type ctx))))
+(define-public (property-set context property value)
+ (ly:set-origin! (context-spec-music
+ (ly:set-origin!
+ (make-music 'PropertySet
+ 'symbol property
+ 'value value))
+ context)))
+
+(define-public (property-unset context property)
+ (ly:set-origin! (context-spec-music
+ (ly:set-origin!
+ (make-music 'PropertyUnset
+ 'symbol property))
+ context)))
+
+(define-public (property-override context path value)
+ (ly:set-origin! (context-spec-music
+ (ly:set-origin!
+ (make-music 'OverrideProperty
+ 'symbol (car path)
+ 'grob-property-path (cdr path)
+ 'grob-value value
+ 'pop-first #t))
+ context)))
+
+(define-public (property-revert context path)
+ (ly:set-origin! (context-spec-music
+ (ly:set-origin!
+ (make-music 'RevertProperty
+ 'symbol (car path)
+ 'grob-property-path (cdr path)))
+ context)))
(define (get-first-context-id! mus)
"Find the name of a ContextSpeccedMusic, possibly naming it"