#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
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
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;
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;
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*);
/*
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
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();
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();
};
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)
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()
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_ = "";
+}