]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.55
authorfred <fred>
Sun, 24 Mar 2002 19:41:37 +0000 (19:41 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:41:37 +0000 (19:41 +0000)
lily/.version
lily/script.cc
lily/staff-side.cc

index 99892df436c194914d6a48039787a6b4dfdf908c..f50a4d2508e79f07ea12be6859c8410d97194675 100644 (file)
@@ -1,6 +1,6 @@
 MAJOR_VERSION = 0
 MINOR_VERSION = 0
-PATCH_LEVEL = 54
+PATCH_LEVEL = 55
 # use to send patches, always empty for released version:
 # include separator: ".postfix", "-pl" makes rpm barf
 
index 2f471e6ef2344f416b22b5954e2c8091feb17702..8a35f2ed894861b31c518a31a7fd7e9f5e8907c9 100644 (file)
@@ -74,7 +74,8 @@ Script::symbol()const
 void
 Script::do_pre_processing()
 {
-    set_default_dir();
+    if (!dir_i_)
+       set_default_dir();
     set_symdir();
 }
 
index 0bf26223ab05777ddebf629fe366ac22692fb23e..b9974b5b5ac44802a7eef8c3ce24882086791fca 100644 (file)
@@ -6,6 +6,7 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include "dimen.hh"
 #include "staff-side.hh"
 #include "staff-sym.hh"
 #include "debug.hh"
@@ -18,18 +19,33 @@ Staff_side::set_staffsym(Staff_symbol* s_l)
 
 Staff_side::Staff_side(Staff_elem * elem_l)
 {
+    inter_f_ = 2 PT;
+    staff_size_i_ = 0;
+    staff_sym_l_=0;
     elem_l_ = elem_l;
     dir_i_ =0;
-    staff_sym_l_ =0;
     inside_staff_b_ =false;
 }
 
+void
+Staff_side::read_staff_sym()
+{
+    if (! staff_sym_l_)
+       return ;
+    inter_f_ = staff_sym_l_->inter_note_f();
+    staff_size_i_ = staff_sym_l_->steps_i();
+}
+
 
 Interval
 Staff_side::support_height() const return r;
 {
+    
     for (int i=0; i < support_l_arr_.size(); i++)
        r.unite(support_l_arr_[i]->height());
+    if (r.empty_b()) {
+       r = Interval(0,0);
+    }
 }
 
 void
@@ -42,45 +58,35 @@ Staff_side::add_support(Staff_elem*i)
 int
 Staff_side::get_position_i()const
 {
-    if (!staff_sym_l_)
-       return 0;
+    ((Staff_side*)this)->read_staff_sym();
     if (!dir_i_) {
-       warning("Staff_side::get_position_i(): returning -20");
+       warning("Staff_side::get_position_i(): " 
+               "somebody forgot to set my vertical direction, returning -20");
        return -20;
     }
     
-    Real inter_f = staff_sym_l_->inter_note_f();
-    int staff_size_i = staff_sym_l_->steps_i();
+
     Real y=0;
     if (!inside_staff_b_) {
-       y  = (dir_i_ > 0) ? staff_size_i + 2: -2; 
-       y *=inter_f;
+       y  = (dir_i_ > 0) ? staff_size_i_ + 2: -2; 
+       y *=inter_f_;
        Interval v= support_height();
 
        if (dir_i_ > 0) {
-           y = y >? (v.max() + 2*inter_f);
+           y = y >? (v.max() + 2*inter_f_);
        } else if (dir_i_ < 0) {
-           y = y <? (v.min() - 2*inter_f);
+           y = y <? (v.min() - 2*inter_f_);
        }
     } else {
        Interval v= support_height();
-       y = v[dir_i_]  + 2*dir_i_*inter_f     // ugh
+       y = v[dir_i_]  + 2*dir_i_*inter_f_;     // ugh
     }
-    return int(rint(Real(y)/inter_f)); // should ret a float?
+    return int(rint(Real(y)/inter_f_)); // should ret a float?
 }
 
 int
 Staff_side::get_position_i(Interval sym_dim) const
 { 
-    if (!staff_sym_l_)
-       return 0;
-   if (!dir_i_) {
-       warning("Staff_side::get_position_i(): returning -20");
-       return -20;
-    }
-   
-    Real inter_f = staff_sym_l_->inter_note_f();
-  
     int i= get_position_i();
-    return i+ int(rint(- sym_dim[dir_i_] / inter_f));
+    return i+ int(rint(- sym_dim[dir_i_] / inter_f_));
 }