]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.74pre
authorfred <fred>
Sun, 24 Mar 2002 19:47:31 +0000 (19:47 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:47:31 +0000 (19:47 +0000)
lily/beam.cc
lily/crescendo.cc
lily/include/crescendo.hh
lily/include/script.hh
lily/include/staff-side.hh
lily/include/text-item.hh
lily/script.cc
lily/staff-side.cc
lily/text-item.cc

index d4f741d78893dd82a1451ed98d0e6b8b811de791..872cfae025dc661b0ff2d79650fd987bdad0cebf 100644 (file)
@@ -378,7 +378,7 @@ Beam::do_print()const
 {
 #ifndef NPRINT
     mtor << "slope " <<slope << "left ypos " << left_pos;
-    Spanner::print();
+    Spanner::do_print();
 #endif
 }
 /*
index 995e45b476ee52245e826f38ab0f6a5261dd40a0..1b25d8439f1b8c831fab6a295017527343806a02 100644 (file)
@@ -21,18 +21,20 @@ Crescendo::Crescendo()
     inside_staff_b_ = false;
 }
 
-Molecule*
-Crescendo::brew_molecule_p() const
+Interval
+Crescendo::symbol_height()const
 {
-    Molecule* m_p =0;
-    Real x_off_dim=0.0;
-    Real absdyn_dim = 10 PT;   // ugh
-    
-    m_p = new Molecule;
+    return get_symbol().dim.y;
+}
+
+static Real absdyn_dim = 10 PT;        // ugh
+
+Symbol
+Crescendo::get_symbol()const
+{    
     Real w_dim = width().length();
     if ( left_dyn_b_ ) {
        w_dim -= absdyn_dim;
-       x_off_dim += absdyn_dim;
     }
     if ( right_dyn_b_ ) {
        w_dim -= absdyn_dim;
@@ -42,13 +44,23 @@ Crescendo::brew_molecule_p() const
        warning("Crescendo too small");
        w_dim = 0;
     }
-    Real lookup_wid = w_dim * 0.9; // make it slightly smaller.
+//    Real lookup_wid = w_dim * 0.9; // make it slightly smaller.
 
-    Symbol s( paper()->lookup_l()->hairpin( lookup_wid, grow_dir_i_ < 0) );
+    return Symbol( paper()->lookup_l()->hairpin( w_dim, grow_dir_i_ < 0) );
+}
+
+Molecule*
+Crescendo::brew_molecule_p() const
+{
+    Molecule* m_p =0;
+    Real x_off_dim=0.0;
+    if ( left_dyn_b_)
+       x_off_dim += absdyn_dim;
+    
+    m_p = new Molecule;
+    Symbol s(get_symbol());
     m_p->add(Atom(s));
-    int pos = get_position_i(s.dim.y);
-    m_p->translate(Offset(x_off_dim + 0.05 * w_dim, 
-                         pos * paper()->internote_f()));
+    m_p->translate(Offset(x_off_dim, pos_i_ * paper()->internote_f()));
     return m_p;
 }
 
index 998c1669ee022b48abaac3496683c23cf441d66e..0ebf499cdf55e4a029ab2676758c8e6b5d91d62e 100644 (file)
@@ -28,9 +28,11 @@ public:
 protected:
     SCORE_ELEM_CLONE(Crescendo);
     virtual Molecule*brew_molecule_p()const;
+    virtual Interval symbol_height()const;
     NAME_MEMBERS();
     
 private:
+    Symbol get_symbol()const;
     
 };
 
index f6d41a2c2ff470446641fdcaef595b4bea1c2595..ef7dae9f325e24f7a0acd75698c295a29bb29503 100644 (file)
@@ -15,8 +15,6 @@
  */
 class Script : public Item, public Staff_side {
     
-    int pos_i_;
-    
     Stem *stem_l_;
 
     /* *************** */
@@ -24,14 +22,12 @@ protected:
     Molecule *brew_molecule_p()const;
     virtual void do_substitute_dependency(Score_elem*,Score_elem*);
     virtual void do_print() const;
-    virtual void do_post_processing();
+    virtual Interval symbol_height()const;
     virtual void do_pre_processing();
     virtual Interval do_width() const;
 private:
 
     void set_default_dir();
-    void set_default_index();
-    Symbol symbol()const;
 public:
     General_script_def *specs_l_;
     
index 1d4245abbbc0b26222c1614ca8bcda50ef2d7870..d62da65daddf63cf4f2a8194eaeb3d569ab3d18a 100644 (file)
 #define STAFF_SIDE_HH
 
 #include "score-elem.hh"
+#include "interval.hh"
 
-/// A symbol which sits along  the staff
+/** A symbol which sits along a staff
+
+  Should override translate_y() ?
+  */
 class Staff_side : virtual Score_elem {
     Link_array<Score_elem> support_l_arr_;
     int staff_size_i_;
     Interval support_height()const;
     Staff_symbol* staff_sym_l_;
+    int get_position_i()const;
 
     void read_staff_sym();
 public:
@@ -26,10 +31,13 @@ public:
       Vertical dir of symbol relative to staff. -1 = below staff?
       */
     int dir_i_;
+    Interval sym_int_;
     
     /// follow the support inside the staff?
     bool inside_staff_b_;
 
+    int pos_i_;
+
     void set_staffsym(Staff_symbol *  );
   
     Staff_side();
@@ -37,8 +45,8 @@ public:
     NAME_MEMBERS();
     
 protected:
+    virtual Interval symbol_height() const;
     virtual void do_substitute_dependency(Score_elem *, Score_elem*);
-    int get_position_i()const;
-    int get_position_i(Interval)const;
+    virtual void do_post_processing();
 };
 #endif // STAFF_SIDE_HH
index 16bffcd0d89f4ae4466a912f1e1dc8a0660ab3d0..d4cbcff36436fedcea9cc8e07da8d4cfc0accdf2 100644 (file)
@@ -19,8 +19,6 @@ class Text_item : public Item ,public Staff_side{
  
 public:
 
-    int pos_i_;
-
     /// do I have width?
     bool fat_b_;
     
@@ -33,9 +31,9 @@ public:
 protected:
     General_script_def * tdef_p_;
 
-    virtual void set_default_index();
+    virtual Interval symbol_height()const;
+
     virtual Molecule* brew_molecule_p() const;
-    virtual void do_post_processing();
     virtual void do_pre_processing();
 };
 
index bf013593992603eda50f878399f4c6177a05b572..c74afdb1fb45341848d861a2aaf4b1f9467e08d3 100644 (file)
@@ -43,7 +43,6 @@ Script::Script()
     specs_l_ = 0;
     inside_staff_b_ = false;
     stem_l_ = 0;
-    pos_i_ = 0;
     dir_i_ =  0;
 }
 
@@ -64,11 +63,6 @@ Script::set_default_dir()
     assert(dir_i_);
 }
 
