]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.7
authorfred <fred>
Sun, 24 Mar 2002 19:53:32 +0000 (19:53 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:53:32 +0000 (19:53 +0000)
lily/include/score-elem.hh
lily/span-bar.cc

index 39c06152622eed91ea2c3185ccc9358ee8575d51..82a6fbfe3d7a64dff7e54ab8ea70ad5cb22b2c9d 100644 (file)
@@ -15,6 +15,8 @@
 
 #define SCORE_ELEM_CLONE(T) VIRTUAL_COPY_CONS(T, Score_elem)
 
+
+
 /** Both Spanner and Item are Score_elem's. Most Score_elem's depend
   on other Score_elem's, eg, Beam needs to know and set direction of
   Stem. So the Beam has to be calculated *before* Stem. This is
@@ -29,11 +31,6 @@ class Score_elem : private Directed_graph_node {
     Molecule *output;          // should scrap, and use temp var?
 
 
-    /**
-      This is  needed, because #output# may still be
-      NULL.
-      */
-    Offset offset_;
 
     /**
       for administration of what was done already
@@ -56,12 +53,26 @@ class Score_elem : private Directed_graph_node {
     
     Status status_;
 
+    Score_elem* dependency(int) const;
+    Score_elem* dependent(int) const;
+    int dependent_size() const;
+    int dependency_size() const;
 public:
-    PScore *pscore_l_;    
-    Vertical_group  *y_group_l_;
-    Horizontal_group *x_group_l_;
+    /**
+      This is  needed, because #output# may still be
+      NULL.
+      */
+    Offset offset_;
+
+
+
+
+    Paper_score *pscore_l_;    
+    Axis_group_element * axis_group_l_a_[2];
+
     Score_elem(Score_elem const&);
     virtual String TeX_string () const ;
+    String TeX_string_without_offset(Offset)const;
     virtual void print() const;
     
     Paper_def *paper() const;
@@ -70,17 +81,24 @@ public:
     Score_elem();
     DECLARE_MY_RUNTIME_TYPEINFO;    
     
+    Interval extent(Axis)const;
     Interval width() const;
     Interval height() const;
-    virtual void translate_x(Real);
-    virtual void translate_y(Real);
     Status status() const;
     
      /**
       translate the symbol. The symbol does not have to be created yet. 
       */
     void translate(Offset);
-    Offset offset()const;
+    /**
+      translate in one direction
+     */
+    
+    void translate(Real, Axis);
+    Real relative_coordinate(Axis_group_element*, Axis)const;
+    Offset absolute_offset()const;
+    Real absolute_coordinate(Axis)const;
+    Axis_group_element*common_group(Score_elem const* s, Axis a)const;
 
     void add_processing();
     void OK() const;
@@ -91,6 +109,9 @@ public:
     void post_processing();
     void molecule_processing();
 
+    /**
+      Remove all  links (dependencies, dependents, Axis_group_elements.
+     */
     void unlink();
     void unlink_all();
     void substitute_dependency(Score_elem*,Score_elem*);
@@ -109,19 +130,12 @@ public:
     /*
       virtual accessors
      */
-    virtual Vertical_group * vertical_group() { return 0; }
-    virtual Horizontal_group * horizontal_group() { return 0; }
 
     virtual Spanner* spanner()  { return 0; }
-    virtual Horizontal_vertical_group* elem_group() { return 0; }
     virtual Item * item() { return 0; }
     virtual Line_of_score * line_l() const;
     SCORE_ELEM_CLONE(Score_elem);
-    Score_elem* dependency(int) const;
-    Score_elem* dependent(int) const;
-    int dependent_size() const;
-    int dependency_size() const;
-    
     /// no dimension, translation is noop
     bool empty_b_;
     /// do not print anything black
@@ -135,7 +149,7 @@ protected:
     virtual void do_print() const {}
     /// generate the molecule    
     virtual Molecule* brew_molecule_p()const;
-    ///executed directly after the item is added to the PScore
+    ///executed directly after the item is added to the Paper_score
     virtual void do_add_processing();
     /// do calculations before determining horizontal spacing
     virtual void do_pre_processing();
@@ -149,9 +163,8 @@ protected:
     virtual void do_break_processing();
     virtual void handle_broken_dependencies();
     virtual void handle_prebroken_dependencies();
-
-
-
+    virtual Link_array<Score_elem> get_extra_dependencies()const;
+    virtual void do_unlink();
 };
 
 
index 24430729bd623e5c5cf573e62f17cf037a9eee19..1c9a8ba15962356d32c56b5979a206656c058ed3 100644 (file)
@@ -43,15 +43,6 @@ Span_bar::do_substitute_dependency(Score_elem*o, Score_elem*n)
     spanning_l_arr_.substitute( bold , b);
 }
 
-/*
-  A no-op if not yet output: the span_bar slavish follows what it spans
- */
-void
-Span_bar::translate_y(Real y)
-{
-    if (status() == OUTPUT)
-       Score_elem::translate_y(y);
-}
 
 void
 Span_bar::set(Vertical_align_element *a)
@@ -63,7 +54,7 @@ Span_bar::set(Vertical_align_element *a)
 Interval
 Span_bar::do_width() const
 {
-    return paper()->lookup_l()->bar(type_str_, 40 PT).dim.x; // ugh
+    return paper()->lookup_l()->bar(type_str_, 40 PT).dim.x(); // ugh
 }
 void
 Span_bar::do_pre_processing()
@@ -91,18 +82,31 @@ Span_bar::get_bar_sym(Real dy) const
     return paper()->lookup_l()->bar(type_str_, dy);
 }
 
+
 Molecule*
 Span_bar::brew_molecule_p()const
 {
-    Interval y;
-    for (int i=0; i < spanning_l_arr_.size(); i++)
-       y.unite( spanning_l_arr_[i]->height() );
-    Symbol s = get_bar_sym(y.length());
-        Molecule*output = new Molecule(Atom(s));
-    output->translate_y (  y[-1] );
+    Interval y_int;
+    for (int i=0; i < spanning_l_arr_.size(); i++) {
+       Axis_group_element *common = 
+           common_group(spanning_l_arr_[i], Y_AXIS);
+       
+       Real y = spanning_l_arr_[i]->relative_coordinate(common, Y_AXIS)  
+           -relative_coordinate(common,Y_AXIS);
+
+       y_int.unite( y + spanning_l_arr_[i]->height() );
+    }
 
+    Symbol s = get_bar_sym(y_int.length());
+    Molecule*output = new Molecule(Atom(s));
+    output->translate (  y_int[-1], Y_AXIS );
     return output;
 }
 
 
 IMPLEMENT_IS_TYPE_B1(Span_bar,Bar);
+
+Span_bar::Span_bar()
+{
+    type_str_ = "";
+}