From 4e021773761fbb873602891f788b408c5c085953 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Tue, 1 Nov 2011 20:55:04 +0100 Subject: [PATCH] Issue 1954: Implement event type filtering for pointAndClick events. --- input/regression/point-and-click-types.ly | 7 +++++++ lily/include/main.hh | 1 - lily/main.cc | 3 --- lily/program-option-scheme.cc | 5 ----- ly/property-init.ly | 4 ++++ scm/output-ps.scm | 12 ++++++++++-- 6 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 input/regression/point-and-click-types.ly diff --git a/input/regression/point-and-click-types.ly b/input/regression/point-and-click-types.ly new file mode 100644 index 0000000000..f9a2058124 --- /dev/null +++ b/input/regression/point-and-click-types.ly @@ -0,0 +1,7 @@ +\version "2.15.17" + +\pointAndClickTypes #'note-event + +\relative c' { + c2\f( f) +} \ No newline at end of file diff --git a/lily/include/main.hh b/lily/include/main.hh index 7c21437b80..a9b827ef75 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -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; diff --git a/lily/main.cc b/lily/main.cc index 5b5ea18d08..3bb602ac23 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -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; diff --git a/lily/program-option-scheme.cc b/lily/program-option-scheme.cc index 0a6c3a80dc..2c3d60dc87 100644 --- a/lily/program-option-scheme.cc +++ b/lily/program-option-scheme.cc @@ -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; diff --git a/ly/property-init.ly b/ly/property-init.ly index 2de518fb46..60232edce0 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -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 diff --git a/scm/output-ps.scm b/scm/output-ps.scm index c83b613cbd..3e376bbe67 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -155,8 +155,16 @@ (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) -- 2.39.5