--- /dev/null
+\version "2.15.17"
+
+\header{
+ texidoc= "This tests @code{\once} applied to multiple property operations."
+}
+
+\relative c' {
+ c4 d \hideNotes e4 f |
+ \unHideNotes g a \once \hideNotes b c |
+}
--- /dev/null
+\version "2.15.17"
+
+\pointAndClickTypes #'note-event
+
+\relative c' {
+ c2\f( f)
+}
\ No newline at end of file
extern string output_name_global;
extern bool be_safe_global;
extern bool do_internal_type_checking_global;
-extern bool point_and_click_global;
extern string lilypond_datadir;
extern bool use_object_keys;
extern bool strict_infinity_checking;
{"name", NAME},
{"new", NEWCONTEXT},
{"notemode", NOTEMODE},
- {"once", ONCE},
{"override", OVERRIDE},
{"paper", PAPER},
{"remove", REMOVE},
/* Run in safe mode? */
bool be_safe_global = false;
-/* Provide URI links to the original file */
-bool point_and_click_global = true;
-
/* Scheme code to execute before parsing, after .scm init.
This is where -e arguments are appended to. */
string init_scheme_code_global;
%token MIDI "\\midi"
%token NAME "\\name"
%token NOTEMODE "\\notemode"
-%token ONCE "\\once"
%token OVERRIDE "\\override"
%token PAPER "\\paper"
%token REMOVE "\\remove"
music_property_def:
simple_music_property_def {
- $$ = LOWLEVEL_MAKE_SYNTAX (ly_lily_module_constant ("property-operation"), scm_cons (PARSER->self_scm (), scm_cons2 (make_input (@$), SCM_BOOL_F, $1)));
- }
- | ONCE simple_music_property_def {
- $$ = LOWLEVEL_MAKE_SYNTAX (ly_lily_module_constant ("property-operation"), scm_cons (PARSER->self_scm (), scm_cons2 (make_input (@$), SCM_BOOL_T, $2)));
+ $$ = LOWLEVEL_MAKE_SYNTAX (ly_lily_module_constant ("property-operation"), scm_cons2 (PARSER->self_scm (), make_input (@$), $1));
}
;
profile_property_accesses = valbool;
val = val_scm_bool;
}
- else if (varstr == "point-and-click")
- {
- point_and_click_global = valbool;
- val = val_scm_bool;
- }
else if (varstr == "protected-scheme-parsing")
{
parse_protect_global = valbool;
(make-music 'RelativeOctaveCheck
'pitch pitch))
+once =
+#(define-music-function (parser location music) (ly:music?)
+ (_i "Set @code{once} to @code{#t} on all layout instruction events in @var{music}.")
+ (music-map
+ (lambda (m)
+ (cond ((music-is-of-type? m 'layout-instruction-event)
+ (set! (ly:music-property m 'once) #t))
+ ((ly:duration? (ly:music-property m 'duration))
+ (ly:music-warning m (_ "Cannot apply \\once to timed music"))))
+ m)
+ music))
+
ottava =
#(define-music-function (parser location octave) (integer?)
(_i "Set the octavation.")
(ly:set-option 'point-and-click #f)
(make-music 'SequentialMusic 'void #t))
+pointAndClickTypes =
+#(define-void-function (parser location types) (list-or-symbol?)
+ (_i "Set a type or list of types (such as @code{#'note-event}) for which point-and-click info is generated.")
+ (ly:set-option 'point-and-click types))
%% predefined fretboards
(if create-new (set! (ly:music-property csm 'create-new) #t))
csm))
-(define-ly-syntax (property-operation parser location once ctx music-type symbol . args)
+(define-ly-syntax (property-operation parser location ctx music-type symbol . args)
(let* ((props (case music-type
((PropertySet) (list 'value (car args)))
((PropertyUnset) '())
(list 'grob-property-path (car args))
(list 'grob-property-path args)))
(else (ly:error (_ "Invalid property operation ~a") music-type))))
- (oprops (if once (cons* 'once once props) props))
(m (apply make-music music-type
'symbol symbol
'origin location
- oprops)))
+ props)))
(make-music 'ContextSpeccedMusic
'element m
'context-type ctx
(if (ly:get-option 'point-and-click)
(let* ((cause (ly:grob-property grob 'cause))
(music-origin (if (ly:stream-event? cause)
- (ly:event-property cause 'origin))))
- (if (ly:input-location? music-origin)
+ (ly:event-property cause 'origin)))
+ (point-and-click (ly:get-option 'point-and-click)))
+ (if (and
+ (ly:input-location? music-origin)
+ (cond ((boolean? point-and-click) point-and-click)
+ ((symbol? point-and-click)
+ (ly:in-event-class? cause point-and-click))
+ (else (any (lambda (t)
+ (ly:in-event-class? cause t))
+ point-and-click))))
(let* ((location (ly:input-file-line-char-column music-origin))
(raw-file (car location))
(file (if (is-absolute? raw-file)