From 875cf3061b68867a109cdaf52c93be868a3e01be Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 29 Nov 1999 16:21:13 +0100 Subject: [PATCH] patch::: 1.3.8.uu1 pl 8.hwn1 - note-head-side - *********** --- CHANGES | 7 ++ Documentation/faq.texi | 7 +- Documentation/programmer/regression-test.tely | 2 +- Documentation/user/lilypond.tely | 2 +- VERSION | 2 +- input/bugs/cr.ly | 2 + input/bugs/s.ly | 19 ++++ input/test/double-single-acc.ly | 18 ++++ input/test/mm-rests2.ly | 21 ++++ lily/align-note-column-engraver.cc | 2 +- lily/bar-script-engraver.cc | 4 +- lily/dot-column.cc | 2 +- lily/dynamic-engraver.cc | 10 +- lily/include/local-key-item.hh | 2 +- lily/include/note-head-side.hh | 9 +- lily/include/staff-side.hh | 15 +-- lily/local-key-item.cc | 11 ++- lily/note-head-side.cc | 41 ++------ lily/score-element.cc | 46 +++------ lily/script-column-engraver.cc | 4 +- lily/script-column.cc | 4 +- lily/script-engraver.cc | 6 +- lily/script.cc | 2 +- lily/staff-side.cc | 95 +++++++++++++++---- lily/text-engraver.cc | 6 +- 25 files changed, 212 insertions(+), 127 deletions(-) create mode 100644 input/bugs/cr.ly create mode 100644 input/bugs/s.ly create mode 100644 input/test/double-single-acc.ly create mode 100644 input/test/mm-rests2.ly diff --git a/CHANGES b/CHANGES index 04fcd9ab2a..37b136440f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +pl 8.hwn1 + - note-head-side + - + + + +*********** pl7.mb1 - bf: timeSignatureStyle works again diff --git a/Documentation/faq.texi b/Documentation/faq.texi index b8dbb30787..a400368adb 100644 --- a/Documentation/faq.texi +++ b/Documentation/faq.texi @@ -100,8 +100,9 @@ which looks like @file{/usr/} @end example -@file{~/usr/src/bin/} is in the variable PATH, and contains symbolic -links to the compiled executables. +@file{~/usr/bin/} is in the variable PATH, and contains symbolic links +to the compiled executables. Unpacked sources, releases and patches are +in subdirectories under @file{~/usr/src/}. @subsubsection Is there an emacs mode? @@ -225,7 +226,7 @@ staves (lyric and melodic), otherwise they will end up in the same staff/lyricline @example - \score @{ +4 \score @{ < \melodic \type Staff = "treble" \trebleMelody \lyric \type Lyrics = "tlyrics" \trebtext \type Staff = "bass" \melodic \bassMelody diff --git a/Documentation/programmer/regression-test.tely b/Documentation/programmer/regression-test.tely index 2597e5a796..2496262883 100644 --- a/Documentation/programmer/regression-test.tely +++ b/Documentation/programmer/regression-test.tely @@ -52,7 +52,7 @@ the signs for four, two, and one measure rest are combined to produce the graphical representation of rests for up to 10 bars. The number of bars will be written above the sign. -@mudelafile{mm-rest2.ly} +@mudelafile{mm-rests2.ly} A sharp sign after a double sharp sign, as well as a flat sign after a double flat sign is automatically prepended with a diff --git a/Documentation/user/lilypond.tely b/Documentation/user/lilypond.tely index 07cecc95ff..bf2e8244f7 100644 --- a/Documentation/user/lilypond.tely +++ b/Documentation/user/lilypond.tely @@ -80,7 +80,7 @@ than the names being similar :-)" @contents @node Top, , , (dir) -@top + @menu * Tutorial:: a tutorial introduction to lilypond. * Invoking LilyPond:: Operation. diff --git a/VERSION b/VERSION index d5ceba73aa..0430cf942d 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=8 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=uu1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/bugs/cr.ly b/input/bugs/cr.ly new file mode 100644 index 0000000000..6392a695c0 --- /dev/null +++ b/input/bugs/cr.ly @@ -0,0 +1,2 @@ + +\score { \notes { c1 \< \break \! c1 }} diff --git a/input/bugs/s.ly b/input/bugs/s.ly new file mode 100644 index 0000000000..b46c17e74c --- /dev/null +++ b/input/bugs/s.ly @@ -0,0 +1,19 @@ + +\header { + tagline=""; +} +\version "1.3.5" +\include "paper16.ly"; +\score { + \notes { + \relative c'' \sequential { + \clef "violin"; + \time 5/4; + \key c; + ~ f )g-\rc + } + } + \paper{ + linewidth = 5.0\cm; + } +} diff --git a/input/test/double-single-acc.ly b/input/test/double-single-acc.ly new file mode 100644 index 0000000000..923d03e16e --- /dev/null +++ b/input/test/double-single-acc.ly @@ -0,0 +1,18 @@ + + +thenotes = \notes \relative cis' { \time 4/4; +gisis'4 gis gisis ges | +geses ges geses gis | +gisis g geses g | +gis g ges g | +\key a \major; +gisis4 gis gisis ges | +geses ges geses gis | +gisis g geses g | +gis g ges g | +} + +\score { < \context Staff \thenotes + \context NoteNames \thenotes + > +} diff --git a/input/test/mm-rests2.ly b/input/test/mm-rests2.ly new file mode 100644 index 0000000000..dc5adffbed --- /dev/null +++ b/input/test/mm-rests2.ly @@ -0,0 +1,21 @@ +thenotes = \notes \relative cis' { +\property Score. skipBars = ##t +\time 4/4; +R1 | +R1*1 | +R1*2 | +R1*3 | +R1*4 | +R1*5 | +R1*6 | +R1*7 | +R1*8 | +R1*9 | +R1*10 | +R1*11 | +} + +\score { < \context Staff \thenotes + \context NoteNames \thenotes + > +} diff --git a/lily/align-note-column-engraver.cc b/lily/align-note-column-engraver.cc index efb3abd9bf..11bcefe652 100644 --- a/lily/align-note-column-engraver.cc +++ b/lily/align-note-column-engraver.cc @@ -53,7 +53,7 @@ Align_note_column_engraver::do_removal_processing () SCM al = get_property ("graceAlignPosition", 0); if (isdir_b (al)) { - align_item_p_->notehead_align_dir_ = to_dir (al); + align_item_p_->set_direction (to_dir (al)); } typeset_element (align_item_p_); diff --git a/lily/bar-script-engraver.cc b/lily/bar-script-engraver.cc index 243efae34e..1e82d91657 100644 --- a/lily/bar-script-engraver.cc +++ b/lily/bar-script-engraver.cc @@ -55,7 +55,7 @@ Bar_script_engraver::attach_script_to_item (Item *i) if (!text_p_->parent_l(other_axis)) text_p_->set_parent (i,other_axis); - Staff_sidify (text_p_).add_support (i); + Side_position_interface (text_p_).add_support (i); /* How do we make sure that text_p_ has a dependency from @@ -129,7 +129,7 @@ Bar_script_engraver::create_items (Request *rq) text_p_ = new Text_item; text_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh - Staff_sidify staffside(text_p_); + Side_position_interface staffside(text_p_); staffside.set_axis (axis_); SCM prop = get_property (type_ + "Direction", 0); diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 3d3f73f410..5ca15e946d 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -51,7 +51,7 @@ Dot_column::do_pre_processing () Dot_column::Dot_column () { - notehead_align_dir_ = RIGHT; + set_direction (RIGHT); set_axes(X_AXIS,X_AXIS); } diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 101837a9cb..408fde144e 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -113,7 +113,7 @@ Dynamic_engraver::do_process_requests() text_p_->set_elt_property ("style", gh_str02scm ("dynamic")); text_p_->set_elt_property ("script-priority", gh_int2scm (100)); - Staff_sidify (text_p_).set_axis (Y_AXIS); + Side_position_interface (text_p_).set_axis (Y_AXIS); if (absd->get_direction ()) @@ -166,7 +166,7 @@ Dynamic_engraver::do_process_requests() new_cresc_p = new Crescendo; new_cresc_p->grow_dir_ = (span_l->span_type_str_ == "crescendo") ? BIGGER : SMALLER; - Staff_sidify (new_cresc_p).set_axis (Y_AXIS); + Side_position_interface (new_cresc_p).set_axis (Y_AXIS); announce_element (Score_element_info (new_cresc_p, span_l)); } } @@ -246,13 +246,13 @@ Dynamic_engraver::acknowledge_element (Score_element_info i) ) { if (text_p_) - Staff_sidify (text_p_).add_support (i.elem_l_); + Side_position_interface (text_p_).add_support (i.elem_l_); if (to_end_cresc_p_) - Staff_sidify (to_end_cresc_p_).add_support (i.elem_l_); + Side_position_interface (to_end_cresc_p_).add_support (i.elem_l_); if (cresc_p_) - Staff_sidify(cresc_p_).add_support (i.elem_l_); + Side_position_interface(cresc_p_).add_support (i.elem_l_); } } diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index 931c984c6e..96de7a8569 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -43,7 +43,7 @@ struct Local_key_cautionary_tuple class Local_key_item : public Note_head_side, public Staff_symbol_referencer { Array accidental_arr_; - Molecule accidental (int,bool) const; + Molecule accidental (int,bool,bool) const; public: int c0_position_i_; Local_key_item (); diff --git a/lily/include/note-head-side.hh b/lily/include/note-head-side.hh index 201acbacd1..1c0eed80db 100644 --- a/lily/include/note-head-side.hh +++ b/lily/include/note-head-side.hh @@ -11,26 +11,21 @@ #define NOTE_HEAD_SIDE_HH #include "item.hh" +#include "directional-element.hh" /** be next to noteheads. UGH. another reduplication of Staff_side */ -class Note_head_side: public virtual Item +class Note_head_side: public virtual Item, public virtual Directional_element { - Link_array support_l_arr_; public: - // naming to avoid conflict with Align_element - Direction notehead_align_dir_; Note_head_side (); bool supported_b () const; void add_support (Item*); VIRTUAL_COPY_CONS (Score_element); -protected: - virtual void do_substitute_element_pointer (Score_element*,Score_element*); - virtual void do_pre_processing(); }; diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index 382d0d6cf3..690cf1d3bc 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -16,20 +16,21 @@ #include "staff-symbol-referencer.hh" #include "directional-element.hh" -struct Staff_sidify +struct Side_position_interface { Score_element * elt_l_; public: - Staff_sidify (Score_element*); - static Real position_self (Dimension_cache const *); - + Side_position_interface (Score_element*); + static Real side_position (Dimension_cache const *); + static Real self_alignment (Dimension_cache const *); + static Real aligned_side (Dimension_cache const *); + void set_axis (Axis); Axis get_axis () const; - bool is_staff_side_b (); + bool supported_b () const; + bool is_staff_side_b () const; void add_support (Score_element*); - Real aligned_position (Dimension_cache const*); - Direction get_direction () const; void set_direction (Direction); diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 1ff239da0f..ec0d2a4c1b 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -44,9 +44,14 @@ Local_key_item::do_pre_processing() } Molecule -Local_key_item::accidental (int j, bool cautionary) const +Local_key_item::accidental (int j, bool cautionary, bool natural) const { Molecule m (lookup_l ()->afm_find (String ("accidentals-") + to_str (j))); + if (natural) + { + Molecule prefix = lookup_l ()->afm_find (String ("accidentals-0")); + m.add_at_edge(X_AXIS, LEFT, Molecule(prefix), 0); + } if (cautionary) { Molecule open = lookup_l ()->afm_find (String ("accidentals-(")); @@ -87,7 +92,9 @@ Local_key_item::do_brew_molecule_p() const (c0_position_i_ + p.notename_i_) * note_distance; - Molecule m (accidental (p.accidental_i_, accidental_arr_[i].cautionary_b_)); + Molecule m (accidental (p.accidental_i_, + accidental_arr_[i].cautionary_b_, + accidental_arr_[i].natural_b_)); m.translate_axis (dy, Y_AXIS); octave_mol_p->add_at_edge (X_AXIS, RIGHT, m, 0); diff --git a/lily/note-head-side.cc b/lily/note-head-side.cc index ea52f53a6d..d5d154ac0d 100644 --- a/lily/note-head-side.cc +++ b/lily/note-head-side.cc @@ -7,50 +7,27 @@ */ +#include "staff-side.hh" #include "note-head-side.hh" - void Note_head_side::add_support (Item*head_l) { - if (support_l_arr_.find_l(head_l)) - return ; - support_l_arr_.push (head_l); + Side_position_interface s (this); + s.add_support (head_l); add_dependency (head_l); } -void -Note_head_side::do_pre_processing () -{ - Interval x_int; - for (int i=0; i < support_l_arr_.size(); i++) - { - Graphical_element *common = - common_refpoint (support_l_arr_[i], X_AXIS); - Real x = support_l_arr_[i]->relative_coordinate (common, X_AXIS) - - relative_coordinate (common, X_AXIS); - - x_int.unite (x + support_l_arr_[i]->extent (X_AXIS)); - } - - if (x_int.empty_b ()) - x_int = Interval(0,0); - - translate_axis (-extent(X_AXIS)[-notehead_align_dir_] + x_int[notehead_align_dir_], X_AXIS); -} -void -Note_head_side::do_substitute_element_pointer (Score_element*o,Score_element*n) +Note_head_side::Note_head_side() { - if (Item* o_l = dynamic_cast (o)) - support_l_arr_.substitute (o_l,dynamic_cast (n)); + Side_position_interface s(this); + s.set_axis (X_AXIS); + s.set_direction (LEFT); } -Note_head_side:: Note_head_side() -{ - notehead_align_dir_ = LEFT; -} bool Note_head_side::supported_b ()const { - return support_l_arr_.size (); + Side_position_interface s(this); + return s.supported_b (); } diff --git a/lily/score-element.cc b/lily/score-element.cc index f3f0322ba4..b65a66ca9d 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -24,7 +24,7 @@ #include "misc.hh" #include "paper-outputter.hh" #include "dimension-cache.hh" - +#include "staff-side.hh" Interval Score_element::dim_cache_callback (Dimension_cache const*c) @@ -37,30 +37,6 @@ Score_element::dim_cache_callback (Dimension_cache const*c) } - -Real -set_alignment_callback (Dimension_cache const *c) -{ - String s ("self-alignment-"); - Axis ax = c->axis (); - s += (ax == X_AXIS) ? "X" : "Y"; - Score_element *elm = dynamic_cast (c->element_l ()); - SCM align (elm->get_elt_property (s)); - if (isdir_b (align)) - { - Direction d = to_dir (align); - Interval ext(elm->extent (ax)); - if (d) - { - return - ext[d]; - } - return - ext.center (); - } - else - return 0.0; -} - - Score_element::Score_element() { output_p_ =0; @@ -231,14 +207,20 @@ Score_element::add_processing() return; status_i_ ++; - if (get_elt_property ("self-alignment-X") != SCM_UNDEFINED) + /* + UGH. UGH. UGH. + */ + if (get_elt_property ("self-alignment-X") != SCM_UNDEFINED + && !dim_cache_[X_AXIS]->off_callback_l_) { - dim_cache_[X_AXIS]->set_offset_callback (set_alignment_callback); + dim_cache_[X_AXIS]->set_offset_callback (Side_position_interface::self_alignment); } - if (get_elt_property ("self-alignment-Y") != SCM_UNDEFINED) + if (get_elt_property ("self-alignment-Y") != SCM_UNDEFINED + && !dim_cache_[X_AXIS]->off_callback_l_) + { - dim_cache_[Y_AXIS]->set_offset_callback (set_alignment_callback); + dim_cache_[Y_AXIS]->set_offset_callback (Side_position_interface::self_alignment); } do_add_processing(); @@ -384,14 +366,12 @@ Score_element::handle_broken_smobs (SCM s, Line_of_score * line) if (SMOB_IS_TYPE_B (Score_element, s)) { Score_element *sc = SMOB_TO_TYPE (Score_element, s); - Score_element * br =0; if (sc->line_l () != line) { - br = sc->find_broken_piece (line); + sc= sc->find_broken_piece (line); } - if (br) - return br->self_scm_; + return sc ? sc->self_scm_ : SCM_UNDEFINED; } else if (gh_pair_p (s)) { diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index e144890ea4..b39e2b0524 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -60,9 +60,9 @@ Script_column_engraver::acknowledge_element( Score_element_info inf) if (!thing) return; - if (Staff_sidify (thing).is_staff_side_b ()) + if (Side_position_interface (thing).is_staff_side_b ()) { - if (!thing->breakable_b () && Staff_sidify (thing).get_axis () == Y_AXIS) + if (!thing->breakable_b () && Side_position_interface (thing).get_axis () == Y_AXIS) { script_l_arr_.push (thing); } diff --git a/lily/script-column.cc b/lily/script-column.cc index 720b7f0a11..19983c4f93 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -39,7 +39,7 @@ Script_column::do_pre_processing () for (int i=0; i < staff_sided_item_l_arr_.size (); i++) { - Staff_sidify st (staff_sided_item_l_arr_[i]); + Side_position_interface st (staff_sided_item_l_arr_[i]); arrs[st.get_direction ()].push (staff_sided_item_l_arr_[i]); } @@ -52,7 +52,7 @@ Script_column::do_pre_processing () Item * last = 0; for (int i=0; i < arr.size (); i++) { - Staff_sidify s (arr[i]); + Side_position_interface s (arr[i]); if (last) { s.add_support (last); diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index b41f04fe14..b96f3b0465 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -50,7 +50,7 @@ Script_engraver::do_process_requests() continue; } Script *p =new Script; - Staff_sidify stafy (p); + Side_position_interface stafy (p); list = gh_cdr (list); p->set_elt_property ("molecule", @@ -98,7 +98,7 @@ Script_engraver::acknowledge_element (Score_element_info inf) { for (int i=0; i < script_p_arr_.size(); i++) { - Staff_sidify stafy (script_p_arr_[i]); + Side_position_interface stafy (script_p_arr_[i]); stafy.elt_l_->set_elt_property ("direction-source", s->self_scm_); stafy.add_support (s); } @@ -107,7 +107,7 @@ Script_engraver::acknowledge_element (Score_element_info inf) { for (int i=0; i < script_p_arr_.size(); i++) { - Staff_sidify stafy(script_p_arr_[i]); + Side_position_interface stafy(script_p_arr_[i]); if (!stafy.elt_l_->parent_l (X_AXIS)) { diff --git a/lily/script.cc b/lily/script.cc index 97e60577ea..a063601753 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -56,7 +56,7 @@ Script::do_pre_processing () void Script::do_post_processing () { - Direction d = Staff_sidify (this).get_direction (); + Direction d = Side_position_interface (this).get_direction (); Molecule m (get_molecule(d)); /* diff --git a/lily/staff-side.cc b/lily/staff-side.cc index 669f8a5ac6..c511b6fb1a 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -14,29 +14,24 @@ #include "dimensions.hh" #include "dimension-cache.hh" -Staff_sidify::Staff_sidify (Score_element *e) +Side_position_interface::Side_position_interface (Score_element *e) { elt_l_ = e; } void -Staff_sidify::add_support (Score_element*e) +Side_position_interface::add_support (Score_element*e) { SCM sup = elt_l_->get_elt_property ("side-support"); elt_l_->set_elt_property ("side-support", gh_cons (e->self_scm_,sup)); } -Real -Staff_sidify::aligned_position (Dimension_cache const *c) -{ - return position_self (c); -} Direction -Staff_sidify::get_direction () const +Side_position_interface::get_direction () const { SCM d = elt_l_->get_elt_property ("direction"); if (isdir_b (d)) @@ -54,7 +49,7 @@ Staff_sidify::get_direction () const { Score_element * e = SMOB_TO_TYPE(Score_element,other_elt); - return relative_dir * Staff_sidify (e).get_direction (); + return relative_dir * Side_position_interface (e).get_direction (); } return DOWN; @@ -64,7 +59,7 @@ Staff_sidify::get_direction () const Callback that does the aligning. */ Real -Staff_sidify::position_self (Dimension_cache const * c) +Side_position_interface::side_position (Dimension_cache const * c) { Score_element * me = dynamic_cast (c->element_l ()); @@ -74,13 +69,18 @@ Staff_sidify::position_self (Dimension_cache const * c) SCM support = me->get_elt_property ("side-support"); for (SCM s = support; s != SCM_EOL; s = gh_cdr (s)) { - assert (SMOB_IS_TYPE_B (Score_element, gh_car (s))); + if (!SMOB_IS_TYPE_B (Score_element, gh_car (s))) + continue; + Score_element * e = SMOB_TO_TYPE(Score_element, gh_car (s)); common = common->common_refpoint (e, axis); } for (SCM s = support; s != SCM_EOL; s = gh_cdr (s)) { + if (!SMOB_IS_TYPE_B (Score_element, gh_car (s))) + continue; + Score_element * e = SMOB_TO_TYPE(Score_element, gh_car (s)); Real coord = e->relative_coordinate (common, axis); @@ -96,7 +96,7 @@ Staff_sidify::position_self (Dimension_cache const * c) Real off = me->parent_l (axis)->relative_coordinate (common, axis); - Direction dir = Staff_sidify (me).get_direction (); + Direction dir = Side_position_interface (me).get_direction (); SCM pad = me->remove_elt_property ("padding"); if (pad != SCM_UNDEFINED) @@ -111,34 +111,91 @@ Staff_sidify::position_self (Dimension_cache const * c) return total_off; } +Real +Side_position_interface::self_alignment (Dimension_cache const *c) +{ + String s ("self-alignment-"); + Axis ax = c->axis (); + s += (ax == X_AXIS) ? "X" : "Y"; + Score_element *elm = dynamic_cast (c->element_l ()); + SCM align (elm->get_elt_property (s)); + if (isdir_b (align)) + { + Direction d = to_dir (align); + Interval ext(elm->extent (ax)); + if (d) + { + return - ext[d]; + } + return - ext.center (); + } + else + return 0.0; +} + + +Real +Side_position_interface::aligned_side (Dimension_cache const *c) +{ + Score_element * me = dynamic_cast (c->element_l ()); + Side_position_interface s(me); + Direction d = s.get_direction (); + Axis ax = s.get_axis (); + Real o = side_position (c); + + Interval iv = me->extent (ax); + + if (!iv.empty_b ()) + { + o += - iv[-d]; + + SCM pad = me->get_elt_property ("padding"); + if (gh_number_p (pad)) + o += d *gh_scm2double (pad) ; + } + return o; +} + + void -Staff_sidify::set_axis (Axis a) +Side_position_interface::set_axis (Axis a) { - if (elt_l_->get_elt_property ("transparent") == SCM_UNDEFINED) + // prop transparent ? + if (elt_l_->get_elt_property ("side-support") == SCM_UNDEFINED) elt_l_->set_elt_property ("side-support" ,SCM_EOL); Axis other = Axis ((a +1)%2); - elt_l_->dim_cache_[a]->set_offset_callback (position_self); + elt_l_->dim_cache_[a]->set_offset_callback (aligned_side); elt_l_->dim_cache_[other]->set_offset_callback (0); } + Axis -Staff_sidify::get_axis () const +Side_position_interface::get_axis () const { - if (elt_l_->dim_cache_[X_AXIS]->off_callback_l_ == position_self) // UGH. + Offset_cache_callback c = elt_l_->dim_cache_[X_AXIS]->off_callback_l_ ; + if (c == side_position + || c == aligned_side + ) // UGH. return X_AXIS; else return Y_AXIS; } void -Staff_sidify::set_direction (Direction d) +Side_position_interface::set_direction (Direction d) { elt_l_->set_elt_property ("direction", gh_int2scm (d)); } bool -Staff_sidify::is_staff_side_b () +Side_position_interface::is_staff_side_b () const { return elt_l_->get_elt_property ("side-support") != SCM_UNDEFINED; } + +bool +Side_position_interface::supported_b () const +{ + return elt_l_->get_elt_property ("side-support") != SCM_EOL; +} diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index c0fb5ab150..718845c755 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -54,7 +54,7 @@ Text_engraver::acknowledge_element (Score_element_info i) { for (int i=0; i < texts_.size (); i++) { - Staff_sidify st (texts_[i]); + Side_position_interface st (texts_[i]); st.add_support (n); if (st.get_axis( ) == X_AXIS && !texts_[i]->parent_l (Y_AXIS)) @@ -65,7 +65,7 @@ Text_engraver::acknowledge_element (Score_element_info i) { for (int i=0; i < texts_.size (); i++) { - Staff_sidify st(texts_[i]); + Side_position_interface st(texts_[i]); st.add_support (n); } } @@ -79,7 +79,7 @@ Text_engraver::do_process_requests () Text_script_req * r = reqs_[i]; Text_item *text = new Text_item; - Staff_sidify stafy (text); + Side_position_interface stafy (text); SCM axisprop = get_property ("scriptHorizontal",0); if (gh_boolean_p (axisprop) && gh_scm2bool (axisprop)) -- 2.39.2