]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.8.uu1
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 29 Nov 1999 15:21:13 +0000 (16:21 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 29 Nov 1999 15:21:13 +0000 (16:21 +0100)
pl 8.hwn1
- note-head-side
-

***********

25 files changed:
CHANGES
Documentation/faq.texi
Documentation/programmer/regression-test.tely
Documentation/user/lilypond.tely
VERSION
input/bugs/cr.ly [new file with mode: 0644]
input/bugs/s.ly [new file with mode: 0644]
input/test/double-single-acc.ly [new file with mode: 0644]
input/test/mm-rests2.ly [new file with mode: 0644]
lily/align-note-column-engraver.cc
lily/bar-script-engraver.cc
lily/dot-column.cc
lily/dynamic-engraver.cc
lily/include/local-key-item.hh
lily/include/note-head-side.hh
lily/include/staff-side.hh
lily/local-key-item.cc
lily/note-head-side.cc
lily/score-element.cc
lily/script-column-engraver.cc
lily/script-column.cc
lily/script-engraver.cc
lily/script.cc
lily/staff-side.cc
lily/text-engraver.cc

diff --git a/CHANGES b/CHANGES
index 04fcd9ab2a4e7a104728151cbd5536a6cceab438..37b136440f3b0e5d50a23b00a5aba1b2e9275529 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,10 @@
+pl 8.hwn1
+       - note-head-side 
+       - 
+
+
+
+***********
 pl7.mb1
        - bf: timeSignatureStyle works again
 
index b8dbb3078733437846b97c937f21c8c4292b1709..a400368adbe5ccc3e5e5c3aa1801775152f7e9c9 100644 (file)
@@ -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        
index 2597e5a796b5a8c1f62726b14c66cb23890b5317..249626288342b9cdd997db1572fe3a12b74b5933 100644 (file)
@@ -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
index 07cecc95ffdb028810f92b4c2face7a6d7538eb8..bf2e8244f7c93f566bc19b05db0ab3ff060fe0a2 100644 (file)
@@ -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 d5ceba73aa4c9a4858a7af769d0993052ede9b21..0430cf942d1de9e1e36fb2118bee79fcd9900a12 100644 (file)
--- 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 (file)
index 0000000..6392a69
--- /dev/null
@@ -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 (file)
index 0000000..b46c17e
--- /dev/null
@@ -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;
+     <c4-\cr( g e>~ <dis ais e> <e, gis b> 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 (file)
index 0000000..923d03e
--- /dev/null
@@ -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 (file)
index 0000000..dc5adff
--- /dev/null
@@ -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
+       >
+}
index efb3abd9bf80d6edf52c90940c2b9ba4eb6f500a..11bcefe65238f1f66281ca731bf50795a124ea3a 100644 (file)
@@ -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_);
index 243efae34e02f2db046ab116d8f984bde06f83b0..1e82d91657cd52f4ebbfc160645218eb21acb15c 100644 (file)
@@ -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);
index 3d3f73f41045137a1988edd53d669a849791c8fc..5ca15e946ddbe9421f454531c694b404735c5e71 100644 (file)
@@ -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);
 }
 
index 101837a9cba5861fc6ec1ae28ece7dced471ac9f..408fde144e29bf9eeb674b211d578b8bc14160c4 100644 (file)
@@ -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_);
     }
 }
 
index 931c984c6ea43a3fba9bf58c77ea1591a84b15f5..96de7a8569427b5fb20bdfd198bbd08134dc9d24 100644 (file)
@@ -43,7 +43,7 @@ struct Local_key_cautionary_tuple
 class Local_key_item : public Note_head_side, public Staff_symbol_referencer {
   Array<Local_key_cautionary_tuple> accidental_arr_;
 
-  Molecule accidental (int,bool) const;
+  Molecule accidental (int,bool,bool) const;
 public:
   int c0_position_i_;
   Local_key_item ();
index 201acbacd13c4516c82bf26f3c157a87839e0e77..1c0eed80db4b5473b701984784b8439c8d951e7b 100644 (file)
 #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<Item> 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();    
 };
 
 
index 382d0d6cf36ec8f7bb8c20e9b4694c704d2a2c38..690cf1d3bc0e6dc0276dcf1d0f775196f0a64f24 100644 (file)
 #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);
index 1ff239da0fa6aef7ef9714974aa688e1e9716feb..ec0d2a4c1bbd03566f5869e7a171dfd2953e1ab2 100644 (file)
@@ -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);
index ea52f53a6d0abc60c44e78c1184c930b86bdcf36..d5d154ac0d7a6b995e1c9b149c8de8d179f9ccd4 100644 (file)
@@ -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 <Item *> (o))
-    support_l_arr_.substitute (o_l,dynamic_cast <Item *> (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 ();
 }
index f3f0322ba4c597cd8ab9022be7ccc69d15560d67..b65a66ca9dc7009471951f58e7b739771dc26404 100644 (file)
@@ -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<Score_element*> (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))
     {
index e144890ea4b672cdb304cc48a045d70e5f56ffab..b39e2b0524f45ac47e2daa7d0bcff5e217cb4332 100644 (file)
@@ -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);
        }
index 720b7f0a11ca268ab7cf505854b81a3f9760a156..19983c4f93f3a4936f1a575547408963be3256cb 100644 (file)
@@ -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);
index b41f04fe1494456a486ffa56690c837dda1efd4b..b96f3b046529ffaf72bc2b69baf488f309047c9a 100644 (file)
@@ -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))
            {
index 97e60577ead396bef98858559560468cd8dd65c1..a0636017532ea5dd9ebf9b56f0ba65e7f1506e90 100644 (file)
@@ -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));
 
   /*
index 669f8a5ac69ffefa08a02806afda4619d0eeeb92..c511b6fb1aa4f36ea40d76ad69a86d751f442816 100644 (file)
 #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<Score_element*> (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<Score_element*> (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<Score_element*> (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;
+}
index c0fb5ab1509756de5e3b2617640a95c580ae65e5..718845c75577dedb6cdeec3b720f85f76876174a 100644 (file)
@@ -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))