From: Joe Neeman Date: Tue, 3 Nov 2009 00:37:28 +0000 (-0800) Subject: Fix 893. X-Git-Tag: release/2.13.7-0~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c9803f36f9ca585c15024e16b1cbef0bce0b31b3;p=lilypond.git Fix 893. Move Side_position_interface::get_direction to Script_interface, since it is only ever used for scripts (and it doesn't work for rehearsal marks). --- diff --git a/input/regression/rehearsal-mark-direction.ly b/input/regression/rehearsal-mark-direction.ly new file mode 100644 index 0000000000..b4500cb84d --- /dev/null +++ b/input/regression/rehearsal-mark-direction.ly @@ -0,0 +1,16 @@ +\version "2.13.7" + +\header { + texidoc = "Rehearsal marks with direction DOWN get placed at +the bottom of the score." +} + +\new StaffGroup << + \new Staff { g'1 } + \new Staff { + c'1 + \once \override Score . RehearsalMark #'break-visibility = #begin-of-line-invisible + \once \override Score . RehearsalMark #'direction = #DOWN + \mark \markup \italic "Fine." + } + >> diff --git a/lily/include/script-interface.hh b/lily/include/script-interface.hh index 2032b88296..5081bf8a48 100644 --- a/lily/include/script-interface.hh +++ b/lily/include/script-interface.hh @@ -21,6 +21,8 @@ class Script_interface { public: static Stencil get_stencil (Grob *, Direction d); + static Direction get_direction (Grob *); + DECLARE_GROB_INTERFACE(); DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (calc_direction, (SCM)); diff --git a/lily/include/side-position-interface.hh b/lily/include/side-position-interface.hh index 0304035720..1dad3148e0 100644 --- a/lily/include/side-position-interface.hh +++ b/lily/include/side-position-interface.hh @@ -38,7 +38,6 @@ public: DECLARE_GROB_INTERFACE(); static void add_support (Grob *, Grob *); static void add_staff_support (Grob *); - static Direction get_direction (Grob *); }; #endif /* SIDE_POSITION_INTERFACE_HH */ diff --git a/lily/script-interface.cc b/lily/script-interface.cc index 59737b5ac4..a0975e03fb 100644 --- a/lily/script-interface.cc +++ b/lily/script-interface.cc @@ -53,12 +53,28 @@ Script_interface::calc_positioning_done (SCM smob) return SCM_BOOL_T; } +Direction +Script_interface::get_direction (Grob *me) +{ + Direction relative_dir = Direction (1); + SCM reldir = me->get_property ("side-relative-direction"); + if (is_direction (reldir)) + relative_dir = to_dir (reldir); + + SCM other_elt = me->get_object ("direction-source"); + Grob *e = unsmob_grob (other_elt); + if (e) + return (Direction) (relative_dir * get_grob_direction (e)); + + return CENTER; +} + MAKE_SCHEME_CALLBACK (Script_interface, calc_direction, 1); SCM Script_interface::calc_direction (SCM smob) { Grob *me = unsmob_grob (smob); - Direction d = Side_position_interface::get_direction (me); + Direction d = Script_interface::get_direction (me); if (!d) { @@ -126,11 +142,13 @@ ADD_INTERFACE (Script_interface, /* properties */ "add-stem-support " "avoid-slur " + "direction-source " "positioning-done " "script-priority " "script-stencil " - "toward-stem-shift " + "side-relative-direction " "slur " "slur-padding " + "toward-stem-shift " ); diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 0024408b79..aab1045ee9 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -34,22 +34,6 @@ Side_position_interface::add_support (Grob *me, Grob *e) Pointer_group_interface::add_unordered_grob (me, ly_symbol2scm ("side-support-elements"), e); } -Direction -Side_position_interface::get_direction (Grob *me) -{ - Direction relative_dir = Direction (1); - SCM reldir = me->get_property ("side-relative-direction"); - if (is_direction (reldir)) - relative_dir = to_dir (reldir); - - SCM other_elt = me->get_object ("direction-source"); - Grob *e = unsmob_grob (other_elt); - if (e) - return (Direction) (relative_dir * get_grob_direction (e)); - - return CENTER; -} - /* Put the element next to the support, optionally taking in account the extent of the support. @@ -318,7 +302,7 @@ Side_position_interface::move_to_extremal_staff (SCM smob) { Grob *me = unsmob_grob (smob); System *sys = dynamic_cast (me->get_system ()); - Direction dir = Side_position_interface::get_direction (me); + Direction dir = get_grob_direction (me); if (dir != DOWN) dir = UP; @@ -369,12 +353,10 @@ ADD_INTERFACE (Side_position_interface, /* properties */ "direction " - "direction-source " "minimum-space " "padding " "quantize-position " "side-axis " - "side-relative-direction " "side-support-elements " "slur-padding " "staff-padding "