CVSROOT: /cvsroot/lilypond Module name: lilypond Branch: Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/10/16 12:29:40
Modified files: . : ChangeLog input/regression: span-bar.ly lily : accidental.cc bar-line.cc chord-name.cc clef-engraver.cc clef.cc drum-note-engraver.cc grob-scheme.cc script-column.cc script-engraver.cc script-interface.cc side-position-interface.cc span-bar.cc staff-spacing.cc system-start-delimiter.cc lily/include : bar-line.hh clef.hh script-interface.hh span-bar.hh system-start-delimiter.hh scm : define-grob-properties.scm define-grobs.scm output-lib.scm safe-lily.scm Added files: lily : item-scheme.cc Log message: * lily/script-engraver.cc (make_script_from_event): don't trigger callback. * lily/item-scheme.cc: new file. * lily/bar-line.cc (before_line_breaking): remove function. remove bar-size-procedure, break-glyph-function * lily/clef-engraver.cc (set_glyph): use glyph iso. glyph-name * lily/clef.cc (before_line_breaking): change to calc_glyph_name. * lily/system-start-delimiter.cc (print): suicide from here. Remove after_line_breaking_callback. * lily/script-interface.cc (calc_direction): use callback for direction. * lily/side-position-interface.cc (aligned_side): don't use Side_position_interface::get_direction directly. Use callback. * scm/define-grobs.scm: change print-function to stencil callback everywhere. * scm/define-grob-properties.scm (all-user-grob-properties): doc callbacks property. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.4179&tr2=1.4180&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/input/regression/span-bar.ly.diff?tr1=1.38&tr2=1.39&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/item-scheme.cc?rev=1.1 http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/accidental.cc.diff?tr1=1.63&tr2=1.64&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/bar-line.cc.diff?tr1=1.60&tr2=1.61&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/chord-name.cc.diff?tr1=1.57&tr2=1.58&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/clef-engraver.cc.diff?tr1=1.135&tr2=1.136&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/clef.cc.diff?tr1=1.22&tr2=1.23&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/drum-note-engraver.cc.diff?tr1=1.41&tr2=1.42&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/grob-scheme.cc.diff?tr1=1.53&tr2=1.54&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/script-column.cc.diff?tr1=1.83&tr2=1.84&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/script-engraver.cc.diff?tr1=1.130&tr2=1.131&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/script-interface.cc.diff?tr1=1.21&tr2=1.22&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/side-position-interface.cc.diff?tr1=1.102&tr2=1.103&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/span-bar.cc.diff?tr1=1.110&tr2=1.111&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/staff-spacing.cc.diff?tr1=1.51&tr2=1.52&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/system-start-delimiter.cc.diff?tr1=1.110&tr2=1.111&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/bar-line.hh.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/clef.hh.diff?tr1=1.17&tr2=1.18&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/script-interface.hh.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/span-bar.hh.diff?tr1=1.46&tr2=1.47&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/system-start-delimiter.hh.diff?tr1=1.23&tr2=1.24&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grob-properties.scm.diff?tr1=1.126&tr2=1.127&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grobs.scm.diff?tr1=1.249&tr2=1.250&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/output-lib.scm.diff?tr1=1.86&tr2=1.87&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/safe-lily.scm.diff?tr1=1.41&tr2=1.42&r1=text&r2=text Patches: Index: lilypond/ChangeLog diff -u lilypond/ChangeLog:1.4179 lilypond/ChangeLog:1.4180 --- lilypond/ChangeLog:1.4179 Sun Oct 16 11:36:36 2005 +++ lilypond/ChangeLog Sun Oct 16 12:29:39 2005 @@ -1,5 +1,24 @@ 2005-10-16 Han-Wen Nienhuys <[EMAIL PROTECTED]> + * lily/script-engraver.cc (make_script_from_event): don't trigger callback. + + * lily/item-scheme.cc: new file. + + * lily/bar-line.cc (before_line_breaking): remove function. + remove bar-size-procedure, break-glyph-function + + * lily/clef-engraver.cc (set_glyph): use glyph iso. glyph-name + + * lily/clef.cc (before_line_breaking): change to calc_glyph_name. + + * lily/system-start-delimiter.cc (print): suicide from + here. Remove after_line_breaking_callback. + + * lily/script-interface.cc (calc_direction): use callback for direction. + + * lily/side-position-interface.cc (aligned_side): don't use + Side_position_interface::get_direction directly. Use callback. + * lily/grob.cc (get_stencil): simplify: use callback mechanism to calculate stencil. (get_print_stencil): rename from get_stencil: create stencil with Index: lilypond/input/regression/span-bar.ly diff -u lilypond/input/regression/span-bar.ly:1.38 lilypond/input/regression/span-bar.ly:1.39 --- lilypond/input/regression/span-bar.ly:1.38 Mon Aug 22 17:28:50 2005 +++ lilypond/input/regression/span-bar.ly Sun Oct 16 12:29:39 2005 @@ -18,11 +18,12 @@ \relative c' \new StaffGroup << \new Staff { - \override Score.BarLine #'transparent = ##t - a1 a1 - \revert Score.BarLine #'transparent - \override Score.SpanBar #'transparent = ##t + a1 + \once \override Score.BarLine #'transparent = ##t + a1 + \once \override Score.SpanBar #'transparent = ##t a1 a1 + \bar "|." } \lyricmode << \new Lyrics { bla1 die bla } Index: lilypond/lily/accidental.cc diff -u lilypond/lily/accidental.cc:1.63 lilypond/lily/accidental.cc:1.64 --- lilypond/lily/accidental.cc:1.63 Mon Sep 5 13:52:40 2005 +++ lilypond/lily/accidental.cc Sun Oct 16 12:29:40 2005 @@ -36,6 +36,9 @@ return m; } +/* + Hmm. Need separate callback, or perhaps #'live bool property. + */ MAKE_SCHEME_CALLBACK (Accidental_interface, after_line_breaking, 1); SCM Accidental_interface::after_line_breaking (SCM smob) Index: lilypond/lily/bar-line.cc diff -u lilypond/lily/bar-line.cc:1.60 lilypond/lily/bar-line.cc:1.61 --- lilypond/lily/bar-line.cc:1.60 Sun Oct 16 01:06:18 2005 +++ lilypond/lily/bar-line.cc Sun Oct 16 12:29:40 2005 @@ -21,13 +21,13 @@ { Grob *me = unsmob_grob (smob); - SCM s = me->get_property ("glyph"); - SCM barsiz_proc = me->get_property ("bar-size-procedure"); - if (scm_is_string (s) && ly_is_procedure (barsiz_proc)) + SCM s = me->get_property ("glyph-name"); + SCM barsize = me->get_property ("bar-size"); + + if (scm_is_string (s) && scm_is_number (barsize)) { String str = ly_scm2string (s); - SCM siz = scm_call_1 (barsiz_proc, me->self_scm ()); - Real sz = robust_scm2double (siz, 0); + Real sz = robust_scm2double (barsize, 0); if (sz <= 0) return SCM_EOL; @@ -149,45 +149,14 @@ Interval (-h / 2, h / 2)), blot); } -MAKE_SCHEME_CALLBACK (Bar_line, before_line_breaking, 1); +MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_size, 1); SCM -Bar_line::before_line_breaking (SCM smob) -{ - Grob *me = unsmob_grob (smob); - Item *item = dynamic_cast<Item *> (me); - - SCM g = me->get_property ("glyph"); - SCM orig = g; - Direction bsd = item->break_status_dir (); - if (scm_is_string (g) && bsd) - { - SCM proc = me->get_property ("break-glyph-function"); - g = scm_call_2 (proc, g, scm_from_int (bsd)); - } - - if (!scm_is_string (g)) - { - me->set_property ("print-function", SCM_EOL); - me->set_extent (SCM_EOL, X_AXIS); - // leave y_extent for spanbar? - } - - if (!ly_is_equal (g, orig)) - me->set_property ("glyph", g); - - return SCM_UNSPECIFIED; -} - -MAKE_SCHEME_CALLBACK (Bar_line, get_staff_bar_size, 1); -SCM -Bar_line::get_staff_bar_size (SCM smob) +Bar_line::calc_bar_size (SCM smob) { Grob *me = unsmob_grob (smob); Real ss = Staff_symbol_referencer::staff_space (me); - SCM size = me->get_property ("bar-size"); - if (scm_is_number (size)) - return scm_from_double (scm_to_double (size) * ss); - else if (Staff_symbol_referencer::get_staff_symbol (me)) + + if (Staff_symbol_referencer::get_staff_symbol (me)) { /* If there is no staff-symbol, we get -1 from the next @@ -201,6 +170,7 @@ return scm_from_int (0); } + ADD_INTERFACE (Bar_line, "bar-line-interface", @@ -221,11 +191,10 @@ /* properties */ - "bar-size-procedure " "kern " "thin-kern " "hair-thickness " "thick-thickness " "glyph " "bar-size " - "break-glyph-function"); + ); Index: lilypond/lily/chord-name.cc diff -u lilypond/lily/chord-name.cc:1.57 lilypond/lily/chord-name.cc:1.58 --- lilypond/lily/chord-name.cc:1.57 Wed Jul 20 14:23:41 2005 +++ lilypond/lily/chord-name.cc Sun Oct 16 12:29:40 2005 @@ -34,4 +34,6 @@ ADD_INTERFACE (Chord_name, "chord-name-interface", "A chord name.", + + "begin-of-line-visible"); Index: lilypond/lily/clef-engraver.cc diff -u lilypond/lily/clef-engraver.cc:1.135 lilypond/lily/clef-engraver.cc:1.136 --- lilypond/lily/clef-engraver.cc:1.135 Mon Sep 12 12:46:48 2005 +++ lilypond/lily/clef-engraver.cc Sun Oct 16 12:29:40 2005 @@ -68,7 +68,7 @@ void Clef_engraver::set_glyph () { - SCM glyph_sym = ly_symbol2scm ("glyph-name"); + SCM glyph_sym = ly_symbol2scm ("glyph"); SCM glyph = get_property ("clefGlyph"); SCM basic = ly_symbol2scm ("Clef"); Index: lilypond/lily/clef.cc diff -u lilypond/lily/clef.cc:1.22 lilypond/lily/clef.cc:1.23 --- lilypond/lily/clef.cc:1.22 Mon Sep 12 23:33:24 2005 +++ lilypond/lily/clef.cc Sun Oct 16 12:29:40 2005 @@ -13,19 +13,14 @@ #include "item.hh" #include "font-interface.hh" -/* - FIXME: should use symbol for #'style. -*/ -MAKE_SCHEME_CALLBACK (Clef, before_line_breaking, 1); +MAKE_SCHEME_CALLBACK (Clef, calc_glyph_name, 1); SCM -Clef::before_line_breaking (SCM smob) +Clef::calc_glyph_name (SCM smob) { Item *s = unsmob_item (smob); - SCM glyph = s->get_property ("glyph-name"); + SCM glyph = s->get_property ("glyph"); - if (!scm_is_string (glyph)) - s->suicide (); - else + if (scm_is_string (glyph)) { String str = ly_scm2string (glyph); @@ -34,10 +29,12 @@ && !to_boolean (s->get_property ("full-size-change"))) { str += "_change"; - s->set_property ("glyph-name", scm_makfrom0str (str.to_str0 ())); } + + return scm_makfrom0str (str.to_str0 ()); } + s->suicide (); return SCM_UNSPECIFIED; } @@ -60,5 +57,11 @@ ADD_INTERFACE (Clef, "clef-interface", "A clef sign", - "non-default full-size-change glyph-name"); + + /* properties */ + "full-size-change " + "glyph " + "glyph-name " + "non-default " + ); Index: lilypond/lily/drum-note-engraver.cc diff -u lilypond/lily/drum-note-engraver.cc:1.41 lilypond/lily/drum-note-engraver.cc:1.42 --- lilypond/lily/drum-note-engraver.cc:1.41 Sun Oct 16 01:06:19 2005 +++ lilypond/lily/drum-note-engraver.cc Sun Oct 16 12:29:40 2005 @@ -134,6 +134,7 @@ Side_position_interface::add_support (e, inf.grob ()); } } + void Drum_notes_engraver::acknowledge_note_column (Grob_info inf) { Index: lilypond/lily/grob-scheme.cc diff -u lilypond/lily/grob-scheme.cc:1.53 lilypond/lily/grob-scheme.cc:1.54 --- lilypond/lily/grob-scheme.cc:1.53 Mon Sep 26 23:25:58 2005 +++ lilypond/lily/grob-scheme.cc Sun Oct 16 12:29:40 2005 @@ -220,25 +220,6 @@ return ly_bool2scm (b); } -LY_DEFINE (ly_item_p, "ly:item?", - 1, 0, 0, (SCM g), - "Is @var{g} an @code{Item} object?") -{ - Grob *me = unsmob_grob (g); - bool b = dynamic_cast<Item *> (me); - return ly_bool2scm (b); -} - -LY_DEFINE (ly_item_break_dir, "ly:item-break-dir", - 1, 0, 0, (SCM it), - "The break status dir of item @var{it}. @code{-1} is end of " - "line, @code{0} unbroken, and @code{1} begin of line.") -{ - Item *me = dynamic_cast<Item *> (unsmob_grob (it)); - SCM_ASSERT_TYPE (me, it, SCM_ARG1, __FUNCTION__, "Item"); - return scm_from_int (me->break_status_dir ()); -} - LY_DEFINE (ly_grob_key, "ly:grob-key", 1, 0, 0, (SCM grob), Index: lilypond/lily/include/bar-line.hh diff -u lilypond/lily/include/bar-line.hh:1.9 lilypond/lily/include/bar-line.hh:1.10 --- lilypond/lily/include/bar-line.hh:1.9 Thu Mar 31 13:09:52 2005 +++ lilypond/lily/include/bar-line.hh Sun Oct 16 12:29:40 2005 @@ -20,9 +20,8 @@ static Stencil compound_barline (Grob *, String, Real height, bool rounded); static Stencil simple_barline (Grob *, Real wid, Real height, bool rounded); - DECLARE_SCHEME_CALLBACK (get_staff_bar_size, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM)); DECLARE_SCHEME_CALLBACK (print, (SCM)); - DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM)); }; #endif // BAR_HH Index: lilypond/lily/include/clef.hh diff -u lilypond/lily/include/clef.hh:1.17 lilypond/lily/include/clef.hh:1.18 --- lilypond/lily/include/clef.hh:1.17 Mon Sep 12 23:33:24 2005 +++ lilypond/lily/include/clef.hh Sun Oct 16 12:29:40 2005 @@ -14,7 +14,7 @@ struct Clef { - DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_glyph_name, (SCM)); DECLARE_SCHEME_CALLBACK (print, (SCM)); static bool has_interface (Grob *); }; Index: lilypond/lily/include/script-interface.hh diff -u lilypond/lily/include/script-interface.hh:1.4 lilypond/lily/include/script-interface.hh:1.5 --- lilypond/lily/include/script-interface.hh:1.4 Thu Mar 10 14:36:12 2005 +++ lilypond/lily/include/script-interface.hh Sun Oct 16 12:29:40 2005 @@ -23,7 +23,7 @@ static Stencil get_stencil (Grob *, Direction d); static bool has_interface (Grob *); DECLARE_SCHEME_CALLBACK (print, (SCM)); - DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_direction, (SCM)); }; void make_script_from_event (Grob *p, bool *follow, Context *tg, Index: lilypond/lily/include/span-bar.hh diff -u lilypond/lily/include/span-bar.hh:1.46 lilypond/lily/include/span-bar.hh:1.47 --- lilypond/lily/include/span-bar.hh:1.46 Thu Mar 10 14:36:12 2005 +++ lilypond/lily/include/span-bar.hh Sun Oct 16 12:29:40 2005 @@ -25,10 +25,10 @@ static Interval get_spanned_interval (Grob *); static void add_bar (Grob *, Grob *); static void evaluate_glyph (Grob *); - static void evaluate_empty (Grob *); DECLARE_SCHEME_CALLBACK (width_callback, (SCM smob, SCM axis)); - DECLARE_SCHEME_CALLBACK (get_bar_size, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM)); DECLARE_SCHEME_CALLBACK (print, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_glyph_name, (SCM)); DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM)); DECLARE_SCHEME_CALLBACK (center_on_spanned_callback, (SCM element, SCM axis)); }; Index: lilypond/lily/include/system-start-delimiter.hh diff -u lilypond/lily/include/system-start-delimiter.hh:1.23 lilypond/lily/include/system-start-delimiter.hh:1.24 --- lilypond/lily/include/system-start-delimiter.hh:1.23 Sat May 28 00:47:04 2005 +++ lilypond/lily/include/system-start-delimiter.hh Sun Oct 16 12:29:40 2005 @@ -21,7 +21,6 @@ DECLARE_SCHEME_CALLBACK (print, (SCM)); static bool has_interface (Grob *); - DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); static void try_collapse (Grob *); static Stencil staff_bracket (Grob *, Real); static Stencil old_staff_bracket (Grob *, Real); Index: lilypond/lily/script-column.cc diff -u lilypond/lily/script-column.cc:1.83 lilypond/lily/script-column.cc:1.84 --- lilypond/lily/script-column.cc:1.83 Sun Oct 16 01:06:19 2005 +++ lilypond/lily/script-column.cc Sun Oct 16 12:29:40 2005 @@ -8,6 +8,7 @@ #include "script-column.hh" +#include "directional-element-interface.hh" #include "side-position-interface.hh" #include "warn.hh" #include "pointer-group-interface.hh" @@ -59,13 +60,7 @@ for (int i = 0; i < staff_sided.size (); i++) { Grob *g = staff_sided[i]; - Direction d = Side_position_interface::get_direction (g); - if (!d) - { - programming_error ("no direction for script"); - d = DOWN; - g->set_property ("direction", scm_from_int (d)); - } + Direction d = get_grob_direction (g); scripts_drul[d] = scm_cons (g->self_scm (), scripts_drul[d]); } Index: lilypond/lily/script-engraver.cc diff -u lilypond/lily/script-engraver.cc:1.130 lilypond/lily/script-engraver.cc:1.131 --- lilypond/lily/script-engraver.cc:1.130 Sun Oct 16 01:06:19 2005 +++ lilypond/lily/script-engraver.cc Sun Oct 16 12:29:40 2005 @@ -135,7 +135,7 @@ val = scm_from_int (prio); } - if (p->internal_get_property (sym) == SCM_EOL) + if (p->get_property_data (sym) == SCM_EOL) p->internal_set_property (sym, val); } @@ -153,17 +153,17 @@ { for (int i = 0; i < scripts_.size (); i++) { - Music *m = scripts_[i].event_; + Music *music = scripts_[i].event_; - Grob *p = make_item ("Script", m->self_scm ()); + Grob *p = make_item ("Script", music->self_scm ()); make_script_from_event (p, &scripts_[i].follow_into_staff_, context (), - m->get_property ("articulation-type"), + music->get_property ("articulation-type"), i); scripts_[i].script_ = p; - SCM force_dir = m->get_property ("direction"); + SCM force_dir = music->get_property("direction"); if (is_direction (force_dir) && to_dir (force_dir)) p->set_property ("direction", force_dir); } Index: lilypond/lily/script-interface.cc diff -u lilypond/lily/script-interface.cc:1.21 lilypond/lily/script-interface.cc:1.22 --- lilypond/lily/script-interface.cc:1.21 Sun Oct 16 01:25:47 2005 +++ lilypond/lily/script-interface.cc Sun Oct 16 12:29:40 2005 @@ -41,15 +41,11 @@ return Stencil (); } -/* -todo: use proper callbacks. -*/ -MAKE_SCHEME_CALLBACK (Script_interface, before_line_breaking, 1); +MAKE_SCHEME_CALLBACK (Script_interface, calc_direction, 1); SCM -Script_interface::before_line_breaking (SCM smob) +Script_interface::calc_direction (SCM smob) { Grob *me = unsmob_grob (smob); - Direction d = Side_position_interface::get_direction (me); if (!d) @@ -58,15 +54,14 @@ d = DOWN; } - set_grob_direction (me, d); - if (Grob *par = me->get_parent (X_AXIS)) { Grob *stem = Note_column::get_stem (par); if (stem && Stem::first_head (stem)) me->set_parent (Stem::first_head (stem), X_AXIS); } - return SCM_UNSPECIFIED; + + return scm_from_int (d); } MAKE_SCHEME_CALLBACK (Script_interface, print, 1); @@ -76,12 +71,8 @@ { Grob *me = unsmob_grob (smob); - Direction dir = Side_position_interface::get_direction (me); - if (!dir) - { - programming_error ("script direction unknown, but stencil wanted"); - dir = DOWN; - } + Direction dir = get_grob_direction (me); + return get_stencil (me, dir).smobbed_copy (); } Index: lilypond/lily/side-position-interface.cc diff -u lilypond/lily/side-position-interface.cc:1.102 lilypond/lily/side-position-interface.cc:1.103 --- lilypond/lily/side-position-interface.cc:1.102 Mon Sep 12 12:46:49 2005 +++ lilypond/lily/side-position-interface.cc Sun Oct 16 12:29:40 2005 @@ -31,10 +31,6 @@ Direction Side_position_interface::get_direction (Grob *me) { - SCM d = me->get_property ("direction"); - if (is_direction (d) && to_dir (d)) - return to_dir (d); - Direction relative_dir = Direction (1); SCM reldir = me->get_property ("side-relative-direction"); // should use a lambda. if (is_direction (reldir)) @@ -96,7 +92,7 @@ if (dim.is_empty ()) dim = Interval (0, 0); - Direction dir = Side_position_interface::get_direction (me); + Direction dir = get_grob_direction (me); Real off = me->get_parent (a)->relative_coordinate (common, a); Real minimum_space = ss * robust_scm2double (me->get_property ("minimum-space"), -1); @@ -156,7 +152,7 @@ { Grob *me = unsmob_grob (element_smob); - Direction d = Side_position_interface::get_direction (me); + Direction d = get_grob_direction (me); Grob *stsym = Staff_symbol_referencer::get_staff_symbol (me); if (stsym) @@ -193,8 +189,7 @@ Grob *me = unsmob_grob (element_smob); Axis a = (Axis) scm_to_int (axis); - Direction d = Side_position_interface::get_direction (me); - + Direction d = get_grob_direction (me); Real o = scm_to_double (aligned_on_support_extents (element_smob, axis)); Interval iv = me->extent (me, a); @@ -255,6 +250,8 @@ "victim object relative to the support (left or right, up or down?)\n\n " "The routine also takes the size the staff into account if " "@code{staff-padding} is set. If undefined, the staff symbol is ignored.", + + /* properties */ "direction " "direction-source " "minimum-space " Index: lilypond/lily/span-bar.cc diff -u lilypond/lily/span-bar.cc:1.110 lilypond/lily/span-bar.cc:1.111 --- lilypond/lily/span-bar.cc:1.110 Sun Oct 16 01:06:19 2005 +++ lilypond/lily/span-bar.cc Sun Oct 16 12:29:40 2005 @@ -46,8 +46,7 @@ extract_grob_set (me, "elements", elements); Grob *refp = common_refpoint_of_array (elements, me, Y_AXIS); - Span_bar::evaluate_glyph (me); - SCM glyph = me->get_property ("glyph"); + SCM glyph = me->get_property ("glyph-name"); /* glyph may not be a string, when ME is killed by Hara Kiri in between. */ @@ -116,7 +115,7 @@ (void) scm_axis; assert ((Axis) scm_to_int (scm_axis) == X_AXIS); - String gl = ly_scm2string (se->get_property ("glyph")); + String gl = ly_scm2string (se->get_property ("glyph-name")); /* urg. @@ -130,13 +129,11 @@ SCM Span_bar::before_line_breaking (SCM smob) { - Grob *g = unsmob_grob (smob); - evaluate_empty (g); - evaluate_glyph (g); - - /* No need to call Bar_line::before_line_breaking (), because the info - in ELEMENTS already has been procced by - Bar_line::before_line_breaking (). */ + Grob *me = unsmob_grob (smob); + extract_grob_set (me, "elements", elements); + if (elements.is_empty ()) + me->suicide (); + return SCM_UNSPECIFIED; } @@ -162,27 +159,15 @@ return scm_from_double (i.center ()); } -void -Span_bar::evaluate_empty (Grob *me) -{ - /* TODO: filter all hara-kiried out of ELEMENS list, and then - optionally do suicide. Call this cleanage function from - center_on_spanned_callback () as well. */ - extract_grob_set (me, "elements", elements); - if (elements.is_empty ()) - me->suicide (); -} -void -Span_bar::evaluate_glyph (Grob *me) +MAKE_SCHEME_CALLBACK(Span_bar, calc_glyph_name, 1); +SCM +Span_bar::calc_glyph_name (SCM smob) { - SCM gl = me->get_property ("glyph"); - - if (scm_is_string (gl)) - return; - + Grob *me = unsmob_grob (smob); extract_grob_set (me, "elements", elements); + SCM gl = SCM_EOL; for (int i = elements.size (); i-- && !scm_is_string (gl);) gl = elements[i]->get_property ("glyph"); @@ -190,7 +175,7 @@ if (!scm_is_string (gl)) { me->suicide (); - return; + return SCM_UNSPECIFIED; } String type = ly_scm2string (gl); @@ -201,10 +186,7 @@ else if (type == ":|:") type = ".|."; - gl = scm_makfrom0str (type.to_str0 ()); - if (scm_equal_p (me->get_property ("glyph"), gl) - != SCM_BOOL_T) - me->set_property ("glyph", gl); + return scm_makfrom0str (type.to_str0 ()); } Interval @@ -214,9 +196,9 @@ (me->self_scm (), scm_from_int (Y_AXIS))); } -MAKE_SCHEME_CALLBACK (Span_bar, get_bar_size, 1); +MAKE_SCHEME_CALLBACK (Span_bar, calc_bar_size, 1); SCM -Span_bar::get_bar_size (SCM smob) +Span_bar::calc_bar_size (SCM smob) { Grob *me = unsmob_grob (smob); Interval iv (get_spanned_interval (me)); @@ -232,5 +214,8 @@ ADD_INTERFACE (Span_bar, "span-bar-interface", "A bar line that spanned between other barlines. This interface is " " used for bar lines that connect different staves.", + + /* properties */ + "glyph-name " "elements"); Index: lilypond/lily/staff-spacing.cc diff -u lilypond/lily/staff-spacing.cc:1.51 lilypond/lily/staff-spacing.cc:1.52 --- lilypond/lily/staff-spacing.cc:1.51 Mon Sep 12 12:46:49 2005 +++ lilypond/lily/staff-spacing.cc Sun Oct 16 12:29:40 2005 @@ -98,15 +98,15 @@ bar_size.set_empty (); if (Bar_line::has_interface (bar_grob)) { - SCM glyph = bar_grob->get_property ("glyph"); + SCM glyph = bar_grob->get_property ("glyph-name"); + Grob *staff_sym = Staff_symbol_referencer::get_staff_symbol (bar_grob); String glyph_string = scm_is_string (glyph) ? ly_scm2string (glyph) : ""; if (glyph_string.left_string (1) == "|" || glyph_string.left_string (1) == ".") { - SCM sz = Bar_line::get_staff_bar_size (bar_grob->self_scm ()); - bar_size = Interval (-1, 1); - bar_size *= robust_scm2double (sz, 1) - / Staff_symbol_referencer::staff_space (bar_grob); + Grob *common = bar_grob->common_refpoint (staff_sym, Y_AXIS); + Interval bar_size = bar_grob->extent (common, Y_AXIS); + bar_size *= 1.0 / Staff_symbol_referencer::staff_space (bar_grob); } } return bar_size; Index: lilypond/lily/system-start-delimiter.cc diff -u lilypond/lily/system-start-delimiter.cc:1.110 lilypond/lily/system-start-delimiter.cc:1.111 --- lilypond/lily/system-start-delimiter.cc:1.110 Mon Sep 12 23:33:24 2005 +++ lilypond/lily/system-start-delimiter.cc Sun Oct 16 12:29:40 2005 @@ -53,44 +53,6 @@ lt); } -MAKE_SCHEME_CALLBACK (System_start_delimiter, after_line_breaking, 1); - -SCM -System_start_delimiter::after_line_breaking (SCM smob) -{ - Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob)); - - SCM gl = me->get_property ("glyph"); - if (ly_is_equal (gl, scm_makfrom0str ("bar-line"))) - { - int count = 0; - Paper_column *left_column = me->get_bound (LEFT)->get_column (); - - /* - Get all coordinates, to trigger Hara kiri. - */ - extract_grob_set (me, "elements", elts); - Grob *common = common_refpoint_of_array (elts, me, Y_AXIS); - - for (int i = elts.size (); i--;) - { - Spanner *staff = dynamic_cast<Spanner *> (elts[i]); - if (!staff - || staff->get_bound (LEFT)->get_column () != left_column) - continue; - - Interval v = staff->extent (common, Y_AXIS); - - if (!v.is_empty ()) - count++; - } - - if (count <= 1) - me->suicide (); - } - return SCM_UNSPECIFIED; -} - MAKE_SCHEME_CALLBACK (System_start_delimiter, print, 1); SCM System_start_delimiter::print (SCM smob) @@ -111,18 +73,30 @@ Interval ext; + int non_empty_count = 0; for (int i = elts.size (); i--;) { Spanner *sp = dynamic_cast<Spanner *> (elts[i]); + if (sp && sp->get_bound (LEFT) == me->get_bound (LEFT)) { Interval dims = sp->extent (common, Y_AXIS); if (!dims.is_empty ()) - ext.unite (dims); + { + non_empty_count ++; + ext.unite (dims); + } } } + if (gsym == ly_symbol2scm ("bar-line") + && non_empty_count <= 1) + { + me->suicide (); + return SCM_EOL; + } + ext -= me->relative_coordinate (common, Y_AXIS); Real len = ext.length () / staff_space; Index: lilypond/scm/define-grob-properties.scm diff -u lilypond/scm/define-grob-properties.scm:1.126 lilypond/scm/define-grob-properties.scm:1.127 --- lilypond/scm/define-grob-properties.scm:1.126 Sun Oct 16 01:25:47 2005 +++ lilypond/scm/define-grob-properties.scm Sun Oct 16 12:29:40 2005 @@ -61,7 +61,6 @@ (bar-size ,ly:dimension? "size of a bar line.") - (bar-size-procedure ,procedure? "Procedure that computes the size of a bar line.") (barre-type ,symbol? "Type of barre indication used in a fret diagram. Choices include @code{curved} and @code{straight}.") (base-shortest-duration ,ly:moment? @@ -109,9 +108,6 @@ clef time-signature)) @end example") - (break-glyph-function ,procedure? "This function determines the -appearance of a bar line at the line break. It takes a glyph and -break-direction and returns the glyph at a line break.") (break-overshoot ,number-pair? "How much does a broken spanner stick out of its bounds?") (bracket-visibility ,boolean-or-symbol? "This controls the @@ -260,7 +256,6 @@ (glyph ,string? "a string determining what (style) of glyph is typeset. Valid choices depend on the function that is reading this property.") - (glyph-name ,string? "a name of character within font.") (glyph-name-procedure ,procedure? "Return the name of a character within font, to use for printing a symbol.") @@ -536,6 +531,7 @@ set, which grob to get the direction from .") (dot ,ly:grob? "reference to Dots object.") (figures ,ly:grob-array? "Figured bass objects for continuation line.") + (glyph-name ,string? "a name of character within font.") (pedal-text ,ly:grob? "Pointer to the text of a mixed-style piano pedal.") (stem ,ly:grob? "pointer to Stem object.") (tremolo-flag ,ly:grob? "The tremolo object on a stem.") Index: lilypond/scm/define-grobs.scm diff -u lilypond/scm/define-grobs.scm:1.249 lilypond/scm/define-grobs.scm:1.250 --- lilypond/scm/define-grobs.scm:1.249 Sun Oct 16 11:36:37 2005 +++ lilypond/scm/define-grobs.scm Sun Oct 16 12:29:40 2005 @@ -139,13 +139,13 @@ . ( (break-align-symbol . staff-bar) (glyph . "|") - (break-glyph-function . ,default-break-barline) (layer . 0) - (bar-size-procedure . ,Bar_line::get_staff_bar_size) (break-visibility . ,all-visible) (breakable . #t) (callbacks . ((stencil . ,Bar_line::print) - (before-line-breaking . ,Bar_line::before_line_breaking))) + (glyph-name . ,bar-line::calc-glyph-name) + (bar-size . ,Bar_line::calc_bar_size) + )) (space-alist . ( (time-signature . (extra-space . 0.75)) (custos . (minimum-space . 2.0)) @@ -379,7 +379,7 @@ (Clef . ( (callbacks . ((stencil . ,Clef::print) - (before-line-breaking . ,Clef::before_line_breaking) + (glyph-name . ,Clef::calc_glyph_name) )) (breakable . #t) (font-family . music) @@ -547,7 +547,7 @@ ;; todo. (callbacks . ((stencil . ,Text_interface::print) - (before-line-breaking . ,Script_interface::before_line_breaking))) + (direction . ,Script_interface::calc_direction))) (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self)) (self-alignment-X . 0) (Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self)) @@ -597,7 +597,7 @@ (self-alignment-Y . 0) (script-priority . 100) (callbacks . ((stencil . ,Text_interface::print) - (before-line-breaking . ,Script_interface::before_line_breaking))) + (direction . ,Script_interface::calc_direction))) (font-encoding . fetaNumber) (font-size . -5) ; don't overlap when next to heads. (meta . ((class . Item) @@ -1202,7 +1202,7 @@ ;; (script-priority . 0) priorities for scripts, see script.scm (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent)) (callbacks . ((stencil . ,Script_interface::print) - (before-line-breaking . ,Script_interface::before_line_breaking))) + (direction . ,Script_interface::calc_direction))) (font-encoding . fetaMusic) (meta . ((class . Item) (interfaces . (script-interface @@ -1261,12 +1261,13 @@ (SpanBar . ( (break-align-symbol . staff-bar) - (bar-size-procedure . ,Span_bar::get_bar_size) (X-extent-callback . ,Span_bar::width_callback) (Y-extent-callback . ()) (layer . 0) (breakable . #t) (callbacks . ((stencil . ,Span_bar::print) + (bar-size . ,Span_bar::calc_bar_size) + (glyph-name . ,Span_bar::calc_glyph_name) (before-line-breaking . ,Span_bar::before_line_breaking))) ;; ugh duplication! @@ -1487,8 +1488,7 @@ (glyph . "bar-line") (thickness . 1.6) (callbacks . ((stencil . ,System_start_delimiter::print) - (after-line-breaking . ,System_start_delimiter::after_line_breaking))) - + )) (meta . ((class . Spanner) (interfaces . (system-start-delimiter-interface)))))) @@ -1517,7 +1517,7 @@ (padding . 0.5) (staff-padding . 0.5) (callbacks . ((stencil . ,Text_interface::print) - (before-line-breaking . ,Script_interface::before_line_breaking))) + (direction . ,Script_interface::calc_direction))) (avoid-slur . around) (slur-padding . 0.5) (script-priority . 200) Index: lilypond/scm/output-lib.scm diff -u lilypond/scm/output-lib.scm:1.86 lilypond/scm/output-lib.scm:1.87 --- lilypond/scm/output-lib.scm:1.86 Sat Oct 1 23:31:34 2005 +++ lilypond/scm/output-lib.scm Sun Oct 16 12:29:40 2005 @@ -194,8 +194,11 @@ ;; How should a bar line behave at a break? ;; ;; Why prepend `default-' to every scm identifier? -(define-public (default-break-barline glyph dir) - (let ((result (assoc glyph +(define-public (bar-line::calc-glyph-name grob) + (let* ( + (glyph (ly:grob-property grob 'glyph)) + (dir (ly:item-break-dir grob)) + (result (assoc glyph '((":|:" . (":|" . "|:")) ("||:" . ("||" . "|:")) ("|" . ("|" . ())) @@ -213,11 +216,18 @@ (":" . (":" . "")) ("empty" . (() . ())) ("brace" . (() . "brace")) - ("bracket" . (() . "bracket")) )))) + ("bracket" . (() . "bracket")) ))) + (glyph-name (if (= dir CENTER) + glyph + (if (and result (string? (index-cell (cdr result) dir))) + (index-cell (cdr result) dir) + #f))) + ) + + (if glyph-name + (set! (ly:grob-property grob 'glyph-name) glyph-name) + (ly:grob-suicide! grob)))) - (if (equal? result #f) - (ly:warning (_ "unknown bar glyph: `~S'" glyph)) - (index-cell (cdr result) dir)))) (define-public (shift-right-at-line-begin g) "Shift an item to the right, but only at the start of the line." Index: lilypond/scm/safe-lily.scm diff -u lilypond/scm/safe-lily.scm:1.41 lilypond/scm/safe-lily.scm:1.42 --- lilypond/scm/safe-lily.scm:1.41 Sun Oct 16 01:06:19 2005 +++ lilypond/scm/safe-lily.scm Sun Oct 16 12:29:40 2005 @@ -150,7 +150,6 @@ Arpeggio::brew_chord_bracket Arpeggio::width_callback Axis_group_interface::group_extent_callback - Bar_line::get_staff_bar_size Bar_line::print Breathing_sign::offset_callback Clef::print @@ -195,7 +194,6 @@ Slur::height Slur::print Spacing_spanner::set_springs - Span_bar::get_bar_size Span_bar::print Span_bar::width_callback Spanner::set_spacing_rods _______________________________________________ Lilypond-cvs mailing list Lilypond-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-cvs