+/*
+ stem.cc -- implement Stem
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "stem.hh"
#include "dimen.hh"
#include "debug.hh"
print_flag_b_=true;
stem_xoffset_f_ =0;
-
}
-IMPLEMENT_STATIC_NAME(Stem);
+
+IMPLEMENT_IS_TYPE_B1(Stem,Item);
void
Stem::do_print() const
{
#ifndef NPRINT
mtor << "flag "<< flag_i_ << " print_flag_b_ " << print_flag_b_;
-
#endif
}
{
return !head_l_arr_.size();
}
-bool
-Stem::chord_b() const
-{
- return head_l_arr_.size() > 1;
-}
-// if dir_i_ is set we return a fake value.
+// if dir_i_ is set we return fake values.
int
-Stem::get_center_distance()
+Stem::get_center_distance_from_top()
{
if (dir_i_)
- return -dir_i_;
+ return (dir_i_ > 0) ? 0 : 1;
int staff_center = staff_size_i_ / 2;
- int min = min_head_i() - staff_center;
int max = max_head_i() - staff_center;
- return (abs(max) > abs(min)) ? max : min;
+ return max >? 0;
+}
+
+// if dir_i_ is set we return fake values.
+int
+Stem::get_center_distance_from_bottom()
+{
+ if (dir_i_)
+ return (dir_i_ > 0) ? 1 : 0;
+
+ int staff_center = staff_size_i_ / 2;
+ int min = staff_center - min_head_i();
+ return min >? 0;
}
int
Stem::get_default_dir()
{
if (dir_i_)
- return dir_i_;
- return -sign(get_center_distance());
+ return dir_i_;
+ return (get_center_distance_from_top() >=
+ get_center_distance_from_bottom()) ? -1 : 1;
}
stem_xoffset_f_ = 0;
}
+/*
+ TODO
+
+ move into note_column.cc
+
+ */
void
Stem::set_noteheads()
{
if(!head_l_arr_.size())
return;
head_l_arr_.sort(Note_head::compare);
+ if (dir_i_ < 0)
+ head_l_arr_.reverse();
+
head_l_arr_[0]->extremal_i_ = -1;
head_l_arr_.top()->extremal_i_ = 1;
int parity=1;
set_default_extents();
set_noteheads();
flag_i_ = dir_i_*abs(flag_i_);
+ transparent_b_ = invisible_b();
+ empty_b_ = invisible_b();
}
if (!print_flag_b_ || abs(flag_i_) <= 4)
return Interval(0,0); // TODO!
Paper_def*p= paper();
- Interval r(p->lookup_l()->flag(flag_i_).dim.x);
+ Interval r(p->lookup_l()->flag(flag_i_).dim.x());
r+= stem_xoffset_f_;
return r;
}
Stem::brew_molecule_p()const
{
Molecule *out =0;
- if ( invisible_b() )
- return Score_elem::brew_molecule_p();
-
+
Real bot = stem_bottom_f_;
Real top = stem_top_f_;
assert(false);
}
- out->translate(Offset(stem_xoffset_f_,0));
+ out->translate(stem_xoffset_f_, X_AXIS);
return out;
}