]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/align-element.hh
release: 1.1.37
[lilypond.git] / lily / include / align-element.hh
index 0a9f1e6958715f4d18542c6c63b15f0fce317384..edc88cab90f7a606bd4bf597e6d9d9c919437e9f 100644 (file)
 #ifndef VERTICAL_ALIGN_ITEM_HH
 #define VERTICAL_ALIGN_ITEM_HH
 
-#include "score-element.hh"
+#include "axis-group-element.hh"
 #include "interval.hh"
 #include "direction.hh"
 #include "axes.hh"
+#include "hash-table.hh"
 
 /**
-  Order elements top to bottom.
+  Order elements top to bottom/left to right/right to left etc..
 
-  TODO: merge with Horizontal_align_item
+  TODO: implement padding.
+
+  document usage of this.
  */
-class Align_element : virtual public Score_element {
-  Link_array<Score_element> elem_l_arr_;
-  Array<int> priority_i_arr_;
+class Align_element : public virtual Axis_group_element {
+  Hash_table<Score_element*,int> priority_i_hash_;
   void sort_elements ();
 public:
   Interval threshold_interval_ ;
@@ -34,20 +36,25 @@ public:
   Direction stacking_dir_;
 
   /**
-     Which side to align? 
-     -1: left side, 0: centered (around center_l_ if not nil), 1: right side
+     Which side to align?  -1: left side, 0: centered (around
+     center_l_ if not nil, or around center of width), 1: right side
+
+     URG. Unintuitive if stacking_dir_ == -1 
   */
 
   Direction align_dir_;
   
-  Axis axis_;
+  Axis axis () const;
   Score_element * center_l_;
   
   Align_element ();
+  void set_axis (Axis);
   void add_element (Score_element*);
   void add_element_priority (Score_element*, int);
   bool contains_b (Score_element const*) const;
-  
+
+  Score_element *get_elt_by_priority (int) const;
+  int get_priority (Score_element*) const;
 protected:
   virtual void do_print() const;
   virtual void do_substitute_element_pointer (Score_element*,Score_element*);