+++ /dev/null
-/*
- easy-notation.cc -- implement easy notation heads
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
-*/
-
-#include "note-head.hh"
-
-#include <cctype>
-using namespace std;
-
-#include "font-interface.hh"
-#include "grob.hh"
-#include "music.hh"
-#include "output-def.hh"
-#include "staff-symbol-referencer.hh"
-#include "stem.hh"
-#include "stream-event.hh"
-#include "text-interface.hh"
-#include "rhythmic-head.hh"
-
-/*
-
-TODO: move to scheme
-
-*/
-MAKE_SCHEME_CALLBACK (Note_head, brew_ez_stencil, 1);
-SCM
-Note_head::brew_ez_stencil (SCM smob)
-{
- Grob *me = unsmob_grob (smob);
- int log = Rhythmic_head::duration_log (me);
-
- SCM cause = me->get_property ("cause");
- SCM spitch = unsmob_stream_event (cause)->get_property ("pitch");
- Pitch *pit = unsmob_pitch (spitch);
-
- SCM idx = scm_from_int (pit->get_notename ());
- SCM names = me->get_property ("note-names");
- SCM charstr = SCM_EOL;
- if (scm_is_vector (names))
- charstr = scm_vector_ref (names, idx);
- else
- {
- char s[2] = "a";
- s[0] = char ((pit->get_notename () + 2) % 7 + 'a');
- s[0] = char (toupper (s[0]));
- charstr = scm_from_locale_string (s);
- }
-
- SCM letter
- = Text_interface::interpret_string (me->layout ()->self_scm (),
- Font_interface::text_font_alist_chain (me),
- charstr);
-
- Stencil l (*unsmob_stencil (letter));
- l.align_to (X_AXIS, CENTER);
- l.align_to (Y_AXIS, CENTER);
-
- l = Stencil (Box (), l.expr ());
- Real ss = Staff_symbol_referencer::staff_space (me);
- Real lt = Staff_symbol_referencer::line_thickness (me);
-
- Real radius = (ss + lt) / 2.0;
- Real stem_thick = 1.3 * lt;
- if (Grob *stem = unsmob_grob (me->get_object ("stem")))
- stem_thick = Stem::thickness (stem);
-
- int black = (log >= 2);
-
- Stencil head;
- Box extent (Interval (-radius, radius),
- Interval (-radius, radius));
-
- Stencil black_head (extent,
- scm_list_4 (ly_symbol2scm ("circle"),
- scm_from_double (radius),
- scm_from_double (0.0),
- SCM_BOOL_T));
- Stencil white_head;
- if (black)
- l = l.in_color (1, 1, 1);
- else
- {
- white_head = Stencil (extent,
- scm_list_4 (ly_symbol2scm ("circle"),
- scm_from_double (radius - stem_thick),
- scm_from_double (0.0),
- SCM_BOOL_T));
-
- white_head = white_head.in_color (1, 1, 1);
- }
-
- Stencil total;
- total.add_stencil (l);
- total.add_stencil (white_head);
- total.add_stencil (black_head);
- total.translate_axis (radius, X_AXIS);
-
- return total.smobbed_copy ();
-}
-
*/
#include "grob.hh"
-#include "staff-symbol-referencer.hh"
-#include "staff-symbol.hh"
#include "libc-extension.hh"
+#include "staff-symbol.hh"
+#include "staff-symbol-referencer.hh"
LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position",
- 1, 0, 0, (SCM sg),
- "Return the Y-position of @var{sg} relative to the staff.")
+ 1, 0, 0, (SCM sg),
+ "Return the Y-position of @var{sg} relative to the staff.")
{
LY_ASSERT_SMOB (Grob, sg, 1);
Grob *g = unsmob_grob (sg);
LY_DEFINE (ly_position_on_line_p, "ly:position-on-line?",
2, 0, 0, (SCM sg, SCM spos),
- "Return whether @var{pos} is on a line of the staff associated with the the grob @var{sg} (even on an extender line).")
+ "Return whether @var{spos} is on a line of the staff associated"
+ " with the the grob @var{sg} (even on an extender line).")
{
LY_ASSERT_SMOB (Grob, sg, 1);
LY_ASSERT_TYPE (scm_is_number, spos, 2);
LY_DEFINE (ly_staff_symbol_line_thickness, "ly:staff-symbol-line-thickness",
1, 0, 0, (SCM grob),
- "Returns the line-thickness of the staff associated with @var{grob}.")
+ "Returns the @code{line-thickness} of the staff associated"
+ " with @var{grob}.")
{
LY_ASSERT_SMOB (Grob, grob, 1);
Grob *g = unsmob_grob (grob);
Real thickness = Staff_symbol_referencer::line_thickness (g);
return scm_from_double (thickness);
}
+
+LY_DEFINE (ly_staff_symbol_staff_space, "ly:staff-symbol-staff-space",
+ 1, 0, 0, (SCM grob),
+ "Returns the @code{staff-space} of the staff associated"
+ " with @var{grob}.")
+{
+ LY_ASSERT_SMOB (Grob, grob, 1);
+ Grob *g = unsmob_grob (grob);
+ Real staff_space = Staff_symbol_referencer::staff_space (g);
+ return scm_from_double (staff_space);
+}
}
easyHeadsOn = {
- \override NoteHead #'stencil = #ly:note-head::brew-ez-stencil
- \override NoteHead #'font-size = #-7
+ \override NoteHead #'stencil = #note-head::brew-ez-stencil
+ \override NoteHead #'font-size = #-8
\override NoteHead #'font-family = #'sans
\override NoteHead #'font-series = #'bold
}
added. BeatGrouping has been eliminated.\n\
Different settings for vertical layout.\n\
ly:system-start-text::print -> system-start-text::print\n\
-Beam #'thickness -> Beam #'beam-thickness"))
+Beam #'thickness -> Beam #'beam-thickness\n\
+ly:note-head::brew-ez-stencil -> note-head::brew-ez-stencil"))
def conv(str):
if re.search("override-auto-beam-setting", str):
stderr_write ("\n")
stderr_write(NOT_SMART % _("alignment-offsets has been changed to alignment-distances: \
you must now specify the distances between staves rather than the offset of staves.\n"))
stderr_write(UPDATE_MANUALLY)
- str = re.sub ('ly:system-start-text::print', 'system-start-text::print', str)
+ str = re.sub ('ly:(system-start-text::print|note-head::brew-ez-stencil)',
+ '\\1', str)
str = re.sub ('(\\bBeam\\s+#\')(?=thickness\\b)', '\\1beam-', str)
return str
(string-append (number->string (max 0 log))
(symbol->string style)))))))
+(define-public (note-head::brew-ez-stencil grob)
+ (let* ((log (ly:grob-property grob 'duration-log))
+ (pitch (ly:event-property (event-cause grob) 'pitch))
+ (pitch-index (ly:pitch-notename pitch))
+ (note-names (ly:grob-property grob 'note-names))
+ (pitch-string (if (vector? note-names)
+ (vector-ref note-names pitch-index)
+ (string
+ (integer->char
+ (+ (modulo (+ pitch-index 2) 7)
+ (char->integer #\A))))))
+ (staff-space (ly:staff-symbol-staff-space grob))
+ (line-thickness (ly:staff-symbol-line-thickness grob))
+ (stem (ly:grob-object grob 'stem))
+ (stem-thickness (* (if (ly:grob? stem)
+ (ly:grob-property stem 'thickness)
+ 1.3)
+ line-thickness))
+ (radius (/ (+ staff-space line-thickness) 2))
+ (letter (markup #:center-align #:vcenter pitch-string))
+ (filled-circle (markup #:draw-circle radius 0 #t)))
+
+ (grob-interpret-markup
+ grob
+ (if (>= log 2)
+ (make-combine-markup
+ filled-circle
+ (make-with-color-markup white letter))
+ (make-combine-markup
+ (make-combine-markup
+ filled-circle
+ (make-with-color-markup white (make-draw-circle-markup
+ (- radius stem-thickness) 0 #t)))
+ letter)))))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; bar numbers
(define-public ((every-nth-bar-number-visible n) barnum)
(= 0 (modulo barnum n)))
-(define-public ((modulo-bar-number-visible n m) barnum) (and (> barnum 1) (= m (modulo barnum n))))
+(define-public ((modulo-bar-number-visible n m) barnum)
+ (and (> barnum 1) (= m (modulo barnum n))))
(define-public ((set-bar-number-visibility n) tr)
(let ((bn (ly:context-property tr 'currentBarNumber)))
ly:multi-measure-rest::print
ly:multi-measure-rest::set-spacing-rods
ly:note-head::print
-;; ly:note-head::brew-ez-stencil
ly:ottava-bracket::print
ly:paper-column::print
ly:percent-repeat-item-interface::beat-slash