-void
-Script::set_default_index()
-{
-    pos_i_ = get_position_i(specs_l_->get_atom(paper(), dir_i_).extent().y);
-}
 
 Interval
 Script::do_width() const
@@ -84,10 +78,10 @@ Script::do_pre_processing()
     inside_staff_b_ = specs_l_->inside_b();
 }
 
-void
-Script::do_post_processing()
+Interval
+Script::symbol_height()const
 {
-    set_default_index();
+    return specs_l_->get_atom(paper(), dir_i_).extent().y;
 }
 
 Molecule*
index e7d8ccebf6cec936aa5c32704a256040e6b75bd1..9cb61495f960c92bf75e1d770f1dff481ddc5c8c 100644 (file)
@@ -22,6 +22,8 @@ Staff_side::set_staffsym(Staff_symbol* s_l)
 
 Staff_side::Staff_side()
 {
+    pos_i_ =0;
+    sym_int_ = Interval(0,0);
     staff_size_i_ = 0;
     staff_sym_l_=0;
     dir_i_ =0;
@@ -86,16 +88,20 @@ Staff_side::get_position_i()const
     return int(rint(Real(y)/inter_f)); // should ret a float?
 }
 
-int
-Staff_side::get_position_i(Interval sym_dim) const
-{ 
-    int i= get_position_i();
-    if (dir_i_)
-       return i+ int(rint(- sym_dim[-dir_i_] / paper()->internote_f()));
-    else
-       return i;
+Interval
+Staff_side::symbol_height() const
+{
+    return Interval(0,0);
 }
 
+void
+Staff_side::do_post_processing()
+{
+    sym_int_ = symbol_height();
+    pos_i_ = get_position_i( );
+    if (dir_i_)
+       pos_i_ += int(rint(- sym_int_[-dir_i_] / paper()->internote_f()));
+}
 
 void
 Staff_side::do_substitute_dependency(Score_elem*o, Score_elem*n)
index 42ae3994c4040a0a3db659e4aa873aef226caab2..a8cddcfade0c8b5f59b80aa9dd8ff66269139c6d 100644 (file)
@@ -19,7 +19,6 @@ Text_item::Text_item(General_script_def*tdef_l, int d)
     dir_i_ = d;
     fat_b_ = false;
     tdef_p_ = tdef_l->clone();
-    pos_i_ =0;
 }
 
 Text_item::~Text_item()
@@ -27,13 +26,6 @@ Text_item::~Text_item()
     delete tdef_p_;
 }
 
-void
-Text_item::set_default_index()
-{
-    pos_i_  = get_position_i(
-       tdef_p_->get_atom(paper(), dir_i_).extent().y );
-}
-
 void
 Text_item::do_pre_processing()
 {
@@ -41,12 +33,11 @@ Text_item::do_pre_processing()
        dir_i_ = -1;
 }
 
-void
-Text_item::do_post_processing()
+Interval
+Text_item::symbol_height()const
 {
-    set_default_index();
+    return tdef_p_->get_atom(paper(), dir_i_).sym_.dim.y;
 }
-
     
 Molecule*
 Text_item::brew_molecule_p() const