\version "2.24.0" %----------------------------------------------------------------- % Pippo è un oggetto post evento che, una volta chiamato (\pippo), stampa la stringa "pippo" di un proprio colore % (rosso di default) e rende la testa della nota relativa dello stesso colore. % Di seguito: % - le dichiarazioni delle funzioni di base per definire un grob e un evento (grazie a Jean Abou Samra!); % - definizione di una nuova interfaccia, un nuovo stencil, un nuovo grob (con relativa dichiarazione #all-grob-descriptions); % - definizione della classe di eventi, dell'evento stesso, di una funzione di creazione e di un comando Lilypond; % - definizione dell'engraver, con relativo inserimento nel contesto Voice. % Infine un esempio. % [le intestazioni delle varie sezioni sono in italiano] % Questo script è a puro scopo di studio e chiaramente non serve a nulla! % Può essere uno spunto per costruire degli oggetti personalizzati ed estendere le funzionalità di Lilypond %----------------------------------------------------------------- % Pippo (Foo) is a post-event object which, once called (\pippo), prints the string "pippo" in its own color (red by default) % and makes the relative note head of the same color. % Right away: % - the basic function declarations to define a grob and an event (thanks to Jean Abou Samra!); % - definition of a new interface, a new stencil, a new grob (with relative declaration #all-grob-descriptions); % - definition of the event class, the event itself, a create function and a Lilypond command; % - definition of the engraver, with relative insertion in the Voice context. % Finally an example. % [the headings of the various sections are in Italian] % This script is for study purposes only and is clearly useless! % It can be a starting point for building custom objects and extending the functionality of Lilypond %----------------------------------------------------------------- %--------------FUNZIONI DI BASE----------------------------------- #(define (define-grob! grob-name grob-entry) (set! all-grob-descriptions (cons ((@@ (lily) completize-grob-entry) (cons grob-name grob-entry)) all-grob-descriptions))) #(define (define-event! type properties) (set-object-property! type 'music-description (cdr (assq 'description properties))) (set! properties (assoc-set! properties 'name type)) (set! properties (assq-remove! properties 'description)) (hashq-set! music-name-to-property-table type properties) (set! music-descriptions (sort (cons (cons type properties) music-descriptions) alist8\pippo a r e' g2 \once \override PippoText.parenthesized = ##t \once \override PippoText.show-vertical-skylines = ##t \once \override PippoText.show-horizontal-skylines = ##t a2_\pippo }