]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'lilypond/translation'
authorFrancisco Vila <francisco.vila@hispalinux.es>
Mon, 7 Nov 2011 17:10:39 +0000 (18:10 +0100)
committerFrancisco Vila <francisco.vila@hispalinux.es>
Mon, 7 Nov 2011 17:10:39 +0000 (18:10 +0100)
input/regression/complex-once.ly [new file with mode: 0644]
input/regression/point-and-click-types.ly [new file with mode: 0644]
lily/include/main.hh
lily/lily-lexer.cc
lily/main.cc
lily/parser.yy
lily/program-option-scheme.cc
ly/music-functions-init.ly
ly/property-init.ly
scm/ly-syntax-constructors.scm
scm/output-ps.scm

diff --git a/input/regression/complex-once.ly b/input/regression/complex-once.ly
new file mode 100644 (file)
index 0000000..c57dd55
--- /dev/null
@@ -0,0 +1,10 @@
+\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 |
+}
diff --git a/input/regression/point-and-click-types.ly b/input/regression/point-and-click-types.ly
new file mode 100644 (file)
index 0000000..f9a2058
--- /dev/null
@@ -0,0 +1,7 @@
+\version "2.15.17"
+
+\pointAndClickTypes #'note-event
+
+\relative c' {
+  c2\f( f)
+}
\ No newline at end of file
index 7c21437b809581b791ecde72541ed4f34d7b15d4..a9b827ef75d140098a0b036782bb8ee88dac48c8 100644 (file)
@@ -43,7 +43,6 @@ extern string output_backend_global;
 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;
index 1298604f12f704bccbf48299bc5caa3a366164a2..b19639b579d81941a4fec8d2541e0acaf36f002f 100644 (file)
@@ -72,7 +72,6 @@ static Keyword_ent the_key_tab[]
   {"name", NAME},
   {"new", NEWCONTEXT},
   {"notemode", NOTEMODE},
-  {"once", ONCE},
   {"override", OVERRIDE},
   {"paper", PAPER},
   {"remove", REMOVE},
index 5b5ea18d08e2c127db537aa041c0600e9914750e..3bb602ac230dcfd7c3fd005509c05470a3d2749f 100644 (file)
@@ -74,9 +74,6 @@ string output_name_global;
 /* 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;
index 0adb95c2f55667155309e9025d0afd60ad8a635c..1e693c89c04a7988e3fe22dd9c6d2209553dee9c 100644 (file)
@@ -229,7 +229,6 @@ void set_music_properties (Music *p, SCM a);
 %token MIDI "\\midi"
 %token NAME "\\name"
 %token NOTEMODE "\\notemode"
-%token ONCE "\\once"
 %token OVERRIDE "\\override"
 %token PAPER "\\paper"
 %token REMOVE "\\remove"
@@ -1614,10 +1613,7 @@ simple_music_property_def:
 
 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));
        }
        ;
 
index 0a6c3a80dc66ba006772271da0ebb3060e5bad18..2c3d60dc8792ebf0f34d9ca01a55f0c7b17e0c82 100644 (file)
@@ -65,11 +65,6 @@ internal_set_option (SCM var,
       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;
index 185ee7be382af797b8ebe2e432f6e6b18fa4d3d6..5dad573ac071c348d0d948d718f4110faf03f8fd 100644 (file)
@@ -578,6 +578,18 @@ octaveCheck =
    (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.")
index 2de518fb461e706e684b950baabf79e1eec60a7c..60232edce0cd2e7462085b95c2f6e5755297b2dd 100644 (file)
@@ -343,6 +343,10 @@ back to the lilypond source statement.")
    (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
 
index 841ad92e97f203717bfaf9181b9795f0546cc1b2..ee6140ab1fc9e932d5196b62ec89b43d4c80a7cc 100644 (file)
@@ -177,7 +177,7 @@ into a @code{MultiMeasureTextEvent}."
     (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) '())
@@ -191,11 +191,10 @@ into a @code{MultiMeasureTextEvent}."
                       (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
index c83b613cbd1ceca68b2157886cb05fb0b5bfa393..3e376bbe672186e6f3bf35b69d59a3607d3d0f42 100644 (file)
   (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)