From: hanwen Date: Tue, 20 Jan 2004 13:14:28 +0000 (+0000) Subject: * scm/output-lib.scm (shift-right-at-line-begin): new function: X-Git-Tag: release/2.1.13~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=36ebbe6bcac910bbf44adbbac73775507e44b85e;p=lilypond.git * scm/output-lib.scm (shift-right-at-line-begin): new function: kludge rehearsalmark placement. * lily/grob-scheme.cc (LY_DEFINE): add ly:item-break-dir , ly:item? , ly:spanner? --- diff --git a/ChangeLog b/ChangeLog index f1af5ba501..7b6ea7d5ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2004-01-20 Han-Wen Nienhuys + * scm/output-lib.scm (shift-right-at-line-begin): new function: + kludge rehearsalmark placement. + + * lily/grob-scheme.cc (LY_DEFINE): add ly:item-break-dir , ly:item? + , ly:spanner? + + * lily/note-head.cc (internal_brew_molecule): only shorten ledger + close to note head for accidentals. + * lily/tuplet-bracket.cc (get_default_dir): new algorithm for tuplet direction. diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index 6bb84b639b..a797a29155 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -93,7 +93,10 @@ Break_align_engraver::acknowledge_grob (Grob_info inf) { if (Item * item = dynamic_cast (inf.grob_)) { - if (item->empty_b (X_AXIS) || item->get_parent (X_AXIS)) + /* + Removed check for item->empty (X_AXIS). --hwn 20/1/04 + */ + if (item->get_parent (X_AXIS)) return; SCM bp=item->get_grob_property ("breakable"); diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index 70004e9959..53d2c608f4 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -190,3 +190,39 @@ LY_DEFINE (ly_grob_translate_axis_x, return SCM_UNDEFINED; } + + +LY_DEFINE (ly_spanner_p, + "ly:spanner?", 1, 0, 0, + (SCM g), + "Is @var{g} a spanner object?") +{ + Grob *me = unsmob_grob (g); + bool b = dynamic_cast (me); + + return gh_bool2scm (b); +} + +LY_DEFINE (ly_item_p, + "ly:item?", 1, 0, 0, + (SCM g), + "Is @var{g} a item object?") +{ + Grob *me = unsmob_grob (g); + bool b = dynamic_cast (me); + + return gh_bool2scm (b); +} + + +LY_DEFINE (ly_item_break_dir, + "ly:item-break-dir", 1, 0, 0, + (SCM it), + "The break status dir of @var{it}.") +{ + Item * me = dynamic_cast ( unsmob_grob (it)); + SCM_ASSERT_TYPE (me, it, SCM_ARG1, __FUNCTION__, "Item"); + + return gh_int2scm (me->break_status_dir ()); +} + diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 705d96a0e3..c13d3e60af 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -77,13 +77,13 @@ Mark_engraver::stop_translation_timestep () void -Mark_engraver::create_items (Music *rq) +Mark_engraver::create_items (Music *ev) { if (text_) return; text_ = new Item (get_property ("RehearsalMark")); - announce_grob(text_, rq->self_scm()); + announce_grob(text_, ev->self_scm()); } diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 8b13c41ebd..2ee75e7078 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -496,6 +496,7 @@ AncientRemoveEmptyStaffContext = \translator { ambitus breathing-sign clef + rehearsal-mark staff-bar key-signature time-signature diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 2e8121993d..e1f168011f 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -510,7 +510,8 @@ . ( (molecule-callback . ,Text_item::brew_molecule) (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self)) - (Y-offset-callbacks . (,Side_position_interface::aligned_side)) + (Y-offset-callbacks . (,Side_position_interface::aligned_side)) + (after-line-breaking-callback . ,shift-right-at-line-begin) (self-alignment-X . 0) (direction . 1) (breakable . #t) @@ -519,7 +520,7 @@ (baseline-skip . 2) (break-visibility . ,end-of-line-invisible) (padding . 0.8) - (meta . ((interfaces . (break-aligned-interface text-interface side-position-interface font-interface mark-interface self-alignment-interface item-interface )))) + (meta . ((interfaces . (text-interface side-position-interface font-interface mark-interface self-alignment-interface item-interface )))) )) (MetronomeMark . ( diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 3ca97b267a..a305b10eb8 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -249,3 +249,9 @@ centered, X==1 is at the right, X == -1 is at the left." ) ) + +(define-public (shift-right-at-line-begin g) + "Shift an item to the right, but only at the start of the line." + (if (and (ly:item? g) (equal? (ly:item-break-dir g) RIGHT)) + (ly:grob-translate-axis! g 3.5 X) + ))